From 24a480e1e0e5a5f1c9915d93b6d8f5899428a0f8 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Wed, 3 Jul 2024 23:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E8=84=9A=E6=9C=AC=E8=B7=91=E4=B8=8D?= =?UTF-8?q?=E4=BA=86=20=E6=A1=86=E6=9E=B6=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zenitha | 2 +- assets/gameTables.lua | 10 +++++----- assets/map.lua | 6 +++--- assets/scene/error.lua | 2 +- assets/scene/game.lua | 20 ++++++++++---------- assets/scene/lang.lua | 2 +- assets/scene/load.lua | 5 +---- assets/scene/main.lua | 2 +- assets/scene/mapSelect.lua | 6 +++--- assets/scene/quit.lua | 2 +- assets/scene/result.lua | 2 +- assets/scene/setting.lua | 4 ++-- assets/scene/setting_key.lua | 4 ++-- assets/scene/stat.lua | 2 +- 14 files changed, 33 insertions(+), 36 deletions(-) diff --git a/Zenitha b/Zenitha index e6a7e01..5eb4601 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit e6a7e0166cc852f2294505054bdeec8c1f5ba7f9 +Subproject commit 5eb4601eba3d9010e57f829ac40196d6d10e29ca diff --git a/assets/gameTables.lua b/assets/gameTables.lua index 3e61d39..7d0f03a 100644 --- a/assets/gameTables.lua +++ b/assets/gameTables.lua @@ -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 @@ -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,{ diff --git a/assets/map.lua b/assets/map.lua index fd5b4fe..b2a4665 100644 --- a/assets/map.lua +++ b/assets/map.lua @@ -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 @@ -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 @@ -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)) diff --git a/assets/scene/error.lua b/assets/scene/error.lua index 82ca133..c96fce4 100644 --- a/assets/scene/error.lua +++ b/assets/scene/error.lua @@ -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." diff --git a/assets/scene/game.lua b/assets/scene/game.lua index 496b217..992ad1f 100644 --- a/assets/scene/game.lua +++ b/assets/scene/game.lua @@ -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 @@ -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 @@ -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',""..Text.noFile) end BGM.play(game.map.qbpFilePath,'-preLoad') @@ -233,14 +233,14 @@ function scene.enter() local _ _,err=pcall(func) if err then - MSG.new('error',err) + MSG.new('error',""..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',("$1:$2"):repD(err:match('^%d+'),err:sub(err:find(':')+1))) end else - MSG.new('error',Text.noFile) + MSG.new('error',""..Text.noFile) end end callScriptEvent('init') @@ -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',""..Text.noFile) image=nil end end @@ -271,7 +271,7 @@ function scene.enter() applyFPS(true) end -function scene.leave() +function scene.unload() BGM.stop() applyClickFX(SET.clickFX) applyFPS(false) @@ -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 diff --git a/assets/scene/lang.lua b/assets/scene/lang.lua index e0d4384..daaca81 100644 --- a/assets/scene/lang.lua +++ b/assets/scene/lang.lua @@ -22,7 +22,7 @@ local curLang=1 ---@type Zenitha.Scene local scene={} -function scene.leave() +function scene.unload() saveSettings() end diff --git a/assets/scene/load.lua b/assets/scene/load.lua index a2b1bf9..ed0827e 100644 --- a/assets/scene/load.lua +++ b/assets/scene/load.lua @@ -18,7 +18,7 @@ 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)} @@ -26,9 +26,6 @@ function scene.enter() progress=0 maxProgress=10 end -function scene.leave() - love.event.quit() -end function scene.mouseDown() if LOADED then diff --git a/assets/scene/main.lua b/assets/scene/main.lua index f8ce256..0542f88 100644 --- a/assets/scene/main.lua +++ b/assets/scene/main.lua @@ -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 diff --git a/assets/scene/mapSelect.lua b/assets/scene/mapSelect.lua index 706f692..ea8cd91 100644 --- a/assets/scene/mapSelect.lua +++ b/assets/scene/mapSelect.lua @@ -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) @@ -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, @@ -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() diff --git a/assets/scene/quit.lua b/assets/scene/quit.lua index 2669e0a..98f9da3 100644 --- a/assets/scene/quit.lua +++ b/assets/scene/quit.lua @@ -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) diff --git a/assets/scene/result.lua b/assets/scene/result.lua index 8130535..e6499ef 100644 --- a/assets/scene/result.lua +++ b/assets/scene/result.lua @@ -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, diff --git a/assets/scene/setting.lua b/assets/scene/setting.lua index 1124070..45a1adb 100644 --- a/assets/scene/setting.lua +++ b/assets/scene/setting.lua @@ -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 diff --git a/assets/scene/setting_key.lua b/assets/scene/setting_key.lua index 8956677..6a2dc77 100644 --- a/assets/scene/setting_key.lua +++ b/assets/scene/setting_key.lua @@ -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 diff --git a/assets/scene/stat.lua b/assets/scene/stat.lua index 12c0baf..d2ebd04 100644 --- a/assets/scene/stat.lua +++ b/assets/scene/stat.lua @@ -3,7 +3,7 @@ local scene={} local item -function scene.enter() +function scene.load() BG.set('none') item={ STAT.run,