整理代码,调整local函数名规范(较边缘的代码不必遵守,比如外部的库和小程序):

特别临时性的用全大写字母缩写或者单字母
TASK模块用到的任务函数和检查函数开头分别为task_和check_
其他函数开头添加下划线作为指示
This commit is contained in:
MrZ626
2021-08-25 02:40:01 +08:00
parent ee55055385
commit 8f910f95f4
40 changed files with 470 additions and 466 deletions

View File

@@ -2,7 +2,7 @@ local gc,kb,sys=love.graphics,love.keyboard,love.system
local int=math.floor
local CUSTOMENV=CUSTOMENV
local function notAir(L)
local function _notAir(L)
for i=1,10 do
if L[i]>0 then
return true
@@ -29,10 +29,10 @@ local scene={}
local sure
local initField
local function freshMiniFieldVisible()
local function _freshMiniFieldVisible()
initField=false
for y=1,20 do
if notAir(FIELD[1][y])then
if _notAir(FIELD[1][y])then
initField=true
return
end
@@ -43,7 +43,7 @@ function scene.sceneInit()
destroyPlayers()
BG.set(CUSTOMENV.bg)
BGM.play(CUSTOMENV.bgm)
freshMiniFieldVisible()
_freshMiniFieldVisible()
end
function scene.sceneBack()
BGM.play()
@@ -89,7 +89,7 @@ function scene.keyDown(key,isRep)
if sure>.3 then
TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION)
FIELD[1]=DATA.newBoard()
freshMiniFieldVisible()
_freshMiniFieldVisible()
TABLE.clear(CUSTOMENV)
TABLE.complete(require"parts.customEnv0",CUSTOMENV)
for _,W in next,scene.widgetList do W:reset()end
@@ -127,7 +127,7 @@ function scene.keyDown(key,isRep)
for i=4,#args do
if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end
end
freshMiniFieldVisible()
_freshMiniFieldVisible()
MES.new('check',text.importSuccess)
do return end
::THROW_fail::MES.new('error',text.dataCorrupted)

View File

@@ -53,7 +53,7 @@ local minoPosCode={
[3]=28,[33]=28,--I2
[1]=29,--O1
}
local function pTouch(x,y)
local function _pTouch(x,y)
if not curPen then return end
for i=1,#penPath do
if x==penPath[i][1]and y==penPath[i][2]then
@@ -69,7 +69,7 @@ local function pTouch(x,y)
end
ins(penPath,{x,y})
end
local function pDraw()
local function _pDraw()
local l=#penPath
if l==0 then return end
@@ -125,7 +125,7 @@ function scene.mouseMove(x,y)
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx>=1 and sx<=10 and sy>=1 and sy<=20 then
penX,penY=sx,sy
if curPen then pTouch(sx,sy)end
if curPen then _pTouch(sx,sy)end
else
penX,penY=nil
end
@@ -141,7 +141,7 @@ function scene.mouseDown(x,y,k)
end
function scene.mouseUp(_,_,k)
if curPen==k then
pDraw()
_pDraw()
curPen=false
end
end
@@ -168,7 +168,7 @@ function scene.keyDown(key)
elseif key=="space"then
if penX and penY then
curPen=1
pTouch(penX,penY)
_pTouch(penX,penY)
end
elseif key=="delete"then
if sure>.3 then
@@ -250,7 +250,7 @@ function scene.keyDown(key)
end
function scene.keyUp(key)
if key=="space"then
pDraw()
_pDraw()
curPen=false
end
end
@@ -439,41 +439,41 @@ function scene.draw()
end
end
local function setPen(i)return function(k)pens[k]=i end end
local function _setPen(i)return function(k)pens[k]=i end end
scene.widgetList={
WIDGET.newText{name="title", x=1020,y=5,font=70,align='R'},
WIDGET.newText{name="subTitle", x=1030,y=50,font=35,align='L',color='H'},
WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=setPen(1)},--B1
WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=setPen(2)},--B2
WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=setPen(3)},--B3
WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=setPen(4)},--B4
WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=setPen(5)},--B5
WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=setPen(6)},--B6
WIDGET.newButton{name="b7", x=1060, y=130,w=75,fText="",color='G',code=setPen(7)},--B7
WIDGET.newButton{name="b8", x=1140, y=130,w=75,fText="",color='A',code=setPen(8)},--B8
WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=_setPen(1)},--B1
WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=_setPen(2)},--B2
WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=_setPen(3)},--B3
WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=_setPen(4)},--B4
WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=_setPen(5)},--B5
WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=_setPen(6)},--B6
WIDGET.newButton{name="b7", x=1060, y=130,w=75,fText="",color='G',code=_setPen(7)},--B7
WIDGET.newButton{name="b8", x=1140, y=130,w=75,fText="",color='A',code=_setPen(8)},--B8
WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=setPen(9)},--B9
WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=setPen(10)},--B10
WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=setPen(11)},--B11
WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=setPen(12)},--B12
WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=setPen(13)},--B13
WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=setPen(14)},--B14
WIDGET.newButton{name="b15", x=1060, y=210,w=75,fText="",color='M',code=setPen(15)},--B15
WIDGET.newButton{name="b16", x=1140, y=210,w=75,fText="",color='W',code=setPen(16)},--B16
WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=_setPen(9)},--B9
WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=_setPen(10)},--B10
WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=_setPen(11)},--B11
WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=_setPen(12)},--B12
WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=_setPen(13)},--B13
WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=_setPen(14)},--B14
WIDGET.newButton{name="b15", x=1060, y=210,w=75,fText="",color='M',code=_setPen(15)},--B15
WIDGET.newButton{name="b16", x=1140, y=210,w=75,fText="",color='W',code=_setPen(16)},--B16
WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH', code=setPen(17)},--BONE
WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=setPen(18)},--HIDE
WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY', code=setPen(19)},--BOMB
WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=setPen(20)},--GB1
WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH', code=setPen(21)},--GB2
WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV', code=setPen(22)},--GB3
WIDGET.newButton{name="b23", x=1060, y=290,w=75,fText="_", color='dR', code=setPen(23)},--GB4
WIDGET.newButton{name="b24", x=1140, y=290,w=75,fText="_", color='dG', code=setPen(24)},--GB5
WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH', code=_setPen(17)},--BONE
WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=_setPen(18)},--HIDE
WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY', code=_setPen(19)},--BOMB
WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=_setPen(20)},--GB1
WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH', code=_setPen(21)},--GB2
WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV', code=_setPen(22)},--GB3
WIDGET.newButton{name="b23", x=1060, y=290,w=75,fText="_", color='dR', code=_setPen(23)},--GB4
WIDGET.newButton{name="b24", x=1140, y=290,w=75,fText="_", color='dG', code=_setPen(24)},--GB5
WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=setPen(0)},
WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=setPen(-1)},
WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=setPen(-2)},
WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=_setPen(0)},
WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=_setPen(-1)},
WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=_setPen(-2)},
WIDGET.newButton{name="push", x=990, y=400,w=120,h=120,color='lY',font=20,code=pressKey"k"},
WIDGET.newButton{name="del", x=1120, y=400,w=120,h=120,color='lY',font=20,code=pressKey"l"},

View File

@@ -30,15 +30,15 @@ local typeColor={
english=COLOR.B,
name=COLOR.lV,
}
local function getList()return result[1]and result or dict end
local function clearResult()
local function _getList()return result[1]and result or dict end
local function _clearResult()
TABLE.cut(result)
selected,scrollPos=1,0
waiting,lastSearch=0,false
end
local function search()
local function _search()
local input=inputBox:getText():lower()
clearResult()
_clearResult()
local first
for i=1,#dict do
local pos=find(dict[i][2],input,nil,true)
@@ -52,7 +52,7 @@ local function search()
if #result>0 then
SFX.play('reach')
end
url=getList()[selected][5]
url=_getList()[selected][5]
lastSearch=input
end
@@ -84,7 +84,7 @@ function scene.keyDown(key)
end
end
elseif key=="down"then
if selected and selected<#getList()then
if selected and selected<#_getList()then
selected=selected+1
if selected>scrollPos+15 then
scrollPos=selected-15
@@ -98,7 +98,7 @@ function scene.keyDown(key)
love.system.openURL(url)
elseif key=="delete"then
if inputBox:hasText()then
clearResult()
_clearResult()
inputBox:clear()
SFX.play('hold')
end
@@ -113,14 +113,14 @@ function scene.keyDown(key)
else
return
end
url=getList()[selected][5]
url=_getList()[selected][5]
end
function scene.update(dt)
local input=inputBox:getText()
if input~=lastTickInput then
if #input==0 then
clearResult()
_clearResult()
else
waiting=.8
end
@@ -130,14 +130,14 @@ function scene.update(dt)
waiting=waiting-dt
if waiting<=0 then
if #input>0 and input~=lastSearch then
search()
_search()
end
end
end
end
function scene.draw()
local list=getList()
local list=_getList()
gc.setColor(COLOR.Z)
local t=list[selected][4]
setFont(

View File

@@ -14,7 +14,7 @@ local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",
local scene={}
local function updateMenuButtons()
local function _updateMenuButtons()
WIDGET.active.restart.hide=replaying
local pos=(tasMode or replaying)and'right'or SETTING.menuPos
@@ -32,7 +32,7 @@ local function updateMenuButtons()
modeTextPos=1200-drawableText.modeName:getWidth()
end
end
local function updateRepButtons()
local function _updateRepButtons()
local L=scene.widgetList
if replaying or tasMode then
for i=1,6 do L[i].hide=false end L[7].hide=true
@@ -54,64 +54,64 @@ local function updateRepButtons()
for i=1,7 do L[i].hide=true end
end
end
local function speedUp()
local function _speedUp()
if gameRate==.125 then gameRate=.5
elseif gameRate==.5 then gameRate=1
elseif gameRate==1 then gameRate=2
elseif gameRate==2 then gameRate=5
end
updateRepButtons()
_updateRepButtons()
end
local function speedDown()
local function _speedDown()
if gameRate==.5 then gameRate=.125
elseif gameRate==1 then gameRate=.5
elseif gameRate==2 then gameRate=1
elseif gameRate==5 then gameRate=2
end
updateRepButtons()
_updateRepButtons()
end
local function _rep0()
scene.widgetList[1].hide=true
scene.widgetList[7].hide=false
gameRate=0
updateRepButtons()
_updateRepButtons()
end
local function _repP8()
scene.widgetList[2].hide=true
gameRate=.125
updateRepButtons()
_updateRepButtons()
end
local function _repP2()
scene.widgetList[3].hide=true
gameRate=.5
updateRepButtons()
_updateRepButtons()
end
local function _rep1()
scene.widgetList[4].hide=true
gameRate=1
updateRepButtons()
_updateRepButtons()
end
local function _rep2()
scene.widgetList[5].hide=true
gameRate=2
updateRepButtons()
_updateRepButtons()
end
local function _rep5()
scene.widgetList[6].hide=true
gameRate=5
updateRepButtons()
_updateRepButtons()
end
local function _step()floatGameRate=floatGameRate+1 end
local function restart()
local function _restart()
resetGameData(PLAYERS[1].frameRun<240 and'q')
noKey=replaying
noTouch=replaying
tasMode=false
floatGameRate,gameRate=0,1
updateRepButtons()
_updateRepButtons()
end
local function checkGameKeyDown(key)
local function _checkGameKeyDown(key)
local k=keyMap.keyboard[key]
if k then
if k>0 then
@@ -120,7 +120,7 @@ local function checkGameKeyDown(key)
VK.press(k)
return
elseif not GAME.fromRepMenu then
restart()
_restart()
return
end
end
@@ -148,8 +148,8 @@ function scene.sceneInit(org)
end
end
updateRepButtons()
updateMenuButtons()
_updateRepButtons()
_updateMenuButtons()
end
scene.mouseDown=NULL
@@ -198,16 +198,16 @@ function scene.keyDown(key,isRep)
if replaying then
if key=="space"then
if not isRep then gameRate=gameRate==0 and 1 or 0 end
updateRepButtons()
_updateRepButtons()
elseif key=="left"then
if not isRep then
speedDown()
_speedDown()
end
elseif key=="right"then
if gameRate==0 then
_step()
elseif not isRep then
speedUp()
_speedUp()
end
elseif key=="escape"then
pauseGame()
@@ -215,20 +215,20 @@ function scene.keyDown(key,isRep)
else
if isRep then
return
elseif checkGameKeyDown(key)then
elseif _checkGameKeyDown(key)then
if tasMode then
if key=="f1"then
if not isRep then gameRate=gameRate==0 and .125 or 0 end
updateRepButtons()
_updateRepButtons()
elseif key=='f2'then
if not isRep then
speedDown()
_speedDown()
end
elseif key=='f3'then
if gameRate==0 then
_step()
elseif not isRep then
speedUp()
_speedUp()
end
end
end
@@ -256,7 +256,7 @@ function scene.gamepadDown(key)
PLAYERS[1]:pressKey(k)
VK.press(k)
else
restart()
_restart()
end
elseif key=="back"then
pauseGame()
@@ -273,7 +273,7 @@ function scene.gamepadUp(key)
end
end
local function update_replay(repPtr)
local function _update_replay(repPtr)
local P1=PLAYERS[1]
local L=GAME.rep
while P1.frameRun==L[repPtr]do
@@ -290,7 +290,7 @@ local function update_replay(repPtr)
end
GAME.replaying=repPtr
end
local function update_common(dt)
local function _update_common(dt)
--Update control
touchMoveLastFrame=false
VK.update()
@@ -310,13 +310,13 @@ function scene.update(dt)
floatGameRate=floatGameRate+gameRate
while floatGameRate>=1 do
floatGameRate=floatGameRate-1
if GAME.replaying then update_replay(GAME.replaying)end
update_common(dt)
if GAME.replaying then _update_replay(GAME.replaying)end
_update_common(dt)
end
end
local tasText=gc.newText(getFont(100),"TAS")
local function drawAtkPointer(x,y)
local function _drawAtkPointer(x,y)
local t=TIME()
local a=t*3%1*.8
t=sin(t*20)
@@ -358,12 +358,12 @@ function scene.draw()
end
if P.atkMode~=4 then
if P.atking then
drawAtkPointer(P.atking.centerX,P.atking.centerY)
_drawAtkPointer(P.atking.centerX,P.atking.centerY)
end
else
for i=1,#P.atker do
local p=P.atker[i]
drawAtkPointer(p.centerX,p.centerY)
_drawAtkPointer(p.centerX,p.centerY)
end
end
end
@@ -393,7 +393,7 @@ scene.widgetList={
WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2,fText=TEXTURE.rep.rep2},
WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5,fText=TEXTURE.rep.rep5},
WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step,fText=TEXTURE.rep.step},
WIDGET.newKey{name="restart", x=0,y=45,w=60,code=restart,fText=TEXTURE.game.restart},
WIDGET.newKey{name="restart", x=0,y=45,w=60,code=_restart,fText=TEXTURE.game.restart},
WIDGET.newKey{name="pause", x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause},
}

View File

@@ -3,7 +3,7 @@ local passwordBox=WIDGET.newInputBox{name="password",x=380,y=300,w=620,h=60,secr
local savePW=false
local function login()
local function _login()
local email,password=emailBox:getText(),passwordBox:getText()
if not STRING.simpEmailCheck(email)then
MES.new('error',text.wrongEmail)return
@@ -35,7 +35,7 @@ scene.widgetList={
emailBox,
passwordBox,
WIDGET.newSwitch{name="keepPW", x=900,y=420,disp=function()return savePW end,code=function()savePW=not savePW end},
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=login},
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=_login},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},
}

View File

@@ -47,7 +47,7 @@ function scene.mouseDown(x,y)
end
end
scene.touchDown=scene.mouseDown
local function testButton(n)
local function _testButton(n)
if NET.getlock('access_and_login')then
MES.new('warn',text.wsConnecting)
else
@@ -61,15 +61,15 @@ end
function scene.keyDown(key,isRep)
if isRep then return end
if key=="1"then
if testButton(1)then
if _testButton(1)then
SCN.go('mode')
end
elseif key=="q"then
if testButton(2)then
if _testButton(2)then
loadGame(STAT.lastPlay,true)
end
elseif key=="a"then
if testButton(3)then
if _testButton(3)then
if WS.status('app')=='running'then
NET.tryLogin(false)
elseif WS.status('app')=='dead'then
@@ -79,39 +79,39 @@ function scene.keyDown(key,isRep)
end
end
elseif key=="z"then
if testButton(4)then
if _testButton(4)then
SCN.go('customGame')
end
elseif key=="-"then
if testButton(5)then
if _testButton(5)then
SCN.go('setting_game')
end
elseif key=="p"then
if testButton(6)then
if _testButton(6)then
SCN.go('stat')
end
elseif key=="l"then
if testButton(7)then
if _testButton(7)then
SCN.go('dict')
end
elseif key==","then
if testButton(8)then
if _testButton(8)then
SCN.go('replays')
end
elseif key=="2"then
if testButton(9)then
if _testButton(9)then
SCN.go('music')
end
elseif key=="3"then
if testButton(10)then
if _testButton(10)then
SCN.go('lang')
end
elseif key=="x"then
if testButton(11)then
if _testButton(11)then
SCN.go('about')
end
elseif key=="m"then
if testButton(12)then
if _testButton(12)then
SCN.go('manual')
end
elseif key=="c"then
@@ -140,7 +140,7 @@ function scene.update(dt)
end
end
local function tipStencil()
local function _tipStencil()
gc.rectangle('fill',0,0,tipLength,42)
end
function scene.draw()
@@ -159,7 +159,7 @@ function scene.draw()
gc.translate(260,650)
gc.setLineWidth(2)
gc.rectangle('line',0,0,tipLength,42,3)
gc.stencil(tipStencil)
gc.stencil(_tipStencil)
gc.setStencilTest('equal',1)
gc.draw(tip,0+scrollX,0)
gc.setColor(1,1,1,.2)

View File

@@ -2,17 +2,17 @@ local gc=love.graphics
local kb=love.keyboard
local ins,rem=table.insert,table.remove
local function modComp(a,b)
local function _modComp(a,b)
return a.no<b.no
end
local function remMod(M)
local function _remMod(M)
local i=TABLE.find(GAME.mod,M)
if i then rem(GAME.mod,i)end
end
local function toggleMod(M,back)
local function _toggleMod(M,back)
if M.sel==0 then
ins(GAME.mod,M)
table.sort(GAME.mod,modComp)
table.sort(GAME.mod,_modComp)
end
if M.list then
if back then
@@ -24,7 +24,7 @@ local function toggleMod(M,back)
M.sel=1-M.sel
end
if M.sel==0 then
remMod(M)
_remMod(M)
end
if M.unranked then
SFX.play('move',.6)
@@ -56,7 +56,7 @@ end
function scene.mouseDown(x,y,k)
for _,M in next,MODOPT do
if(x-M.x)^2+(y-M.y)^2<2000 then
toggleMod(M,k==2 or kb.isDown("lshift","rshift"))
_toggleMod(M,k==2 or kb.isDown("lshift","rshift"))
break
end
end
@@ -79,7 +79,7 @@ function scene.keyDown(key)
elseif #key==1 then
for _,M in next,MODOPT do
if key==M.key then
toggleMod(M,kb.isDown("lshift","rshift"))
_toggleMod(M,kb.isDown("lshift","rshift"))
selected=M
break
end

View File

@@ -44,14 +44,14 @@ function scene.sceneInit(org)
end
end
local function getK()
local function _getK()
return abs(mapCam.xOy:transformPoint(1,0)-mapCam.xOy:transformPoint(0,0))
end
local function getPos()
local function _getPos()
return mapCam.xOy:inverseTransformPoint(0,0)
end
local function onModeRaw(x,y)
local function _onModeRaw(x,y)
for name,M in next,MODES do
if visibleModes[name]and M.x then
local s=M.size
@@ -65,25 +65,25 @@ local function onModeRaw(x,y)
end
end
end
local function moveMap(dx,dy)
local k=getK()
local x,y=getPos()
local function _moveMap(dx,dy)
local k=_getK()
local x,y=_getPos()
if x>1300 and dx<0 or x<-1500 and dx>0 then dx=0 end
if y>420 and dy<0 or y<-1900 and dy>0 then dy=0 end
mapCam.xOy:translate(dx/k,dy/k)
end
function scene.wheelMoved(_,dy)
mapCam.keyCtrl=false
local k=getK()
local k=_getK()
k=min(max(k+dy*.1,.3),1.6)/k
mapCam.xOy:scale(k)
local x,y=getPos()
local x,y=_getPos()
mapCam.xOy:translate(x*(1-k),y*(1-k))
end
function scene.mouseMove(_,_,dx,dy)
if ms.isDown(1)then
moveMap(dx,dy)
_moveMap(dx,dy)
end
mapCam.keyCtrl=false
end
@@ -92,7 +92,7 @@ function scene.mouseClick(x,y)
if not _ or x<920 then
x,y=x-640,y-360
x,y=mapCam.xOy:inverseTransformPoint(x,y)
local SEL=onModeRaw(x,y)
local SEL=_onModeRaw(x,y)
if _~=SEL then
if SEL then
mapCam.moving=true
@@ -114,7 +114,7 @@ end
function scene.touchMove(x,y,dx,dy)
local L=tc.getTouches()
if not L[2]then
moveMap(dx,dy)
_moveMap(dx,dy)
elseif not L[3]then
x,y=SCR.xOy:inverseTransformPoint(tc.getPosition(L[1]))
dx,dy=SCR.xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!!
@@ -178,9 +178,9 @@ function scene.update()
if kb.isDown("lctrl","rctrl","lalt","ralt")then
scene.wheelMoved(nil,(dy-dx)*.026)
else
moveMap(dx,dy)
local x,y=getPos()
local SEL=onModeRaw(x,y)
_moveMap(dx,dy)
local x,y=_getPos()
local SEL=_onModeRaw(x,y)
if SEL and mapCam.sel~=SEL then
mapCam.sel=SEL
SFX.play('click')
@@ -210,7 +210,7 @@ local baseRankColor={
{.85,.8,.3,.3},
}
local rankColor=rankColor
local function drawModeShape(M,S,drawType)
local function _drawModeShape(M,S,drawType)
if M.shape==1 then--Rectangle
gc_rectangle(drawType,M.x-S,M.y-S,2*S,2*S)
elseif M.shape==2 then--Diamond
@@ -254,10 +254,10 @@ function scene.draw()
--Draw shapes on map
if unlocked==1 then
gc_setColor(baseRankColor[rank])
drawModeShape(M,S,'fill')
_drawModeShape(M,S,'fill')
end
gc_setColor(1,1,sel==name and 0 or 1,unlocked==1 and .8 or .3)
drawModeShape(M,S,'line')
_drawModeShape(M,S,'line')
--Icon
local icon=M.icon

View File

@@ -21,7 +21,7 @@ local noTouch,noKey=false,false
local touchMoveLastFrame=false
local newMessageTimer
local function hideReadyUI()
local function _hideReadyUI()
return
playing or
NET.roomState.start or
@@ -150,7 +150,7 @@ function scene.keyDown(key,isRep)
PLAYERS[1]:pressKey(k)
VK.press(k)
end
elseif not hideReadyUI()then
elseif not _hideReadyUI()then
if key=="space"then
if netPLY.getSelfJoinMode()==0 then
(kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)()
@@ -328,15 +328,15 @@ function scene.draw()
gc_print("M",430,10)
end
end
local function hideF_ingame()return hideReadyUI()or netPLY.getSelfReady()end
local function hideF_ingame2()return hideReadyUI()or not netPLY.getSelfReady()end
local function _hideF_ingame()return _hideReadyUI()or netPLY.getSelfReady()end
local function _hideF_ingame2()return _hideReadyUI()or not netPLY.getSelfReady()end
scene.widgetList={
textBox,
inputBox,
WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90, fText=TEXTURE.setting, code=_gotoSetting,hideF=hideF_ingame},
WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=hideF_ingame},
WIDGET.newKey{name="spectate", x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=hideF_ingame},
WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=hideF_ingame2},
WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90, fText=TEXTURE.setting, code=_gotoSetting,hideF=_hideF_ingame},
WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ingame},
WIDGET.newKey{name="spectate", x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ingame},
WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=_hideF_ingame2},
WIDGET.newKey{name="chat", x=360,y=45,w=60,fText="...",font=35, code=_switchChat},
WIDGET.newKey{name="quit", x=860,y=45,w=60,fText=TEXTURE.quit_small, code=_quit},
}

View File

@@ -24,7 +24,7 @@ local sList={
local scene={}
local function createRoom()
local function _createRoom()
local pw=passwordBox.value
if pw==""then pw=nil end
local roomname=STRING.trim(roomNameBox.value)
@@ -51,7 +51,7 @@ end
function scene.keyDown(key)
if key=="return"then
createRoom()
_createRoom()
elseif key=="escape"then
SCN.back()
else

View File

@@ -29,11 +29,11 @@ local roomList=WIDGET.newListBox{name="roomList",x=50,y=50,w=800,h=440,lineH=40,
end
gc_print(item.roomInfo.name,200,-4)
end}
local function hidePW()
local function _hidePW()
local R=roomList:getSel()
return not R or not R.private
end
local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=hidePW}
local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=_hidePW}
--[[roomList[n]={
rid="qwerty",
@@ -47,7 +47,7 @@ local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secr
count=4,
capacity=5,
}]]
local function fetchRoom()
local function _fetchRoom()
fetchTimer=10
NET.fetchRoom()
end
@@ -55,7 +55,7 @@ local scene={}
function scene.sceneInit()
BG.set()
fetchRoom()
_fetchRoom()
end
function scene.keyDown(key)
@@ -63,7 +63,7 @@ function scene.keyDown(key)
if WIDGET.sel~=passwordBox then
if key=="r"then
if fetchTimer<=7 then
fetchRoom()
_fetchRoom()
end
elseif key=="s"then
SCN.go('setting_game')
@@ -88,10 +88,10 @@ function scene.keyDown(key)
end
function scene.update(dt)
if not NET.getlock('fetchRoom')and hidePW()then
if not NET.getlock('fetchRoom')and _hidePW()then
fetchTimer=fetchTimer-dt
if fetchTimer<=0 then
fetchRoom()
_fetchRoom()
end
end
end
@@ -145,7 +145,7 @@ scene.widgetList={
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s"},
WIDGET.newText{name="refreshing",x=450,y=240,font=45,hideF=function()return not NET.getlock('fetchRoom')end},
WIDGET.newText{name="noRoom", x=450,y=245,font=40,hideF=function()return roomList:getLen()>0 or NET.getlock('fetchRoom')end},
WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=fetchRoom,hideF=function()return fetchTimer>7 end},
WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function()return fetchTimer>7 end},
WIDGET.newKey{name="new", x=510,y=630,w=260,h=120,code=pressKey"n"},
WIDGET.newKey{name="join", x=780,y=630,w=140,h=120,code=pressKey"return",hideF=function()return roomList:getLen()==0 or NET.getlock('enterRoom')end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"},

View File

@@ -1,6 +1,6 @@
local scene={}
local function register()
local function _register()
local username= WIDGET.active.username:getText()
local email= WIDGET.active.email:getText()
local password= WIDGET.active.password:getText()
@@ -25,7 +25,7 @@ scene.widgetList={
WIDGET.newInputBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newInputBox{name="password2",x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=register,hideF=function()return NET.getlock('register')end},
WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=_register,hideF=function()return NET.getlock('register')end},
WIDGET.newText{name="registering", x=640, y=605,font=50,hideF=function()return not NET.getlock('register')end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene},

View File

@@ -41,7 +41,7 @@ local scene={}
local sure
local function playRep(fileName)
local function _playRep(fileName)
local rep=DATA.parseReplay(fileName,true)
if not rep.available then
MES.new('error',text.replayBroken)
@@ -82,7 +82,7 @@ function scene.keyDown(key)
if key=="return"then
local rep=listBox:getSel()
if rep then
playRep(rep.fileName)
_playRep(rep.fileName)
end
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
local rep=listBox:getSel()

View File

@@ -1,10 +1,10 @@
local scene={}
local function dumpCB(T)
local function _dumpCB(T)
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
MES.new('check',text.exportSuccess)
end
local function parseCB()
local function _parseCB()
local _
local s=love.system.getClipboardText()
@@ -20,15 +20,15 @@ local function parseCB()
end
scene.widgetList={
WIDGET.newText{name="export", x=55,y=45,color='lY',align='L',font=50},
WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()dumpCB(RANKS)end},
WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()dumpCB(STAT)end},
WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()dumpCB(SETTING)end},
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()dumpCB(VK_org)end},
WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end},
WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end},
WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end},
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_org)end},
WIDGET.newText{name="import", x=55,y=265,color='lR',align='L',font=50},
WIDGET.newButton{name="unlock", x=190,y=390,w=280,h=100,color='lR',
code=function()
local D=parseCB()
local D=_parseCB()
if D then
TABLE.cover(D,RANKS)
for k,v in next,oldModeNameTable do
@@ -45,7 +45,7 @@ scene.widgetList={
end},
WIDGET.newButton{name="data", x=490,y=390,w=280,h=100,color='lR',
code=function()
local D=parseCB()
local D=_parseCB()
if D and D.version==STAT.version then
TABLE.update(D,STAT)
saveStats()
@@ -56,7 +56,7 @@ scene.widgetList={
end},
WIDGET.newButton{name="setting", x=790,y=390,w=280,h=100,color='lR',
code=function()
local D=parseCB()
local D=_parseCB()
if D then
TABLE.update(D,SETTING)
applySettings()
@@ -68,7 +68,7 @@ scene.widgetList={
end},
WIDGET.newButton{name="vk", x=1090,y=390,w=280,h=100,color='lR',
code=function()
local D=parseCB()
local D=_parseCB()
if D then
TABLE.update(D,VK_org)
FILE.save(VK_org,'conf/virtualkey')

View File

@@ -76,7 +76,7 @@ function scene.draw()
gc.translate(-550,-600)
end
local function sliderShow(S)
local function _sliderShow(S)
S=S.disp()
return S.."F "..math.floor(S*16.67).."ms"
end
@@ -84,12 +84,12 @@ scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
WIDGET.newText{name="preview", x=520, y=610,font=40,align='R'},
WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=sliderShow,code=SETsto("das")},
WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=sliderShow,code=SETsto("arr")},
WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=sliderShow,code=SETsto("sddas")},
WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=sliderShow,code=SETsto("sdarr")},
WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=sliderShow,code=SETsto("dascut")},
WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=sliderShow,code=SETsto("dropcut")},
WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=_sliderShow,code=SETsto("das")},
WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=_sliderShow,code=SETsto("arr")},
WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=_sliderShow,code=SETsto("sddas")},
WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=_sliderShow,code=SETsto("sdarr")},
WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=_sliderShow,code=SETsto("dascut")},
WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=_sliderShow,code=SETsto("dropcut")},
WIDGET.newSwitch{name="ihs", x=1100, y=260, disp=SETval("ihs"), code=SETrev("ihs")},
WIDGET.newSwitch{name="irs", x=1100, y=330, disp=SETval("irs"), code=SETrev("irs")},
WIDGET.newSwitch{name="ims", x=1100, y=400, disp=SETval("ims"), code=SETrev("ims")},

View File

@@ -7,7 +7,7 @@ local scene={}
local selected--if waiting for key
local keyList
local function freshKeyList()
local function _freshKeyList()
keyList={}for i=0,20 do keyList[i]={}end
for k,v in next,keyMap.keyboard do
ins(keyList[v],{COLOR.lB,k})
@@ -19,7 +19,7 @@ end
function scene.sceneInit()
selected=false
freshKeyList()
_freshKeyList()
BG.set('none')
end
function scene.sceneBack()
@@ -39,7 +39,7 @@ function scene.keyDown(key,isRep)
keyMap.keyboard[k]=nil
end
end
freshKeyList()
_freshKeyList()
selected=false
SFX.play('finesseError',.5)
else
@@ -48,7 +48,7 @@ function scene.keyDown(key,isRep)
elseif selected then
if not forbbidenKeys[key]then
keyMap.keyboard[key]=selected
freshKeyList()
_freshKeyList()
selected=false
SFX.play('reach',.5)
end
@@ -64,7 +64,7 @@ function scene.gamepadDown(key)
keyMap.joystick[k]=nil
end
end
freshKeyList()
_freshKeyList()
selected=false
SFX.play('finesseError',.5)
else
@@ -72,7 +72,7 @@ function scene.gamepadDown(key)
end
elseif selected then
keyMap.joystick[key]=selected
freshKeyList()
_freshKeyList()
selected=false
SFX.play('reach',.5)
else
@@ -106,7 +106,7 @@ function scene.draw()
end
end
local function setSel(i)
local function _setSel(i)
if selected==i then
selected=false
SFX.play('rotate',.5)
@@ -116,29 +116,29 @@ local function setSel(i)
end
end
scene.widgetList={
WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()setSel(1)end},
WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()setSel(2)end},
WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()setSel(3)end},
WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()setSel(4)end},
WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()setSel(5)end},
WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()setSel(6)end},
WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()setSel(7)end},
WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()setSel(8)end},
WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()setSel(9)end},
WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()setSel(10)end},
WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()_setSel(1)end},
WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()_setSel(2)end},
WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()_setSel(3)end},
WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()_setSel(4)end},
WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()_setSel(5)end},
WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()_setSel(6)end},
WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()_setSel(7)end},
WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()_setSel(8)end},
WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()_setSel(9)end},
WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()_setSel(10)end},
WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()setSel(11)end},
WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()setSel(12)end},
WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()setSel(13)end},
WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()setSel(14)end},
WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()setSel(15)end},
WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()setSel(16)end},
WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()setSel(17)end},
WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()setSel(18)end},
WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()setSel(19)end},
WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()setSel(20)end},
WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()_setSel(11)end},
WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()_setSel(12)end},
WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()_setSel(13)end},
WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()_setSel(14)end},
WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()_setSel(15)end},
WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()_setSel(16)end},
WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()_setSel(17)end},
WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()_setSel(18)end},
WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()_setSel(19)end},
WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()_setSel(20)end},
WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()setSel(0)end},
WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()_setSel(0)end},
WIDGET.newButton{name="back",x=1140,y=640,w=190,h=80,fText=TEXTURE.back,code=backScene},
}

View File

@@ -50,13 +50,13 @@ function scene.draw()
gc.draw(texture[17],930,610+sin(2.6*t-6)*5,nil,2)
end
local function prevSkin(i)
local function _prevSkin(i)
SETTING.skin[i]=(SETTING.skin[i]-2)%16+1
end
local function nextSkin(i)
local function _nextSkin(i)
SETTING.skin[i]=SETTING.skin[i]%16+1
end
local function nextDir(i)
local function _nextDir(i)
SETTING.face[i]=(SETTING.face[i]+1)%4
minoRot0[i]=minoRot0[i]+1.5707963
if minoRot0[5]>62 and not GAME.playing then
@@ -69,29 +69,29 @@ scene.widgetList={
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
WIDGET.newSelector{name="skinSet",x=780,y=100,w=320,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="",code=function()prevSkin(1)end},
WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="",code=function()prevSkin(2)end},
WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="",code=function()prevSkin(3)end},
WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="",code=function()prevSkin(4)end},
WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="",code=function()prevSkin(5)end},
WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="",code=function()prevSkin(6)end},
WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="",code=function()prevSkin(7)end},
WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="",code=function()_prevSkin(1)end},
WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="",code=function()_prevSkin(2)end},
WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="",code=function()_prevSkin(3)end},
WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="",code=function()_prevSkin(4)end},
WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="",code=function()_prevSkin(5)end},
WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="",code=function()_prevSkin(6)end},
WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="",code=function()_prevSkin(7)end},
WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="",code=function()nextSkin(1)end},
WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="",code=function()nextSkin(2)end},
WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="",code=function()nextSkin(3)end},
WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="",code=function()nextSkin(4)end},
WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="",code=function()nextSkin(5)end},
WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="",code=function()nextSkin(6)end},
WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="",code=function()nextSkin(7)end},
WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="",code=function()_nextSkin(1)end},
WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="",code=function()_nextSkin(2)end},
WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="",code=function()_nextSkin(3)end},
WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="",code=function()_nextSkin(4)end},
WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="",code=function()_nextSkin(5)end},
WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="",code=function()_nextSkin(6)end},
WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="",code=function()_nextSkin(7)end},
WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()nextDir(1)end},
WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()nextDir(2)end},
WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()nextDir(3)end},
WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()nextDir(4)end},
WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()nextDir(5)end},
WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()nextDir(6)end},
WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()nextDir(7)end},
WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()_nextDir(1)end},
WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()_nextDir(2)end},
WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()_nextDir(3)end},
WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()_nextDir(4)end},
WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()_nextDir(5)end},
WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()_nextDir(6)end},
WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()_nextDir(7)end},
WIDGET.newButton{name="skinR", x=200,y=640,w=220,h=80,color='lV',font=35,
code=function()

View File

@@ -8,10 +8,10 @@ local defaultSetSelect
local snapUnit=1
local selected--Button selected
local function save1()
local function _save1()
FILE.save(VK_org,'conf/vkSave1')
end
local function load1()
local function _load1()
local D=FILE.load('conf/vkSave1')
if D then
TABLE.update(D,VK_org)
@@ -19,10 +19,10 @@ local function load1()
MES.new('error',text.noFile)
end
end
local function save2()
local function _save2()
FILE.save(VK_org,'conf/vkSave2')
end
local function load2()
local function _load2()
local D=FILE.load('conf/vkSave2')
if D then
TABLE.update(D,VK_org)
@@ -40,7 +40,7 @@ function scene.sceneBack()
FILE.save(VK_org,'conf/virtualkey')
end
local function onVK_org(x,y)
local function _onVK_org(x,y)
local dist,nearest=1e10
for K=1,#VK_org do
local B=VK_org[K]
@@ -67,7 +67,7 @@ function scene.mouseMove(_,_,dx,dy)
end
end
function scene.touchDown(x,y)
selected=onVK_org(x,y)or selected
selected=_onVK_org(x,y)or selected
end
function scene.touchUp()
if selected then
@@ -114,10 +114,10 @@ scene.widgetList={
WIDGET.newSelector{name="snap", x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end},
WIDGET.newButton{name="option", x=530,y=190,w=200,h=80,fText=TEXTURE.more,code=function()SCN.go('setting_touchSwitch')end},
WIDGET.newButton{name="back", x=750,y=190,w=200,h=80,fText=TEXTURE.back,code=backScene},
WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=save1},
WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=load1},
WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=save2},
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=load2},
WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=_save1},
WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=_load1},
WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=_save2},
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=_load2},
WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize",
disp=function()
return VK_org[selected].r/10-1

View File

@@ -14,46 +14,46 @@ function scene.draw()
end
end
local function VKAdisp(n)return function()return VK_org[n].ava end end
local function VKAcode(n)return function()VK_org[n].ava=not VK_org[n].ava end end
local function notShow()return not SETTING.VKSwitch end
local function notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end
local function _VKAdisp(n)return function()return VK_org[n].ava end end
local function _VKAcode(n)return function()VK_org[n].ava=not VK_org[n].ava end end
local function _notShow()return not SETTING.VKSwitch end
local function _notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end
scene.widgetScrollHeight=340
scene.widgetList={
WIDGET.newSwitch{name="b1", x=280, y=80, disp=VKAdisp(1),code=VKAcode(1)},
WIDGET.newSwitch{name="b2", x=280, y=140, disp=VKAdisp(2),code=VKAcode(2)},
WIDGET.newSwitch{name="b3", x=280, y=200, disp=VKAdisp(3),code=VKAcode(3)},
WIDGET.newSwitch{name="b4", x=280, y=260, disp=VKAdisp(4),code=VKAcode(4)},
WIDGET.newSwitch{name="b5", x=280, y=320, disp=VKAdisp(5),code=VKAcode(5)},
WIDGET.newSwitch{name="b6", x=280, y=380, disp=VKAdisp(6),code=VKAcode(6)},
WIDGET.newSwitch{name="b7", x=280, y=440, disp=VKAdisp(7),code=VKAcode(7)},
WIDGET.newSwitch{name="b8", x=280, y=500, disp=VKAdisp(8),code=VKAcode(8)},
WIDGET.newSwitch{name="b9", x=280, y=560, disp=VKAdisp(9),code=VKAcode(9)},
WIDGET.newSwitch{name="b10", x=280, y=620, disp=VKAdisp(10),code=VKAcode(10)},
WIDGET.newSwitch{name="b11", x=580, y=80, disp=VKAdisp(11),code=VKAcode(11)},
WIDGET.newSwitch{name="b12", x=580, y=140, disp=VKAdisp(12),code=VKAcode(12)},
WIDGET.newSwitch{name="b13", x=580, y=200, disp=VKAdisp(13),code=VKAcode(13)},
WIDGET.newSwitch{name="b14", x=580, y=260, disp=VKAdisp(14),code=VKAcode(14)},
WIDGET.newSwitch{name="b15", x=580, y=320, disp=VKAdisp(15),code=VKAcode(15)},
WIDGET.newSwitch{name="b16", x=580, y=380, disp=VKAdisp(16),code=VKAcode(16)},
WIDGET.newSwitch{name="b17", x=580, y=440, disp=VKAdisp(17),code=VKAcode(17)},
WIDGET.newSwitch{name="b18", x=580, y=500, disp=VKAdisp(18),code=VKAcode(18)},
WIDGET.newSwitch{name="b19", x=580, y=560, disp=VKAdisp(19),code=VKAcode(19)},
WIDGET.newSwitch{name="b20", x=580, y=620, disp=VKAdisp(20),code=VKAcode(20)},
WIDGET.newSwitch{name="b1", x=280, y=80, disp=_VKAdisp(1),code=_VKAcode(1)},
WIDGET.newSwitch{name="b2", x=280, y=140, disp=_VKAdisp(2),code=_VKAcode(2)},
WIDGET.newSwitch{name="b3", x=280, y=200, disp=_VKAdisp(3),code=_VKAcode(3)},
WIDGET.newSwitch{name="b4", x=280, y=260, disp=_VKAdisp(4),code=_VKAcode(4)},
WIDGET.newSwitch{name="b5", x=280, y=320, disp=_VKAdisp(5),code=_VKAcode(5)},
WIDGET.newSwitch{name="b6", x=280, y=380, disp=_VKAdisp(6),code=_VKAcode(6)},
WIDGET.newSwitch{name="b7", x=280, y=440, disp=_VKAdisp(7),code=_VKAcode(7)},
WIDGET.newSwitch{name="b8", x=280, y=500, disp=_VKAdisp(8),code=_VKAcode(8)},
WIDGET.newSwitch{name="b9", x=280, y=560, disp=_VKAdisp(9),code=_VKAcode(9)},
WIDGET.newSwitch{name="b10", x=280, y=620, disp=_VKAdisp(10),code=_VKAcode(10)},
WIDGET.newSwitch{name="b11", x=580, y=80, disp=_VKAdisp(11),code=_VKAcode(11)},
WIDGET.newSwitch{name="b12", x=580, y=140, disp=_VKAdisp(12),code=_VKAcode(12)},
WIDGET.newSwitch{name="b13", x=580, y=200, disp=_VKAdisp(13),code=_VKAcode(13)},
WIDGET.newSwitch{name="b14", x=580, y=260, disp=_VKAdisp(14),code=_VKAcode(14)},
WIDGET.newSwitch{name="b15", x=580, y=320, disp=_VKAdisp(15),code=_VKAcode(15)},
WIDGET.newSwitch{name="b16", x=580, y=380, disp=_VKAdisp(16),code=_VKAcode(16)},
WIDGET.newSwitch{name="b17", x=580, y=440, disp=_VKAdisp(17),code=_VKAcode(17)},
WIDGET.newSwitch{name="b18", x=580, y=500, disp=_VKAdisp(18),code=_VKAcode(18)},
WIDGET.newSwitch{name="b19", x=580, y=560, disp=_VKAdisp(19),code=_VKAcode(19)},
WIDGET.newSwitch{name="b20", x=580, y=620, disp=_VKAdisp(20),code=_VKAcode(20)},
WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end},
WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end},
WIDGET.newSwitch{name="hide", x=1150, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")},
WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=notShow},
WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=notShow},
WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6,font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=notShow},
WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=notShow},
WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=_notShow},
WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=_notShow},
WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6,font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=_notShow},
WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=_notShow},
WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=notShow},
WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=notTrack},
WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=notTrack},
WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=notTrack},
WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=_notShow},
WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=_notTrack},
WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=_notTrack},
WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=_notTrack},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene},
}

View File

@@ -5,7 +5,7 @@ local scene={}
local backCounter
local list,timer
local function push(mes)
local function _push(mes)
ins(list,{mes,120})
timer=1
end
@@ -17,14 +17,14 @@ function scene.sceneInit()
end
function scene.gamepadDown(key)
push("[gamepadDown] <"..key..">")
_push("[gamepadDown] <"..key..">")
end
function scene.gamepadUp(key)
push{COLOR.H,"[gamepadUp] <"..key..">"}
_push{COLOR.H,"[gamepadUp] <"..key..">"}
end
function scene.keyDown(key,isRep)
if isRep then return end
push("[keyDown] <"..key..">")
_push("[keyDown] <"..key..">")
if key=="escape"then
backCounter=backCounter-1
if backCounter==0 then
@@ -35,46 +35,46 @@ function scene.keyDown(key,isRep)
end
end
function scene.keyUp(key)
push{COLOR.H,"[keyUp] <"..key..">"}
_push{COLOR.H,"[keyUp] <"..key..">"}
end
function scene.mouseClick(x,y)
SYSFX.newRipple(.5,x,y,50)
push("[mouseClick]")
_push("[mouseClick]")
end
function scene.mouseDown(x,y,k)
SYSFX.newShade(.5,x-10,y-10,20,20)
push(("[mouseDown] <%d: %d, %d>"):format(k,x,y))
_push(("[mouseDown] <%d: %d, %d>"):format(k,x,y))
end
function scene.mouseMove(x,y)
SYSFX.newShade(.5,x-3,y-3,6,6)
end
function scene.mouseUp(x,y,k)
SYSFX.newRectRipple(1,x-10,y-10,20,20)
push{COLOR.H,"[mouseUp] <"..k..">"}
_push{COLOR.H,"[mouseUp] <"..k..">"}
end
function scene.touchClick(x,y)
SYSFX.newRipple(.5,x,y,50)
push("[touchClick]")
_push("[touchClick]")
end
function scene.touchDown(x,y)
SYSFX.newShade(.5,x-10,y-10,20,20)
push(("[touchDown] <%d, %d>"):format(x,y))
_push(("[touchDown] <%d, %d>"):format(x,y))
end
function scene.touchMove(x,y)
SYSFX.newShade(.5,x-3,y-3,6,6)
end
function scene.touchUp(x,y)
SYSFX.newRectRipple(1,x-10,y-10,20,20)
push{COLOR.H,"[touchUp]"}
_push{COLOR.H,"[touchUp]"}
end
function scene.wheelMoved(dx,dy)
push(("[wheelMoved] <%d, %d>"):format(dx,dy))
_push(("[wheelMoved] <%d, %d>"):format(dx,dy))
end
function scene.fileDropped(file)
push(("[fileDropped] <%s>"):format(file:getFilename()))
_push(("[fileDropped] <%s>"):format(file:getFilename()))
end
function scene.directoryDropped(path)
push(("[directoryDropped] <%s>"):format(path))
_push(("[directoryDropped] <%s>"):format(path))
end
function scene.update(dt)