整 理 代 码

(应该没有改到字符串里面的东西吧…)起码不直接影响运行
This commit is contained in:
MrZ_26
2022-10-01 11:32:11 +08:00
parent 6e00ff96ec
commit 06f4bb4e1a
236 changed files with 2087 additions and 2114 deletions

View File

@@ -20,20 +20,20 @@ local scene={}
local function _updateMenuButtons()
WIDGET.active.restart.hide=replaying
local pos=(GAME.tasUsed or replaying)and'right'or SETTING.menuPos
local pos=(GAME.tasUsed or replaying) and 'right' or SETTING.menuPos
modeTextWidK=math.min(280/TEXTOBJ.modeName:getWidth(),1)
if GAME.replaying then
WIDGET.active.pause.x=1195
modeTextPos=1185-TEXTOBJ.modeName:getWidth()*modeTextWidK
elseif pos=='right'then
elseif pos=='right' then
WIDGET.active.restart.x=1125
WIDGET.active.pause.x=1195
modeTextPos=1115-TEXTOBJ.modeName:getWidth()*modeTextWidK
elseif pos=='middle'then
elseif pos=='middle' then
WIDGET.active.restart.x=360
WIDGET.active.pause.x=860
modeTextPos=940
elseif pos=='left'then
elseif pos=='left' then
WIDGET.active.restart.x=120
WIDGET.active.pause.x=190
modeTextPos=1200-TEXTOBJ.modeName:getWidth()*modeTextWidK
@@ -108,10 +108,10 @@ local function _rep5()
gameRate=5
_updateRepButtons()
end
local function _step()trigGameRate=trigGameRate+1 end
local function _step() trigGameRate=trigGameRate+1 end
local function _restart()
resetGameData(PLAYERS[1].frameRun<240 and'q')
resetGameData(PLAYERS[1].frameRun<240 and 'q')
noKey=replaying
noTouch=replaying
trigGameRate,gameRate=0,1
@@ -143,7 +143,7 @@ function scene.sceneInit()
noKey=replaying
noTouch=not SETTING.VKSwitch or replaying
if SCN.prev~='depause'and SCN.prev~='pause'then
if SCN.prev~='depause' and SCN.prev~='pause' then
trigGameRate,gameRate=0,1
elseif not replaying then
if GAME.tasUsed then
@@ -189,7 +189,7 @@ function scene.touchMove()
local B=keys[n]
if B.ava then
for i=1,#L,2 do
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
if (L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
goto CONTINUE_nextKey
end
end
@@ -201,39 +201,39 @@ function scene.touchMove()
end
function scene.keyDown(key,isRep)
if replaying then
if key=='space'then
if key=='space' then
if not isRep then
gameRate=gameRate==0 and 1 or 0
end
_updateRepButtons()
elseif key=='left'then
elseif key=='left' then
if not isRep then
_speedDown()
end
elseif key=='right'then
elseif key=='right' then
if gameRate==0 then
_step()
elseif not isRep then
_speedUp()
end
elseif key=='escape'then
elseif key=='escape' then
pauseGame()
end
else
if isRep then
return
elseif _checkGameKeyDown(key)then
elseif _checkGameKeyDown(key) then
if GAME.tasUsed then
if key=='f1'then
if key=='f1' then
if not isRep then
gameRate=gameRate==0 and .125 or 0
end
_updateRepButtons()
elseif key=='f2'then
elseif key=='f2' then
if not isRep then
_speedDown()
end
elseif key=='f3'then
elseif key=='f3' then
if gameRate==0 then
_step()
elseif not isRep then
@@ -241,7 +241,7 @@ function scene.keyDown(key,isRep)
end
end
end
if key=='escape'then
if key=='escape' then
pauseGame()
end
end
@@ -267,7 +267,7 @@ function scene.gamepadDown(key)
else
_restart()
end
elseif key=='back'then
elseif key=='back' then
pauseGame()
end
end
@@ -288,10 +288,10 @@ local function _update_common(dt)
VK.update(dt)
--Update players
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
for p=1,#PLAYERS do PLAYERS[p]:update(dt) end
--Fresh royale target
if PLAYERS[1].frameRun%120==0 and PLAYERS[1].gameEnv.layout=='royale'then
if PLAYERS[1].frameRun%120==0 and PLAYERS[1].gameEnv.layout=='royale' then
freshMostDangerous()
end
@@ -337,7 +337,7 @@ function scene.draw()
VK.draw()
--Attacking & Being attacked
if PLAYERS[1].gameEnv.layout=='royale'then
if PLAYERS[1].gameEnv.layout=='royale' then
local P=PLAYERS[1]
gc_setLineWidth(5)
gc_setColor(.8,1,0,.2)
@@ -362,7 +362,7 @@ function scene.draw()
gc_draw(TEXTOBJ.modeName,modeTextPos,10,0,modeTextWidK,1)
local M=GAME.curMode
if M then
if M.score and M.records[1]then
if M.score and M.records[1] then
setFont(15)
gc_setColor(1,1,1,.6)
gc_print(M.scoreDisp(M.records[1]),modeTextPos,45)