Skip to content

Commit

Permalink
修脚本跑不了
Browse files Browse the repository at this point in the history
框架跟进
  • Loading branch information
MrZ626 committed Jul 3, 2024
1 parent cf54d44 commit 24a480e
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Zenitha
10 changes: 5 additions & 5 deletions assets/gameTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ mapMetaKeys={
}
mapMetaKeyMap={} for i=1,#mapMetaKeys do mapMetaKeyMap[mapMetaKeys[i]]=true end
defaultChordColor={
{COLOR.hex("FFFF00")},
{COLOR.hex("FFC000")},
{COLOR.hex("FF6000")},
{COLOR.hex("FF0000")},
{COLOR.HEX("FFFF00")},
{COLOR.HEX("FFC000")},
{COLOR.HEX("FF6000")},
{COLOR.HEX("FF0000")},
}setmetatable(defaultChordColor,{__index=function(self,k)
local l=#self
for i=l+1,k do
Expand Down Expand Up @@ -92,7 +92,7 @@ do
'math','string','table',
'bit','coroutine',
'MATH','STRING','TABLE',
} do TABLE.updateMissing(_G[v],mapScriptEnv[v]) end
} do TABLE.updateMissing(mapScriptEnv[v],_G[v]) end
mapScriptEnv.string.dump=nil
local dangerousLibMeta={__index=function() error("No way.") end}
for _,v in next,{
Expand Down
6 changes: 3 additions & 3 deletions assets/map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ function Map.new(file)
data[1]=data[1]:sub(2)
end
_syntaxCheck(not data[1]:find("[^0-9a-fA-F]") and #data[1]<=6,"Invalid color code")
r,g,b=COLOR.hex(data[1])
r,g,b=COLOR.HEX(data[1])
if neg then
r,g,b=-r,-g,-b
end
Expand Down Expand Up @@ -580,7 +580,7 @@ function Map.new(file)
end
local color={{},{},{}}
for i=1,#codes do
color[1][i],color[2][i],color[3][i]=COLOR.hex(codes[i])
color[1][i],color[2][i],color[3][i]=COLOR.HEX(codes[i])
end
for i=1,#trackList do
noteState.color[trackList[i]]=color
Expand Down Expand Up @@ -692,7 +692,7 @@ function Map.new(file)
else
for i=1,#c do
_syntaxCheck(not c[i]:find("[^0-9a-fA-F]") and #c[i]<=6,"Invalid color code")
c[i]={COLOR.hex(c[i])}
c[i]={COLOR.HEX(c[i])}
end
if #c>o.tracks-1 then _syntaxCheck(false,"Too many colors") end
setmetatable(c,getmetatable(defaultChordColor))
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/error.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local errorShot,errorInfo
---@type Zenitha.Scene
local scene={}

function scene.enter()
function scene.load()
BGcolor=rnd()>.026 and{.3,.5,.9} or{.62,.3,.926}
sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..ZENITHA.getErr('#').scene
errorText=LOADED and Text.errorMsg or "An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author."
Expand Down
20 changes: 10 additions & 10 deletions assets/scene/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ local function callScriptEvent(event,...)
if love.timer.getTime()-lastErrorTime[event]>=0.626 then
lastErrorTime[event]=love.timer.getTime()
err=err:gsub('%b[]:','')
-- MSG.new('error',("<$1>$2:$3"):repD(event,err:match('^%d+'),err:sub(err:find(':')+1)))
MSG.new('error',err)
MSG.new('error',("<$1>$2:$3"):repD(event,err:match('^%d+'),err:sub(err:find(':')+1)))
-- MSG.new('error',err)
end
end
end
Expand All @@ -158,7 +158,7 @@ end
---@type Zenitha.Scene
local scene={}

function scene.enter()
function scene.load()
KEY_MAP_inv:_update()
game.autoPlay=false
game.playSpeed=1
Expand Down Expand Up @@ -212,7 +212,7 @@ function scene.enter()
if love.filesystem.getInfo(dirPath..game.map.songFile) then
BGM.load(game.map.qbpFilePath,dirPath..game.map.songFile)
elseif game.map.songFile~="[songFile]" then
MSG.new('error',Text.noFile)
MSG.new('error',"<file>"..Text.noFile)
end
BGM.play(game.map.qbpFilePath,'-preLoad')

Expand All @@ -233,14 +233,14 @@ function scene.enter()
local _
_,err=pcall(func)
if err then
MSG.new('error',err)
MSG.new('error',"<firstrun>"..err)
end
else
err=err:gsub('%b[]:','')
MSG.new('error',("<$1>$2:$3"):repD('syntax',err:match('^%d+'),err:sub(err:find(':')+1)))
MSG.new('error',("<syntax>$1:$2"):repD(err:match('^%d+'),err:sub(err:find(':')+1)))
end
else
MSG.new('error',Text.noFile)
MSG.new('error',"<file>"..Text.noFile)
end
end
callScriptEvent('init')
Expand All @@ -252,7 +252,7 @@ function scene.enter()
local success
success,image=pcall(gc.newImage,dirPath..game.map.songImage)
if not success then
MSG.new('error',Text.noFile)
MSG.new('error',"<file>"..Text.noFile)
image=nil
end
end
Expand All @@ -271,7 +271,7 @@ function scene.enter()
applyFPS(true)
end

function scene.leave()
function scene.unload()
BGM.stop()
applyClickFX(SET.clickFX)
applyFPS(false)
Expand Down Expand Up @@ -377,7 +377,7 @@ function scene.keyDown(key,isRep)
if m then
SCN.args[1]=m
BGM.stop()
scene.enter()
scene.load()
else
MSG.new('error',errmsg)
end
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/lang.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local curLang=1
---@type Zenitha.Scene
local scene={}

function scene.leave()
function scene.unload()
saveSettings()
end

Expand Down
5 changes: 1 addition & 4 deletions assets/scene/load.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ local loadingThread=coroutine.wrap(function()
return 'finish'
end)

function scene.enter()
function scene.load()
local r=math.random()*6.2832
logoColor1={COLOR.rainbow(r)}
logoColor2={COLOR.rainbow_light(r)}
studioLogo=GC.newText(FONT.get(90),"26F Studio")
progress=0
maxProgress=10
end
function scene.leave()
love.event.quit()
end

function scene.mouseDown()
if LOADED then
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local scene={}
local tryCounter=0
local fool=os.date("%m%d")=="0401"

function scene.enter()
function scene.load()
BG.set()
BGM.play()
end
Expand Down
6 changes: 3 additions & 3 deletions assets/scene/mapSelect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local mapList
local listBox=WIDGET.new{
type='listBox',x=60,y=60,w=1160,h=500,lineHeight=40,drawFunc=function(v,_,sel)
if sel then
GC.setColor(COLOR.X)
GC.setColor(COLOR.T)
GC.rectangle('fill',0,0,1160,40)
end
GC.setColor(COLOR.L)
Expand Down Expand Up @@ -88,7 +88,7 @@ local function _freshSongList()
dText:sub(1,4)=='Hard' and COLOR.lR or
dText:sub(1,4)=='Luna' and COLOR.lM or
dText:sub(1,4)=='Over' and COLOR.dL or
COLOR.X,
COLOR.T,
tracks=metaData.realTracks and metaData.realTracks~=metaData.tracks and (('$1($2)'):repD(metaData.realTracks,metaData.tracks)) or metaData.tracks,
sortStr_difficulty=(source=='outside' and '0' or '1')..(metaData.realTracks or metaData.tracks)..difficultyNum..metaData.mapName,
sortStr_name=metaData.mapName..(metaData.realTracks or metaData.tracks)..(source=='outside' and '0' or '1')..difficultyNum,
Expand Down Expand Up @@ -116,7 +116,7 @@ local sortSelector=WIDGET.new{type='selector',pos={.5,1},x=240,y=-100,w=240,text
end
}

function scene.enter()
function scene.load()
if not mapLoaded then _freshSongList() end
BG.set()
BGM.play()
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/quit.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---@type Zenitha.Scene
local scene={}

function scene.enter()
function scene.load()
if SYSTEM~="iOS" then
if math.random()>.0000626 then
love.timer.sleep(.26)
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/result.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local results
---@type Zenitha.Scene
local scene={}

function scene.enter()
function scene.load()
applyFPS(false)
results=SCN.args[1] or{
fake=true,
Expand Down
4 changes: 2 additions & 2 deletions assets/scene/setting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ local scene={}

local boundaryDispTime

function scene.enter()
function scene.load()
local mobile=SYSTEM=='Android' or SYSTEM=='iOS'
scene.widgetList.fullscreen:setVisible(not mobile)
scene.widgetList.portrait:setVisible(mobile)
boundaryDispTime=0
BG.set()
end
function scene.leave()
function scene.unload()
saveSettings()
end

Expand Down
4 changes: 2 additions & 2 deletions assets/scene/setting_key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ local keyNames={
},
}setmetatable(keyNames.apple,{__index=keyNames.normal})

function scene.enter()
function scene.load()
selected=false
KEY_MAP_inv:_update()
BG.set('none')
end
function scene.leave()
function scene.unload()
saveFile(KEY_MAP,'conf/key')
end

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/stat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local scene={}

local item

function scene.enter()
function scene.load()
BG.set('none')
item={
STAT.run,
Expand Down

0 comments on commit 24a480e

Please sign in to comment.