场景&事件系统重写

This commit is contained in:
MrZ626
2020-12-04 19:35:33 +08:00
parent 0b2abf71ea
commit 8a754431cf
48 changed files with 546 additions and 352 deletions

View File

@@ -75,20 +75,6 @@ local function updatePowerInfo()
gc.pop()gc.setCanvas()
end
-------------------------------------------------------------
Tmr,Pnt={},{}
mouseClick,touchClick={},{}
mouseDown,mouseMove,mouseUp,wheelMoved={},{},{},{}
touchDown,touchUp,touchMove={},{},{}
keyDown,keyUp={},{}
gamepadDown,gamepadUp={},{}
local Tmr,Pnt=Tmr,Pnt
local mouseClick,touchClick=mouseClick,touchClick
local mouseDown,mouseMove,mouseUp,wheelMoved=mouseDown,mouseMove,mouseUp,wheelMoved
local touchDown,touchUp,touchMove=touchDown,touchUp,touchMove
local keyDown,keyUp=keyDown,keyUp
local gamepadDown,gamepadUp=gamepadDown,gamepadUp
-------------------------------------------------------------
local lastX,lastY=0,0--Last clickDown pos
function love.mousepressed(x,y,k,touch)
if touch then return end
@@ -98,17 +84,18 @@ function love.mousepressed(x,y,k,touch)
local dx,dy=mx-lastX,my-lastY
DBP(("(%d,%d), D=(%d,%d)~~(%d,%d)(%d,%d)"):format(mx,my,dx,dy,int(mx/10)*10,int(my/10)*10,int(dx/10)*10,int(dy/10)*10))
end
if SCN.swapping then return end
if mouseDown[SCN.cur]then
mouseDown[SCN.cur](mx,my,k)
elseif k==2 then
SCN.back()
if not SCN.swapping then
if SCN.mouseDown then
SCN.mouseDown(mx,my,k)
elseif k==2 then
SCN.back()
end
if k==1 then
WIDGET.press(mx,my)
end
lastX,lastY=mx,my
SYSFX.newRipple(3,mx,my,30)
end
if k==1 then
WIDGET.press(mx,my)
end
lastX,lastY=mx,my
SYSFX.newRipple(3,mx,my,30)
end
function love.mousemoved(x,y,dx,dy,t)
if t then return end
@@ -116,9 +103,7 @@ function love.mousemoved(x,y,dx,dy,t)
mx,my=xOy:inverseTransformPoint(x,y)
if SCN.swapping then return end
dx,dy=dx/SCR.k,dy/SCR.k
if mouseMove[SCN.cur]then
mouseMove[SCN.cur](mx,my,dx,dy)
end
if SCN.mouseMove then SCN.mouseMove(mx,my,dx,dy)end
if ms.isDown(1) then
WIDGET.drag(mx,my)
else
@@ -130,16 +115,12 @@ function love.mousereleased(x,y,k,touch)
mx,my=xOy:inverseTransformPoint(x,y)
WIDGET.release(mx,my)
WIDGET.moveCursor(mx,my)
if mouseUp[SCN.cur]then
mouseUp[SCN.cur](mx,my,k)
end
if lastX and(mx-lastX)^2+(my-lastY)^2<26 and mouseClick[SCN.cur]then
mouseClick[SCN.cur](mx,my,k)
end
if SCN.mouseUp then SCN.mouseUp(mx,my,k)end
if lastX and SCN.mouseClick and(mx-lastX)^2+(my-lastY)^2<26 then SCN.mouseClick(mx,my,k)end
end
function love.wheelmoved(x,y)
if SCN.swapping then return end
if wheelMoved[SCN.cur]then wheelMoved[SCN.cur](x,y)end
if SCN.wheelMoved then SCN.wheelMoved(x,y)end
end
function love.touchpressed(id,x,y)
@@ -151,17 +132,13 @@ function love.touchpressed(id,x,y)
end
x,y=xOy:inverseTransformPoint(x,y)
lastX,lastY=x,y
if touchDown[SCN.cur]then
touchDown[SCN.cur](id,x,y)
end
if SCN.touchDown then SCN.touchDown(id,x,y)end
if kb.hasTextInput()then kb.setTextInput(false)end
end
function love.touchmoved(id,x,y,dx,dy)
if SCN.swapping then return end
x,y=xOy:inverseTransformPoint(x,y)
if touchMove[SCN.cur]then
touchMove[SCN.cur](id,x,y,dx/SCR.k,dy/SCR.k)
end
if SCN.touchMove then SCN.touchMove(id,x,y,dx/SCR.k,dy/SCR.k)end
if WIDGET.sel then
if touching then
WIDGET.drag(x,y)
@@ -184,13 +161,9 @@ function love.touchreleased(id,x,y)
WIDGET.sel=nil
end
end
if touchUp[SCN.cur]then
touchUp[SCN.cur](id,x,y)
end
if SCN.touchUp then SCN.touchUp(id,x,y)end
if(x-lastX)^2+(y-lastY)^2<26 then
if touchClick[SCN.cur]then
touchClick[SCN.cur](x,y)
end
if SCN.touchClick then SCN.touchClick(x,y)end
SYSFX.newRipple(3,x,y,30)
end
end
@@ -252,7 +225,7 @@ function love.keypressed(i)
if i~="f8"then
if SCN.swapping then return end
if keyDown[SCN.cur]then keyDown[SCN.cur](i)
if SCN.keyDown then SCN.keyDown(i)
elseif i=="escape"then SCN.back()
else WIDGET.keyPressed(i)
end
@@ -263,7 +236,7 @@ function love.keypressed(i)
end
function love.keyreleased(i)
if SCN.swapping then return end
if keyUp[SCN.cur]then keyUp[SCN.cur](i)end
if SCN.keyUp then SCN.keyUp(i)end
end
function love.textedited(text)
EDITING=text
@@ -303,30 +276,29 @@ local keyMirror={
function love.gamepadpressed(_,i)
mouseShow=false
if SCN.swapping then return end
if gamepadDown[SCN.cur]then gamepadDown[SCN.cur](i)
elseif keyDown[SCN.cur]then keyDown[SCN.cur](keyMirror[i]or i)
if SCN.gamepadDown then SCN.gamepadDown(i)
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
elseif i=="back"then SCN.back()
else WIDGET.gamepadPressed(keyMirror[i]or i)
end
end
function love.gamepadreleased(_,i)
if SCN.swapping then return end
if gamepadUp[SCN.cur]then gamepadUp[SCN.cur](i)
end
if SCN.gamepadUp then SCN.gamepadUp(i)end
end
--[[
function love.joystickpressed(JS,k)
mouseShow=false
if SCN.swapping then return end
if gamepadDown[SCN.cur]then gamepadDown[SCN.cur](i)
elseif keyDown[SCN.cur]then keyDown[SCN.cur](keyMirror[i]or i)
if SCN.gamepadDown then SCN.gamepadDown(i)
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
elseif i=="back"then SCN.back()
else WIDGET.gamepadPressed(i)
end
end
function love.joystickreleased(JS,k)
if SCN.swapping then return end
if gamepadUp[SCN.cur]then gamepadUp[SCN.cur](i)
if SCN.gamepadUp then SCN.gamepadUp(i)
end
end
function love.joystickaxis(JS,axis,val)
@@ -389,7 +361,7 @@ function love.errorhandler(msg)
gc.reset()
local errScrShot
gc.captureScreenshot(function (_)errScrShot=gc.newImage(_)end)
gc.captureScreenshot(function(_)errScrShot=gc.newImage(_)end)
gc.present()
SFX.fplay("error",SETTING.voc*.8)
@@ -457,6 +429,7 @@ local devColor={
local FPS=love.timer.getFPS
love.draw,love.update=nil--remove default draw/update
function love.run()
local SCN=SCN
local SETTING=SETTING
local DISCARD=gc.discard
local PRESENT=gc.present
@@ -506,7 +479,7 @@ function love.run()
BG.update(dt)
SYSFX.update(dt)
TEXT.update()
_=Tmr[SCN.cur]if _ then _(dt)end--Scene Updater
if SCN.Tmr then SCN.Tmr(dt)end--Scene Updater
if SCN.swapping then SCN.swapUpdate()end--Scene swapping animation
WIDGET.update()--Widgets animation
LOG.update()
@@ -524,7 +497,7 @@ function love.run()
gc.replaceTransform(xOy)
--Draw scene contents
if Pnt[SCN.cur]then Pnt[SCN.cur]()end
if SCN.Pnt then SCN.Pnt()end
--Draw widgets
WIDGET.draw()

View File

@@ -2,12 +2,11 @@ local gc=love.graphics
local abs=math.abs
local SCR=SCR
sceneInit,sceneBack={},{}
local sceneInit,sceneBack=sceneInit,sceneBack
sceneInit.quit=love.event.quit
local scenes={}
local SCN={
cur="load",--Current scene
cur="NULL",--Current scene name
scenes=scenes,
swapping=false,--If Swapping
stat={
tar=nil, --Swapping target
@@ -17,8 +16,29 @@ local SCN={
draw=nil, --Swap draw func
},
seq={"quit","slowFade"},--Back sequence
--Events
Tmr=nil,
Pnt=nil,
mouseClick=nil,
touchClick=nil,
mouseDown=nil,
mouseMove=nil,
mouseUp=nil,
wheelMoved=nil,
touchDown=nil,
touchUp=nil,
touchMove=nil,
keyDown=nil,
keyUp=nil,
gamepadDown=nil,
gamepadUp=nil,
}--Scene datas, returned
function SCN.add(name,scene)
scenes[name]=scene
end
function SCN.swapUpdate()
local S=SCN.stat
S.time=S.time-1
@@ -32,9 +52,27 @@ function SCN.swapUpdate()
end
end
function SCN.init(s,org)
if sceneInit[s]then sceneInit[s](org)end
SCN.cur=s
WIDGET.set(s)
local S=scenes[s]
SCN.sceneInit=S.sceneInit
SCN.sceneBack=S.sceneBack
SCN.Tmr=S.Tmr
SCN.Pnt=S.Pnt
SCN.mouseClick=S.mouseClick
SCN.touchClick=S.touchClick
SCN.mouseDown=S.mouseDown
SCN.mouseMove=S.mouseMove
SCN.mouseUp=S.mouseUp
SCN.wheelMoved=S.wheelMoved
SCN.touchDown=S.touchDown
SCN.touchUp=S.touchUp
SCN.touchMove=S.touchMove
SCN.keyDown=S.keyDown
SCN.keyUp=S.keyUp
SCN.gamepadDown=S.gamepadDown
SCN.gamepadUp=S.gamepadUp
if SCN.sceneInit then SCN.sceneInit(org)end
end
function SCN.push(tar,style)
if not SCN.swapping then
@@ -100,7 +138,7 @@ function SCN.go(tar,style)--Normal scene swapping, can back
end
function SCN.back()
--Leave scene
if sceneBack[SCN.cur] then sceneBack[SCN.cur]()end
if SCN.sceneBack then SCN.sceneBack()end
--Poll&Back to previous Scene
local m=#SCN.seq

View File

@@ -133,7 +133,10 @@ end
--Load scene files from SOURCE ONLY
for _,v in next,fs.getDirectoryItems("parts/scenes")do
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
require("parts/scenes/"..v:sub(1,-5))
local sceneName=v:sub(1,-5)
local scene=require("parts/scenes/"..sceneName)
SCN.add(sceneName,scene)
if scene.widgetList then WIDGET.init(sceneName,scene.widgetList)end
else
LOG.print("Dangerous file : %SAVE%/parts/scenes/"..v)
end

View File

@@ -858,6 +858,7 @@ return{
"Z块等身抱枕来一个(x",
{COLOR.B,"COLOR.blue"},
{COLOR.C,"Xspin",COLOR.W,"是个啥玩意"},
{COLOR.cyan,"♦PU",COLOR.grape,"RE♦"},
{COLOR.cyan,"COLOR.cyan"},
{COLOR.cyan,"VVVVVV好玩!"},
{COLOR.fire,"COLOR.fire"},

View File

@@ -1,10 +1,14 @@
-- local gc=love.graphics
function sceneInit.account()
local scene={}
function scene.sceneInit()
sceneTemp={}
end
WIDGET.init("account",{
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align="L"},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -3,7 +3,9 @@ local kb=love.keyboard
local find,sub,byte=string.find,string.sub,string.byte
function sceneInit.calculator()
local scene={}
function scene.sceneInit()
BG.set("none")
sceneTemp={
reg=false,
@@ -13,8 +15,8 @@ function sceneInit.calculator()
}
end
mouseDown.calculator=NULL
function keyDown.calculator(k)
scene.mouseDown=NULL
function scene.keyDown(k)
local S=sceneTemp
if byte(k)>=48 and byte(k)<=57 then
if S.sym=="="then
@@ -30,7 +32,7 @@ function keyDown.calculator(k)
end
end
elseif k:sub(1,2)=="kp"then
keyDown.calculator(k:sub(3))
S.keyDown(k:sub(3))
elseif k=="."then
if not(find(S.val,".",nil,true)or find(S.val,"e"))then
if S.sym and not S.reg then
@@ -112,7 +114,7 @@ function keyDown.calculator(k)
end
end
function Pnt.calculator()
function scene.Pnt()
local S=sceneTemp
gc.setColor(1,1,1)
gc.setLineWidth(4)
@@ -123,7 +125,7 @@ function Pnt.calculator()
if S.sym then setFont(50)gc.print(S.sym,126,150)end
end
WIDGET.init("calculator",{
scene.widgetList={
WIDGET.newKey{name="_1",x=150,y=300,w=90, font=50,code=WIDGET.lnk_pressKey("1")},
WIDGET.newKey{name="_2",x=250,y=300,w=90, font=50,code=WIDGET.lnk_pressKey("2")},
WIDGET.newKey{name="_3",x=350,y=300,w=90, font=50,code=WIDGET.lnk_pressKey("3")},
@@ -143,4 +145,6 @@ WIDGET.init("calculator",{
WIDGET.newKey{name="<", x=550,y=300,w=90,color="lRed", font=50,code=WIDGET.lnk_pressKey("backspace")},
WIDGET.newKey{name="=", x=550,y=400,w=90,color="lYellow",font=50,code=WIDGET.lnk_pressKey("return")},
WIDGET.newButton{name="play",x=640,y=600,w=180,h=90,color="lGreen", font=40,code=WIDGET.lnk_pressKey("space"),hide=function()return not sceneTemp.pass end},
})
}
return scene

View File

@@ -15,7 +15,9 @@ local function sendMessage()
end
end
function sceneInit.chat()
local scene={}
function scene.sceneInit()
BG.set("none")
wsConnect(
TICK.wsCONN_connect,
@@ -23,7 +25,7 @@ function sceneInit.chat()
)
end
function keyDown.chat(k)
function scene.keyDown(k)
if k=="return"then
sendMessage()
elseif k=="escape"then
@@ -33,8 +35,10 @@ function keyDown.chat(k)
end
end
WIDGET.init("chat",{
scene.widgetList={
WIDGET.newTextBox{name="text", x=40, y=500,w=980,h=180,font=40},
WIDGET.newButton{name="send", x=1140, y=540,w=170,h=80,font=40,code=sendMessage},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -12,22 +12,25 @@ local function notAir(L)
end
local CUSTOMENV=CUSTOMENV
function sceneInit.customGame()
local scene={}
function scene.sceneInit()
destroyPlayers()
BG.set(CUSTOMENV.bg)
BGM.play(CUSTOMENV.bgm)
sceneInit={initField=false}
sceneTemp={initField=false}
for y=1,20 do
if notAir(FIELD[1][y])then
sceneTemp.initField=true
end
end
end
function sceneBack.customGame()
function scene.sceneBack()
BGM.play("blank")
end
function keyDown.customGame(key)
function scene.keyDown(key)
if key=="return"or key=="return2"then
if CUSTOMENV.opponent>0 then
if CUSTOMENV.opponent>5 and CUSTOMENV.sequence=="fixed"then
@@ -102,7 +105,7 @@ function keyDown.customGame(key)
end
end
function Pnt.customGame()
function scene.Pnt()
--Field content
if sceneTemp.initField then
gc.push("transform")
@@ -151,7 +154,7 @@ function Pnt.customGame()
end
end
WIDGET.init("customGame",{
scene.widgetList={
WIDGET.newText{name="title", x=520, y=5,font=70,align="R"},
WIDGET.newText{name="subTitle", x=530, y=50,font=35,align="L",color="grey"},
WIDGET.newText{name="defSeq", x=330, y=550,align="L",color="grey",hide=function()return BAG[1]end},
@@ -186,4 +189,6 @@ WIDGET.init("customGame",{
WIDGET.newKey{name="mission", x=730, y=640,w=240,h=80,color="sky", font=25,code=WIDGET.lnk_goScene("custom_mission")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,4 +1,6 @@
WIDGET.init("custom_advance",{
local scene={}
scene.widgetList={
WIDGET.newText{name="title", x=520,y=5,font=70,align="R"},
WIDGET.newText{name="subTitle", x=530,y=50,font=35,align="L",color="grey"},
@@ -37,4 +39,6 @@ WIDGET.init("custom_advance",{
WIDGET.newSelector{name="pushSpeed",x=1120, y=260, w=260,color="red", list={1,2,3,5,15}, disp=WIDGET.lnk_CUSval("pushSpeed"),code=WIDGET.lnk_CUSsto("pushSpeed")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -6,7 +6,9 @@ local ins,rem=table.insert,table.remove
local sub=string.sub
local FIELD=FIELD
function sceneInit.custom_field()
local scene={}
function scene.sceneInit()
sceneTemp={
sure=0,
pen=1,
@@ -22,10 +24,11 @@ local penKey={
a=17,s=18,d=19,f=20,g=21,h=22,j=23,k=24,
z=0,x=-1,
}
function mouseDown.custom_field(x,y)
mouseMove.custom_field(x,y)
function scene.mouseDown(x,y)
scene.mouseMove(x,y)
end
function mouseMove.custom_field(x,y)
function scene.mouseMove(x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=nil end
@@ -35,7 +38,7 @@ function mouseMove.custom_field(x,y)
FIELD[S.page][sy][sx]=ms.isDown(1)and S.pen or ms.isDown(2)and -1 or 0
end
end
function wheelMoved.custom_field(_,y)
function scene.wheelMoved(_,y)
local pen=sceneTemp.pen
if y<0 then
pen=pen+1
@@ -46,10 +49,10 @@ function wheelMoved.custom_field(_,y)
end
sceneTemp.pen=pen
end
function touchDown.custom_field(_,x,y)
mouseMove.custom_field(x,y)
function scene.touchDown(_,x,y)
scene.mouseMove(x,y)
end
function touchMove.custom_field(_,x,y)
function scene.touchMove(_,x,y)
local S=sceneTemp
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30)
if sx<1 or sx>10 then sx=nil end
@@ -59,7 +62,7 @@ function touchMove.custom_field(_,x,y)
FIELD[S.page][sy][sx]=S.pen
end
end
function keyDown.custom_field(key)
function scene.keyDown(key)
local S=sceneTemp
local sx,sy,pen=S.x,S.y,S.pen
if key=="up"or key=="down"or key=="left"or key=="right"then
@@ -149,11 +152,11 @@ function keyDown.custom_field(key)
S.x,S.y,S.pen=sx,sy,pen
end
function Tmr.custom_field()
function scene.Tmr()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
end
function Pnt.custom_field()
function scene.Pnt()
local S=sceneTemp
local sx,sy=S.x,S.y
@@ -229,7 +232,7 @@ function Pnt.custom_field()
end
local function setPen(i)return function()sceneTemp.pen=i end end
WIDGET.init("custom_field",{
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="grey"},
@@ -276,4 +279,6 @@ WIDGET.init("custom_field",{
WIDGET.newButton{name="nextPage", x=100, y=470,w=160,h=110,color="lGreen",font=20,code=WIDGET.lnk_pressKey("tab"),hide=function()return sceneTemp.page==#FIELD end},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -6,7 +6,9 @@ local int,sin=math.floor,math.sin
local ins,rem=table.insert,table.remove
local sub=string.sub
function sceneInit.custom_mission()
local scene={}
function scene.sceneInit()
sceneTemp={
input="",
cur=#MISSION,
@@ -16,7 +18,7 @@ end
local missionEnum=missionEnum
local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true}
function keyDown.custom_mission(key)
function scene.keyDown(key)
local S=sceneTemp
local MISSION=MISSION
if key=="left"then
@@ -55,7 +57,7 @@ function keyDown.custom_mission(key)
rem(MISSION,S.cur)
S.cur=S.cur-1
if S.cur>0 and MISSION[S.cur]==MISSION[S.cur+1]then
keyDown.custom_mission("right")
S.keyDown("right")
end
end
elseif key=="delete"then
@@ -111,11 +113,11 @@ function keyDown.custom_mission(key)
end
end
function Tmr.custom_mission()
function scene.Tmr()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
end
function Pnt.custom_mission()
function scene.Pnt()
local S=sceneTemp
--Draw frame
@@ -185,7 +187,7 @@ function Pnt.custom_mission()
end
end
WIDGET.init("custom_mission",{
scene.widgetList={
WIDGET.newText{name="title", x=520,y=5,font=70,align="R"},
WIDGET.newText{name="subTitle", x=530,y=50,font=35,align="L",color="grey"},
@@ -236,4 +238,6 @@ WIDGET.init("custom_mission",{
WIDGET.newSwitch{name="mission",x=1150, y=350, disp=WIDGET.lnk_CUSval("missionKill"),code=WIDGET.lnk_CUSrev("missionKill")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -6,7 +6,9 @@ local sin=math.sin
local ins,rem=table.insert,table.remove
local sub=string.sub
function sceneInit.custom_sequence()
local scene={}
function scene.sceneInit()
sceneTemp={cur=#BAG,sure=0}
end
@@ -20,7 +22,7 @@ local minoKey2={
["1"]=8,["2"]=9,["3"]=19,["4"]=20,["5"]=14,["7"]=25,
z=8,s=9,t=14,j=19,l=20,i=25
}
function keyDown.custom_sequence(key)
function scene.keyDown(key)
local S=sceneTemp
local BAG=BAG
if key=="left"then
@@ -57,7 +59,7 @@ function keyDown.custom_sequence(key)
rem(BAG,S.cur)
S.cur=S.cur-1
if S.cur>0 and BAG[S.cur]==BAG[S.cur+1]then
keyDown.custom_mission("right")
S.keyDown("right")
end
end
elseif key=="delete"then
@@ -109,11 +111,11 @@ function keyDown.custom_sequence(key)
end
end
function Tmr.custom_sequence()
function scene.Tmr()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
end
function Pnt.custom_sequence()
function scene.Pnt()
local S=sceneTemp
--Draw frame
@@ -178,7 +180,7 @@ function Pnt.custom_sequence()
end
end
WIDGET.init("custom_sequence",{
scene.widgetList={
WIDGET.newText{name="title", x=520,y=5,font=70,align="R"},
WIDGET.newText{name="subTitle",x=530,y=50,font=35,align="L",color="grey"},
@@ -225,4 +227,6 @@ WIDGET.init("custom_sequence",{
WIDGET.newButton{name="paste", x=1140, y=540,w=170,h=80,color="lBlue", font=40,code=WIDGET.lnk_pressKey("cV")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -6,7 +6,9 @@ local min,sin=math.min,math.sin
local ins,rem=table.insert,table.remove
local find,sub=string.find,string.sub
function sceneInit.dict()
local scene={}
function scene.sceneInit()
local location=({"zh","zh","en","en","en","en","zh"})[SETTING.lang]
sceneTemp={
dict=require("parts/language/dict_"..location),
@@ -54,7 +56,7 @@ local function search()
S.lastSearch=S.input
end
function keyDown.dict(key)
function scene.keyDown(key)
local S=sceneTemp
if #key==1 then
if #S.input<15 then
@@ -101,7 +103,7 @@ function keyDown.dict(key)
S.url=(S.result[1]and S.result or S.dict)[S.select][5]
end
function Tmr.dict(dt)
function scene.Tmr(dt)
local S=sceneTemp
if S.waiting>0 then
S.waiting=S.waiting-dt
@@ -121,7 +123,7 @@ local typeColor={
english=COLOR.green,
name=COLOR.lPurple,
}
function Pnt.dict()
function scene.Pnt()
local S=sceneTemp
gc.setLineWidth(4)
@@ -174,11 +176,13 @@ function Pnt.dict()
end
end
WIDGET.init("dict",{
scene.widgetList={
WIDGET.newText{name="title", x=20, y=5,font=70,align="L"},
WIDGET.newKey{name="keyboard", x=960, y=60,w=200,h=80,font=35,code=function()love.keyboard.setTextInput(true,0,0,1,1)end,hide=not MOBILE},
WIDGET.newKey{name="link", x=1140, y=650,w=200,h=80,font=35,code=WIDGET.lnk_pressKey("link"),hide=function()return not sceneTemp.url end},
WIDGET.newKey{name="up", x=1190, y=440,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("up"),hide=not MOBILE},
WIDGET.newKey{name="down", x=1190, y=550,w=100,h=100,font=35,code=WIDGET.lnk_pressKey("down"),hide=not MOBILE},
WIDGET.newButton{name="back", x=1165, y=60,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -3,11 +3,13 @@ local Timer=love.timer.getTime
local sin=math.sin
function sceneInit.help()
local scene={}
function scene.sceneInit()
BG.set("space")
end
function Pnt.help()
function scene.Pnt()
setFont(20)
gc.setColor(1,1,1)
for i=1,#text.help do
@@ -27,7 +29,7 @@ function Pnt.help()
mStr(text.support,1138-sin(Timer()*4)*20,270)
end
WIDGET.init("help",{
scene.widgetList={
WIDGET.newImage{name="pay1", x=20, y=20},
WIDGET.newImage{name="pay2", x=1014, y=20},
WIDGET.newButton{name="dict", x=1140, y=410,w=220,h=70,font=35,code=WIDGET.lnk_goScene("dict")},
@@ -35,4 +37,6 @@ WIDGET.init("help",{
WIDGET.newButton{name="his", x=1140, y=570,w=220,h=70,font=35,code=WIDGET.lnk_goScene("history")},
WIDGET.newButton{name="qq", x=1140, y=650,w=220,h=70,font=35,code=function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,hide=MOBILE},
WIDGET.newButton{name="back", x=640, y=600,w=170,h=80,font=35,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -20,7 +20,9 @@ local function wheelScroll(y)
end
end
function sceneInit.history()
local scene={}
function scene.sceneInit()
BG.set("rainbow")
sceneTemp={
text=require"parts/updateLog",--Text list
@@ -32,10 +34,10 @@ function sceneInit.history()
end
end
function wheelMoved.history(_,y)
function scene.wheelMoved(_,y)
wheelScroll(y)
end
function keyDown.history(key)
function scene.keyDown(key)
if key=="up"then
sceneTemp.pos=max(sceneTemp.pos-1,1)
elseif key=="down"then
@@ -45,7 +47,7 @@ function keyDown.history(key)
end
end
function Pnt.history()
function scene.Pnt()
gc.setColor(.2,.2,.2,.7)
gc.rectangle("fill",30,45,1000,632)
gc.setColor(1,1,1)
@@ -56,8 +58,10 @@ function Pnt.history()
gc.print(S.text[S.pos],40,50)
end
WIDGET.init("history",{
scene.widgetList={
WIDGET.newKey{name="prev", x=1155, y=170,w=180,font=65,code=WIDGET.lnk_pressKey("up"),hide=WIDGET.lnk_STPeq("pos",1)},
WIDGET.newKey{name="next", x=1155, y=400,w=180,font=65,code=WIDGET.lnk_pressKey("down"),hide=function()return sceneTemp.pos==#sceneTemp.text end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -5,7 +5,9 @@ local abs=math.abs
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
local rnd=math.random
function sceneInit.intro()
local scene={}
function scene.sceneInit()
BG.set("space")
BGM.play("blank")
sceneTemp={
@@ -18,7 +20,7 @@ function sceneInit.intro()
end
end
function mouseDown.intro(_,_,k)
function scene.mouseDown(_,_,k)
if k~=2 then
if NOGAME=="delSetting"then
LOG.print("检测到过老版本无效设置数据,设置已经全部重置,请重启游戏完成",600,COLOR.yellow)
@@ -34,19 +36,19 @@ function mouseDown.intro(_,_,k)
end
end
end
function touchDown.intro()
mouseDown.intro()
function scene.touchDown()
scene.mouseDown()
end
function keyDown.intro(key)
function scene.keyDown(key)
if key=="escape"then
VOC.play("bye")
SCN.back()
else
mouseDown.intro()
scene.mouseDown()
end
end
function Tmr.intro()
function scene.Tmr()
local S=sceneTemp
S.t1=S.t1+1
S.t2=S.t2+1
@@ -71,7 +73,7 @@ local titleTransform={
gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)
end,
}
function Pnt.intro()
function scene.Pnt()
local S=sceneTemp
local T=(S.t1+110)%300
if T<30 then
@@ -101,4 +103,6 @@ function Pnt.intro()
gc.setColor(1,1,1,.6+sin((S.t2-80)*.0626)*.3)
mText(drawableText.anykey,640,615+sin(Timer()*3)*5)
end
end
end
return scene

View File

@@ -1,9 +1,11 @@
function sceneBack.lang()
local scene={}
function scene.sceneBack()
FILE.save(SETTING,"settings")
end
local function setLang(n)return function()SETTING.lang=n LANG.set(n)end end
WIDGET.init("lang",{
scene.widgetList={
WIDGET.newButton{name="zh", x=200, y=100,w=200,h=120,font=45,code=setLang(1)},
WIDGET.newButton{name="zh2", x=420, y=100,w=200,h=120,font=45,code=setLang(2)},
WIDGET.newButton{name="en", x=640, y=100,w=200,h=120,font=45,code=setLang(3)},
@@ -12,4 +14,6 @@ WIDGET.init("lang",{
WIDGET.newButton{name="symbol", x=200, y=250,w=200,h=120,font=45,code=setLang(6)},
WIDGET.newButton{name="yygq", x=420, y=250,w=200,h=120,font=45,code=setLang(7)},
WIDGET.newButton{name="back", x=640, y=600,w=200,h=80,font=35,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -4,7 +4,9 @@ local Timer=love.timer.getTime
local max,min,sin=math.max,math.min,math.sin
function sceneInit.load()
local scene={}
function scene.sceneInit()
sceneTemp={
time=0,--Animation timer
phase=1,--Loading stage
@@ -26,11 +28,11 @@ function sceneInit.load()
text=gc.newText(getFont(80),"26F Studio"),
}
end
function sceneBack.load()
function scene.sceneBack()
love.event.quit()
end
function keyDown.load(k)
function scene.keyDown(k)
if k=="a"then
sceneTemp.skip=true
elseif k=="s"then
@@ -41,13 +43,13 @@ function keyDown.load(k)
SCN.back()
end
end
function touchDown.load()
function scene.touchDown()
if #tc.getTouches()==2 then
sceneTemp.skip=true
end
end
function Tmr.load()
function scene.Tmr()
local S=sceneTemp
if S.time==400 then return end
repeat
@@ -146,7 +148,7 @@ function Tmr.load()
until not S.skip
end
function Pnt.load()
function scene.Pnt()
local S=sceneTemp
gc.push("transform")
@@ -206,4 +208,6 @@ function Pnt.load()
gc.line(220,Y-80,220,Y-6840)
gc.pop()
end
end
return scene

View File

@@ -1,4 +1,6 @@
function keyDown.login(key)
local scene={}
function scene.keyDown(key)
if key=="return"then
local email= WIDGET.active.email.value
local password= WIDGET.active.password.value
@@ -24,10 +26,12 @@ function keyDown.login(key)
end
end
WIDGET.init("login",{
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align="L"},
WIDGET.newButton{name="register", x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("register","swipeR")end},
WIDGET.newTextBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
WIDGET.newTextBox{name="password", x=380, y=300,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,6 +1,8 @@
local gc=love.graphics
function sceneInit.main()
local scene={}
function scene.sceneInit()
sceneTemp={
tip=text.getTip(),
}
@@ -14,12 +16,12 @@ function sceneInit.main()
PLY.newDemoPlayer(1,900,35,1.1)
end
function Tmr.main(dt)
function scene.Tmr(dt)
GAME.frame=GAME.frame+1
PLAYERS[1]:update(dt)
end
function Pnt.main()
function scene.Pnt()
gc.setColor(1,1,1)
gc.draw(IMG.title_color,60,30,nil,1.3)
setFont(30)
@@ -33,7 +35,7 @@ function Pnt.main()
PLAYERS[1]:draw()
end
WIDGET.init("main",{
scene.widgetList={
WIDGET.newButton{name="offline",x=150,y=220,w=200,h=140,color="lRed", font=40,code=WIDGET.lnk_goScene("mode")},
WIDGET.newButton{name="online", x=370,y=220,w=200,h=140,color="lCyan", font=40,code=WIDGET.lnk_goNetgame},
WIDGET.newButton{name="custom", x=590,y=220,w=200,h=140,color="lBlue", font=40,code=WIDGET.lnk_goScene("customGame")},
@@ -46,4 +48,6 @@ WIDGET.init("main",{
WIDGET.newKey{name="music", x=150,y=610,w=200,h=60,color="red", code=WIDGET.lnk_goScene("music")},
WIDGET.newKey{name="sound", x=370,y=610,w=200,h=60,color="green", code=WIDGET.lnk_goScene("sound")},
WIDGET.newKey{name="minigame", x=590,y=610,w=200,h=60,color="blue", code=WIDGET.lnk_goScene("minigame")},
})
}
return scene

View File

@@ -7,7 +7,9 @@ local int=math.floor
local rnd=math.random
local format=string.format
function sceneInit.mg_15p()
local scene={}
function scene.sceneInit()
BG.set("rainbow")
BGM.play("push")
sceneTemp={
@@ -130,7 +132,7 @@ local function tapBoard(x,y,key)
end
end
end
function keyDown.mg_15p(key)
function scene.keyDown(key)
local S=sceneTemp
local b=S.board
if key=="up"then
@@ -173,24 +175,24 @@ function keyDown.mg_15p(key)
SCN.back()
end
end
function mouseDown.mg_15p(x,y)
function scene.mouseDown(x,y)
tapBoard(x,y)
end
function mouseMove.mg_15p(x,y)
function scene.mouseMove(x,y)
if sceneTemp.slide then
tapBoard(x,y)
end
end
function touchDown.mg_15p(_,x,y)
function scene.touchDown(_,x,y)
tapBoard(x,y)
end
function touchMove.mg_15p(_,x,y)
function scene.touchMove(_,x,y)
if sceneTemp.slide then
tapBoard(x,y)
end
end
function Tmr.mg_15p()
function scene.Tmr()
local S=sceneTemp
if S.state==1 then
S.time=Timer()-S.startTime
@@ -261,7 +263,7 @@ local backColor={
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
},--Black
}
function Pnt.mg_15p()
function scene.Pnt()
local S=sceneTemp
setFont(40)
@@ -315,7 +317,7 @@ function Pnt.mg_15p()
gc.rectangle("line",x*160+173,y*160-107,134,134,50)
end
WIDGET.init("mg_15p",{
scene.widgetList={
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")},
WIDGET.newSlider{name="color", x=110,y=250,w=170,unit=4,show=false,font=30,disp=WIDGET.lnk_STPval("color"), code=function(v)if sceneTemp.state~=1 then sceneTemp.color=v end end,hide=WIDGET.lnk_STPeq("state",1)},
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("w"), hide=WIDGET.lnk_STPeq("state",1)},
@@ -323,4 +325,6 @@ WIDGET.init("mg_15p",{
WIDGET.newSwitch{name="pathVis",x=240,y=510,w=60, font=40,disp=WIDGET.lnk_STPval("pathVis"), code=WIDGET.lnk_pressKey("r"), hide=function()return sceneTemp.state==1 or not sceneTemp.slide end},
WIDGET.newSwitch{name="revKB", x=240,y=600,w=60, font=40,disp=WIDGET.lnk_STPval("revKB"), code=WIDGET.lnk_pressKey("t"), hide=WIDGET.lnk_STPeq("state",1)},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -25,7 +25,9 @@ local levels={
BPW="OHOOOOOOOOOAAAAEAAIAUJOOOOOOOOOOOAAEOAAUUAEEEEEEEEEAAAAEAEIEAJOOOOOOOOOOEEEEOAAAAAAA",
}
function sceneInit.mg_AtoZ()
local scene={}
function scene.sceneInit()
BG.set("bg2")
BGM.play("way")
sceneTemp={
@@ -40,11 +42,11 @@ function sceneInit.mg_AtoZ()
}
love.keyboard.setKeyRepeat(false)
end
function sceneBack.mg_AtoZ()
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
end
function keyDown.mg_AtoZ(key)
function scene.keyDown(key)
local S=sceneTemp
if #key==1 then
if S.state<2 and S.frameKeyCount<3 then
@@ -76,7 +78,7 @@ function keyDown.mg_AtoZ(key)
end
end
function Tmr.mg_AtoZ()
function scene.Tmr()
local S=sceneTemp
if S.state==1 then
S.frameKeyCount=0
@@ -84,7 +86,7 @@ function Tmr.mg_AtoZ()
end
end
function Pnt.mg_AtoZ()
function scene.Pnt()
local S=sceneTemp
setFont(40)
@@ -116,9 +118,11 @@ function Pnt.mg_AtoZ()
gc.print(S.target,120,520)
end
WIDGET.init("mg_AtoZ",{
scene.widgetList={
WIDGET.newSelector{name="level", x=640,y=640,w=200,list={"A_Z","Z_A","Tech1","Tech2","KeyTest1","KeyTest2","Hello","Roll1","Roll2","Roll3","ZZZ","ZXZX","ZMZM","Stair","Stair2","Stair3","BPW"},disp=WIDGET.lnk_STPval("level"),code=function(i)sceneTemp.level=i;sceneTemp.target=levels[i]end,hide=function()return sceneTemp.state>0 end},
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space")},
WIDGET.newButton{name="keyboard", x=160,y=210,w=180,h=100,code=function()love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1)end,hide=not MOBILE},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -93,13 +93,15 @@ local function place(X,x)
round=1-round
end
function sceneInit.mg_UTTT()
local scene={}
function scene.sceneInit()
restart()
BGM.play("truth")
BG.set("bg2")
end
function Pnt.mg_UTTT()
function scene.Pnt()
gc.push("transform")
--origin pos:0,140; scale:4
gc.translate(280,0)
@@ -201,19 +203,19 @@ function Pnt.mg_UTTT()
end
end
function touchDown.mg_UTTT(_,x,y)
mouseMove.mg_UTTT(x,y)
function scene.touchDown(_,x,y)
scene.mouseMove(x,y)
end
function touchMove.mg_UTTT(_,x,y)
mouseMove.mg_UTTT(x,y)
function scene.touchMove(_,x,y)
scene.mouseMove(x,y)
end
function touchUp.mg_UTTT(_,x,y)
mouseDown.mg_UTTT(x,y)
function scene.touchUp(_,x,y)
scene.mouseDown(x,y)
end
function mouseMove.mg_UTTT(x,y)
function scene.mouseMove(x,y)
x,y=int((x-280)/80),int(y/80)
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1
if
@@ -228,12 +230,14 @@ function mouseMove.mg_UTTT(x,y)
end
end
function mouseDown.mg_UTTT(x,y)
mouseMove.mg_UTTT(x,y)
function scene.mouseDown(x,y)
scene.mouseMove(x,y)
if curX then place(curX,curx)end
end
WIDGET.init("mg_UTTT",{
scene.widgetList={
WIDGET.newButton{name="reset",x=1140,y=540,w=170,h=80,font=40,color="lGreen",code=restart},
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -46,7 +46,9 @@ local function hurt(i)
end
end
function sceneInit.mg_cubefield()
local scene={}
function scene.sceneInit()
cubesX={}for i=1,40 do cubesX[i]=rnd()*16-8 end
cubesY={}for i=1,40 do cubesY[i]=i/40*9 end
lastCube=1
@@ -62,7 +64,7 @@ function sceneInit.mg_cubefield()
BG.set("none")
end
function touchDown.mg_cubefield(_,x)
function scene.touchDown(_,x)
if play then
if x<640 then
moveDir=-1
@@ -70,10 +72,10 @@ function touchDown.mg_cubefield(_,x)
moveDir=1
end
else
keyDown.mg_cubefield("space")
scene.keyDown("space")
end
end
function touchUp.mg_cubefield(_,x)
function scene.touchUp(_,x)
if play then
local L=tc.getTouches()
if x<640 then
@@ -94,7 +96,7 @@ function touchUp.mg_cubefield(_,x)
moveDir=0
end
end
function keyDown.mg_cubefield(key)
function scene.keyDown(key)
if key=="escape"then
SCN.back()
return
@@ -114,7 +116,7 @@ function keyDown.mg_cubefield(key)
end
end
end
function keyUp.mg_cubefield(key)
function scene.keyUp(key)
if play then
if key=="left"or key=="a"then
moveDir=kb.isDown("right","d")and 1 or 0
@@ -124,7 +126,7 @@ function keyUp.mg_cubefield(key)
end
end
function Tmr.mg_cubefield(dt)
function scene.Tmr(dt)
dt=dt*600
--Update cubes' position
@@ -187,7 +189,7 @@ function Tmr.mg_cubefield(dt)
end
end
function Pnt.mg_cubefield()
function scene.Pnt()
--Health bar
if life1>0 then
gc.setColor(1,0,0)
@@ -292,6 +294,8 @@ function Pnt.mg_cubefield()
gc.pop()
end
WIDGET.init("mg_cubefield",{
scene.widgetList={
WIDGET.newKey{name="back",x=1140,y=80,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -5,7 +5,9 @@ local abs=math.abs
local max,min=math.max,math.min
local rnd=math.random
function sceneInit.mg_pong()
local scene={}
function scene.sceneInit()
BG.set("none")
BGM.play("way")
sceneTemp={
@@ -35,7 +37,7 @@ local function start()
sceneTemp.vx=rnd()>.5 and 6 or -6
sceneTemp.vy=rnd()*6-3
end
function keyDown.mg_pong(key)
function scene.keyDown(key)
local S=sceneTemp
if key=="space"then
if S.state==0 then
@@ -55,21 +57,21 @@ function keyDown.mg_pong(key)
SCN.back()
end
end
function touchDown.mg_pong(id,x,y)
touchMove.mg_pong(id,x,y)
function scene.touchDown(id,x,y)
scene.touchMove(id,x,y)
if sceneTemp.state==0 then
start()
end
end
function touchMove.mg_pong(_,x,y)
function scene.touchMove(_,x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end
function mouseMove.mg_pong(x,y)
function scene.mouseMove(x,y)
sceneTemp[x<640 and"p1"or"p2"].y0=y
end
--Rect Area X:150~1130 Y:20~700
function Tmr.mg_pong()
function scene.Tmr()
local S=sceneTemp
--Update pads
@@ -146,7 +148,7 @@ function Tmr.mg_pong()
S.x,S.y,S.vx,S.vy,S.ry=x,y,vx,vy,ry
end
function Pnt.mg_pong()
function scene.Pnt()
local S=sceneTemp
--Draw score
@@ -174,7 +176,9 @@ function Pnt.mg_pong()
gc.rectangle("fill",1130,S.p2.y-50,20,100)
end
WIDGET.init("mg_pong",{
scene.widgetList={
WIDGET.newKey{name="reset",x=640,y=45,w=150,h=50,font=35,code=WIDGET.lnk_pressKey("r")},
WIDGET.newKey{name="back",x=640,y=675,w=150,h=50,font=35,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -10,7 +10,9 @@ local rnd=math.random
local format=string.format
local rem=table.remove
function sceneInit.mg_schulteG()
local scene={}
function scene.sceneInit()
BGM.play("way")
sceneTemp={
board={},
@@ -73,13 +75,13 @@ local function tapBoard(x,y)
end
end
function mouseDown.mg_schulteG(x,y)
function scene.mouseDown(x,y)
tapBoard(x,y)
end
function touchDown.mg_schulteG(_,x,y)
function scene.touchDown(_,x,y)
tapBoard(x,y)
end
function keyDown.mg_schulteG(key)
function scene.keyDown(key)
local S=sceneTemp
if key=="z"or key=="x"then
love.mousepressed(ms.getPosition())
@@ -112,14 +114,14 @@ function keyDown.mg_schulteG(key)
end
end
function Tmr.mg_schulteG()
function scene.Tmr()
local S=sceneTemp
if S.state==1 then
S.time=Timer()-S.startTime+S.error
end
end
function Pnt.mg_schulteG()
function scene.Pnt()
local S=sceneTemp
setFont(40)
@@ -171,11 +173,13 @@ function Pnt.mg_schulteG()
end
end
WIDGET.init("mg_schulteG",{
scene.widgetList={
WIDGET.newButton{name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=WIDGET.lnk_pressKey("space"),hide=function()return sceneTemp.state==0 end},
WIDGET.newSlider{name="rank", x=130,y=250,w=150,unit=3,show=false,font=40,disp=function()return sceneTemp.rank-3 end,code=function(v)sceneTemp.rank=v+3 end,hide=function()return sceneTemp.state>0 end},
WIDGET.newSwitch{name="blind", x=240,y=330,w=60, font=40,disp=WIDGET.lnk_STPval("blind"), code=WIDGET.lnk_pressKey("q"),hide=WIDGET.lnk_STPeq("state",1)},
WIDGET.newSwitch{name="disappear", x=240,y=420,w=60, font=40,disp=WIDGET.lnk_STPval("disappear"),code=WIDGET.lnk_pressKey("w"),hide=WIDGET.lnk_STPeq("state",1)},
WIDGET.newSwitch{name="tapFX", x=240,y=510,w=60, font=40,disp=WIDGET.lnk_STPval("tapFX"), code=WIDGET.lnk_pressKey("e"),hide=WIDGET.lnk_STPeq("state",1)},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,8 +1,10 @@
function sceneInit.minigame()
local scene={}
function scene.sceneInit()
BG.set("space")
end
WIDGET.init("minigame",{
scene.widgetList={
WIDGET.newButton{name="mg_15p", x=240, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_15p")},
WIDGET.newButton{name="mg_schulteG",x=640, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_schulteG")},
WIDGET.newButton{name="mg_pong", x=1040, y=250,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_pong")},
@@ -10,4 +12,6 @@ WIDGET.init("minigame",{
WIDGET.newButton{name="mg_UTTT", x=640, y=400,w=350,h=120,font=30,code=WIDGET.lnk_goScene("mg_UTTT")},
WIDGET.newButton{name="mg_cubefield",x=1040,y=400,w=350,h=120,font=40,code=WIDGET.lnk_goScene("mg_cubefield")},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -39,14 +39,16 @@ local function toggleMod(M,back)
end
end
function sceneInit.mod()
local scene={}
function scene.sceneInit()
sceneTemp={
sel=nil,--selected mod name
}
BG.set("tunnel")
end
function mouseMove.mod(x,y)
function scene.mouseMove(x,y)
sceneTemp.sel=nil
for N,M in next,MODOPT do
if(x-M.x)^2+(y-M.y)^2<2000 then
@@ -55,7 +57,7 @@ function mouseMove.mod(x,y)
end
end
end
function mouseDown.mod(x,y,k)
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"))
@@ -63,14 +65,14 @@ function mouseDown.mod(x,y,k)
end
end
end
function touchMove.mod(_,x,y)
mouseMove.mod(x,y)
function scene.touchMove(_,x,y)
scene.mouseMove(x,y)
end
function touchDown.mod(_,x,y)
mouseMove.mod(x,y)
mouseDown.mod(x,y)
function scene.touchDown(_,x,y)
scene.mouseMove(x,y)
scene.mouseDown(x,y)
end
function keyDown.mod(key)
function scene.keyDown(key)
if key=="tab"or key=="delete"then
if GAME.mod[1]then
while GAME.mod[1]do
@@ -91,7 +93,7 @@ function keyDown.mod(key)
end
end
function Tmr.mod()
function scene.Tmr()
for _,M in next,MODOPT do
if M.sel==0 then
if M.time>0 then
@@ -104,7 +106,7 @@ function Tmr.mod()
end
end
end
function Pnt.mod()
function scene.Pnt()
setFont(40)
gc.setLineWidth(5)
for _,M in next,MODOPT do
@@ -150,9 +152,11 @@ function Pnt.mod()
end
end
WIDGET.init("mod",{
scene.widgetList={
WIDGET.newText{name="title", x=80,y=50,font=70,align="L"},
WIDGET.newText{name="unranked", x=1200,y=60,color="yellow",font=50,align="R",hide=function()return scoreValid()end},
WIDGET.newButton{name="reset", x=1140,y=540,w=170,h=80,font=25,code=WIDGET.lnk_pressKey("tab")},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -18,7 +18,9 @@ local mapCam={
}
local touchDist=nil
function sceneInit.mode(org)
local scene={}
function scene.sceneInit(org)
BG.set("space")
destroyPlayers()
local cam=mapCam
@@ -55,7 +57,7 @@ local function moveMap(dx,dy)
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 wheelMoved.mode(_,dy)
function scene.wheelMoved(_,dy)
mapCam.keyCtrl=false
local k=getK()
k=min(max(k+dy*.1,.3),1.6)/k
@@ -64,13 +66,13 @@ function wheelMoved.mode(_,dy)
local x,y=getPos()
mapCam.xOy:translate(x*(1-k),y*(1-k))
end
function mouseMove.mode(_,_,dx,dy)
function scene.mouseMove(_,_,dx,dy)
if ms.isDown(1)then
moveMap(dx,dy)
end
mapCam.keyCtrl=false
end
function mouseClick.mode(x,y)
function scene.mouseClick(x,y)
local _=mapCam.sel
if not _ or x<920 then
local SEL=onMode(x,y)
@@ -84,15 +86,15 @@ function mouseClick.mode(x,y)
mapCam.sel=nil
end
elseif _ then
keyDown.mode("return")
scene.keyDown("return")
end
end
mapCam.keyCtrl=false
end
function touchDown.mode()
function scene.touchDown()
touchDist=nil
end
function touchMove.mode(_,x,y,dx,dy)
function scene.touchMove(_,x,y,dx,dy)
local L=tc.getTouches()
if not L[2]then
moveMap(dx,dy)
@@ -103,17 +105,17 @@ function touchMove.mode(_,x,y,dx,dy)
if d>100 then
d=d^.5
if touchDist then
wheelMoved.mode(nil,(d-touchDist)*.02)
scene.wheelMoved(nil,(d-touchDist)*.02)
end
touchDist=d
end
end
mapCam.keyCtrl=false
end
function touchClick.mode(x,y)
mouseClick.mode(x,y)
function scene.touchClick(x,y)
scene.mouseClick(x,y)
end
function keyDown.mode(key)
function scene.keyDown(key)
if key=="return"then
if mapCam.sel then
mapCam.keyCtrl=false
@@ -131,7 +133,7 @@ function keyDown.mode(key)
end
end
function Tmr.mode()
function scene.Tmr()
local dx,dy=0,0
local F
if not SCN.swapping then
@@ -185,7 +187,7 @@ function Tmr.mode()
end
end
function Pnt.mode()
function scene.Pnt()
local _
gc.push("transform")
gc.translate(640,360)
@@ -306,8 +308,10 @@ function Pnt.mode()
end
end
WIDGET.init("mode",{
scene.widgetList={
WIDGET.newKey{name="mod", x=140,y=655,w=220,h=80,font=35,code=WIDGET.lnk_goScene("mod")},
WIDGET.newButton{name="start", x=1040,y=655,w=180,h=80,font=40,code=WIDGET.lnk_pressKey("return"),hide=function()return not mapCam.sel end},
WIDGET.newButton{name="back", x=1200,y=655,w=120,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -22,7 +22,9 @@ local function wheelScroll(y)
end
end
function sceneInit.music()
local scene={}
function scene.sceneInit()
if BGM.nowPlay then
for i=1,BGM.len do
if BGM.list[i]==BGM.nowPlay then
@@ -35,10 +37,10 @@ function sceneInit.music()
end
end
function wheelMoved.music(_,y)
function scene.wheelMoved(_,y)
wheelScroll(y)
end
function keyDown.music(key)
function scene.keyDown(key)
local S=sceneTemp
if key=="down"then
if S<BGM.len then
@@ -64,7 +66,7 @@ function keyDown.music(key)
end
end
function Pnt.music()
function scene.Pnt()
gc.setColor(1,1,1)
setFont(50)
@@ -90,7 +92,7 @@ function Pnt.music()
end
end
WIDGET.init("music",{
scene.widgetList={
WIDGET.newText{name="title", x=30, y=30,font=80,align="L"},
WIDGET.newText{name="arrow", x=270, y=360,font=45,align="L"},
WIDGET.newText{name="now", x=700, y=500,font=50,align="R",hide=function()return not BGM.nowPlay end},
@@ -99,4 +101,6 @@ WIDGET.init("music",{
WIDGET.newButton{name="play", x=200, y=390,w=120, font=35,code=WIDGET.lnk_pressKey("space"),hide=function()return SETTING.bgm==0 end},
WIDGET.newButton{name="down", x=200, y=530,w=120, font=55,code=WIDGET.lnk_pressKey("down"),hide=function()return sceneTemp==BGM.len end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,10 +1,14 @@
function sceneInit.netgame()
local scene={}
function scene.sceneInit()
BG.set("matrix")
end
WIDGET.init("netgame",{
scene.widgetList={
WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=NULL},
WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=NULL},
WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,font=40,code=WIDGET.lnk_goScene("chat")},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -19,7 +19,10 @@ local fnsRankColor={
E=COLOR.red,
F=COLOR.dRed,
}
function sceneInit.pause(org)
local scene={}
function scene.sceneInit(org)
if org:find("setting")then
TEXT.show(text.needRestart,640,440,50,"fly",.6)
end
@@ -112,7 +115,7 @@ function sceneInit.pause(org)
GAME.prevBG=nil
end
end
function sceneBack.pause()
function scene.sceneBack()
love.keyboard.setKeyRepeat(true)
if not GAME.replaying then
mergeStat(STAT,PLAYERS[1].stat)
@@ -122,7 +125,7 @@ function sceneBack.pause()
end
end
function keyDown.pause(key)
function scene.keyDown(key)
if key=="q"then
SCN.back()
elseif key=="escape"then
@@ -139,7 +142,7 @@ function keyDown.pause(key)
end
end
function Tmr.pause(dt)
function scene.Tmr(dt)
if not GAME.result then
GAME.pauseTime=GAME.pauseTime+dt
end
@@ -152,10 +155,10 @@ local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}
for i=1,6 do hexList[i]=hexList[i]*150 end
local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25}
local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
function Pnt.pause()
function scene.Pnt()
local S=sceneTemp
local T=S.timer*.02
if T<1 or GAME.result then Pnt.play()end
if T<1 or GAME.result then SCN.scenes.play.Pnt()end
--Dark BG
local _=T
@@ -295,10 +298,12 @@ function Pnt.pause()
end
end
WIDGET.init("pause",{
scene.widgetList={
WIDGET.newButton{name="setting", x=1120, y=70, w=240,h=90, color="lBlue", font=35,code=WIDGET.lnk_pressKey("s")},
WIDGET.newButton{name="replay", x=640, y=250, w=240,h=100,color="lYellow",font=30,code=WIDGET.lnk_pressKey("p"),hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end},
WIDGET.newButton{name="resume", x=640, y=367, w=240,h=100,color="lGreen", font=30,code=WIDGET.lnk_pressKey("escape")},
WIDGET.newButton{name="restart", x=640, y=483, w=240,h=100,color="lRed", font=35,code=WIDGET.lnk_pressKey("r")},
WIDGET.newButton{name="quit", x=640, y=600, w=240,h=100,font=35,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -24,7 +24,9 @@ local function onVirtualkey(x,y)
return nearest
end
function sceneInit.play()
local scene={}
function scene.sceneInit()
love.keyboard.setKeyRepeat(false)
GAME.restartCount=0
if GAME.init then
@@ -33,7 +35,7 @@ function sceneInit.play()
end
end
function touchDown.play(_,x,y)
function scene.touchDown(_,x,y)
if not SETTING.VKSwitch or GAME.replaying then return end
local t=onVirtualkey(x,y)
@@ -66,7 +68,7 @@ function touchDown.play(_,x,y)
VIB(SETTING.VKVIB)
end
end
function touchUp.play(_,x,y)
function scene.touchUp(_,x,y)
if not SETTING.VKSwitch or GAME.replaying then return end
local t=onVirtualkey(x,y)
@@ -74,7 +76,7 @@ function touchUp.play(_,x,y)
PLAYERS[1]:releaseKey(t)
end
end
function touchMove.play()
function scene.touchMove()
if not SETTING.VKSwitch or GAME.replaying then return end
local l=tc.getTouches()
@@ -90,7 +92,7 @@ function touchMove.play()
::next::
end
end
function keyDown.play(key)
function scene.keyDown(key)
if not GAME.replaying then
local m=keyMap
for k=1,20 do
@@ -104,7 +106,7 @@ function keyDown.play(key)
end
if key=="escape"then pauseGame()end
end
function keyUp.play(key)
function scene.keyUp(key)
if GAME.replaying then return end
local m=keyMap
for k=1,20 do
@@ -115,7 +117,7 @@ function keyUp.play(key)
end
end
end
function gamepadDown.play(key)
function scene.gamepadDown(key)
if GAME.replaying then return end
local m=keyMap
@@ -130,7 +132,7 @@ function gamepadDown.play(key)
if key=="back"then pauseGame()end
end
function gamepadUp.play(key)
function scene.gamepadUp(key)
if GAME.replaying then return end
local m=keyMap
@@ -143,7 +145,7 @@ function gamepadUp.play(key)
end
end
function Tmr.play(dt)
function scene.Tmr(dt)
local _
local P1=PLAYERS[1]
local GAME=GAME
@@ -292,7 +294,7 @@ local function drawVirtualkey()
end
end
end
function Pnt.play()
function scene.Pnt()
if MARKING then
setFont(25)
local t=Timer()
@@ -352,6 +354,8 @@ function Pnt.play()
gc.pop()
end
WIDGET.init("play",{
scene.widgetList={
WIDGET.newButton{name="pause",x=1235,y=45,w=80,font=25,code=function()pauseGame()end},
})
}
return scene

View File

@@ -1,8 +1,12 @@
function sceneInit.quit()
local scene={}
function scene.sceneInit()
if math.random()>.000626 then
love.timer.sleep(.26)
love.event.quit()
else
error("So lucky! 0.0626 precent to get this!!! You can quit the game now.")
end
end
end
return scene

View File

@@ -1,4 +1,6 @@
function keyDown.register(key)
local scene={}
function scene.keyDown(key)
if key=="return"then
local username= WIDGET.active.username.value
local email= WIDGET.active.email.value
@@ -31,7 +33,7 @@ function keyDown.register(key)
end
end
WIDGET.init("register",{
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align="L"},
WIDGET.newButton{name="login", x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("login","swipeL")end},
WIDGET.newTextBox{name="username", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z_]"},
@@ -39,4 +41,6 @@ WIDGET.init("register",{
WIDGET.newTextBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newTextBox{name="password2", x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,7 +1,9 @@
function sceneInit.savedata()
local scene={}
function scene.sceneInit()
sceneTemp={reset=false}
end
function keyDown.savedata(key)
function scene.keyDown(key)
LOG.print("keyPress: ["..key.."]")
end
@@ -36,7 +38,7 @@ end
local function HIDE()
return not sceneTemp.reset
end
WIDGET.init("savedata",{
scene.widgetList={
WIDGET.newButton{name="exportUnlock", x=190,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(RANKS)end},
WIDGET.newButton{name="exportData", x=490,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(STAT)end},
WIDGET.newButton{name="exportSetting", x=790,y=150,w=280,h=100,color="lGreen",font=25,code=function()dumpCB(SETTING)end},
@@ -115,4 +117,6 @@ WIDGET.init("savedata",{
hide=HIDE},
WIDGET.newButton{name="back", x=640,y=620,w=200,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,7 +1,9 @@
local gc=love.graphics
local int=math.floor
function sceneInit.setting_control()
local scene={}
function scene.sceneInit()
sceneTemp={
das=SETTING.das,
arr=SETTING.arr,
@@ -12,7 +14,7 @@ function sceneInit.setting_control()
BG.set("bg1")
end
function Tmr.setting_control()
function scene.Tmr()
local T=sceneTemp
if T.wait>0 then
T.wait=T.wait-1
@@ -52,7 +54,7 @@ function Tmr.setting_control()
end
end
function Pnt.setting_control()
function scene.Pnt()
--Testing grid line
gc.setLineWidth(4)
gc.setColor(1,1,1,.4)
@@ -79,7 +81,7 @@ local function sliderShow(S)
S=S.disp()
return S.."F "..int(S*16.67).."ms"
end
WIDGET.init("setting_control",{
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align="L"},
WIDGET.newText{name="preview", x=520, y=540,font=40,align="R"},
@@ -98,4 +100,6 @@ WIDGET.init("setting_control",{
_.ihs,_.irs,_.ims=false,false,false
end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -3,19 +3,21 @@ local Timer=love.timer.getTime
local int=math.floor
function sceneInit.setting_game()
local scene={}
function scene.sceneInit()
BG.set("space")
end
function sceneBack.setting_game()
function scene.sceneBack()
FILE.save(SETTING,"settings")
end
function Pnt.setting_game()
function scene.Pnt()
gc.setColor(1,1,1)
gc.draw(SKIN.curText[int(Timer()*2)%16+1],740,540,Timer()%6.28319,2,nil,15,15)
end
WIDGET.init("setting_game",{
scene.widgetList={
WIDGET.newText{name="title", x=640,y=15,font=80},
WIDGET.newButton{name="graphic", x=200, y=80, w=240,h=80, color="lCyan", font=35,code=WIDGET.lnk_swapScene("setting_video","swipeR")},
@@ -34,4 +36,6 @@ WIDGET.init("setting_game",{
WIDGET.newSwitch{name="appLock", x=1080, y=500, font=20,disp=WIDGET.lnk_SETval("appLock"), code=WIDGET.lnk_SETrev("appLock")},
WIDGET.newButton{name="calc", x=970, y=550, w=150,h=60,color="dGrey", font=25,code=WIDGET.lnk_goScene("calculator"),hide=function()return not SETTING.appLock end},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -5,18 +5,20 @@ local mStr=mStr
local int,sin=math.floor,math.sin
function sceneInit.setting_key()
local scene={}
function scene.sceneInit()
sceneTemp={
board=1,
kb=1,js=1,
kS=false,jS=false,
}
end
function sceneBack.setting_key()
function scene.sceneBack()
FILE.save(keyMap,"key")
end
function keyDown.setting_key(key)
function scene.keyDown(key)
local S=sceneTemp
if key=="escape"then
if S.kS then
@@ -53,7 +55,7 @@ function keyDown.setting_key(key)
SFX.play("rotate",.5)
end
end
function gamepadDown.setting_key(key)
function scene.gamepadDown(key)
local S=sceneTemp
if key=="back"then
if S.jS then
@@ -89,7 +91,7 @@ function gamepadDown.setting_key(key)
end
end
function Pnt.setting_key()
function scene.Pnt()
local S=sceneTemp
local a=.3+sin(Timer()*15)*.1
if S.kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end
@@ -131,11 +133,13 @@ function Pnt.setting_key()
gc.print(text.page..S.board,280,570)
end
WIDGET.init("setting_key",{
scene.widgetList={
WIDGET.newText{name="keyboard", x=340,y=30,font=25,color="lRed"},
WIDGET.newText{name="keyboard", x=940,y=30,font=25,color="lRed"},
WIDGET.newText{name="joystick", x=540,y=30,font=25,color="lBlue"},
WIDGET.newText{name="joystick", x=1140,y=30,font=25,color="lBlue"},
WIDGET.newText{name="help", x=50,y=650,font=30,align="L"},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -2,7 +2,9 @@ local gc=love.graphics
local Timer=love.timer.getTime
local sin=math.sin
function Pnt.setting_skin()
local scene={}
function scene.Pnt()
gc.setColor(1,1,1)
local texture=SKIN.curText
for N=1,7 do
@@ -27,7 +29,7 @@ local function prevSkin(n)return function()SKIN.prev(n)end end
local function nextSkin(n)return function()SKIN.next(n)end end
local function nextDir(n)return function()SKIN.rotate(n)end end
WIDGET.init("setting_skin",{
scene.widgetList={
WIDGET.newText{name="title", x=80,y=50,font=70},
WIDGET.newButton{name="prev", x=700,y=100,w=140,h=100,font=50,code=function()SKIN.prevSet()end},
@@ -69,4 +71,6 @@ WIDGET.init("setting_skin",{
SFX.play("hold")
end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -4,7 +4,9 @@ local Timer=love.timer.getTime
local sin=math.sin
local rnd=math.random
function sceneInit.setting_sound()
local scene={}
function scene.sceneInit()
sceneTemp={
last=0,--Last touch time
jump=0,--Animation timer(10 to 0)
@@ -12,11 +14,11 @@ function sceneInit.setting_sound()
}
BG.set("space")
end
function sceneBack.setting_sound()
function scene.sceneBack()
FILE.save(SETTING,"settings")
end
function mouseDown.setting_sound(x,y)
function scene.mouseDown(x,y)
local S=sceneTemp
if x>780 and x<980 and y>470 and S.jump==0 then
S.jump=10
@@ -27,18 +29,18 @@ function mouseDown.setting_sound(x,y)
end
end
end
function touchDown.setting_sound(_,x,y)
mouseDown.setting_sound(x,y)
function scene.touchDown(_,x,y)
scene.mouseDown(x,y)
end
function Tmr.setting_sound()
function scene.Tmr()
local t=sceneTemp.jump
if t>0 then
sceneTemp.jump=t-1
end
end
function Pnt.setting_sound()
function scene.Pnt()
gc.setColor(1,1,1)
local t=Timer()
local _=sceneTemp.jump
@@ -53,7 +55,7 @@ function Pnt.setting_sound()
gc.translate(-x,-y)
end
WIDGET.init("setting_sound",{
scene.widgetList={
WIDGET.newText{name="title", x=640,y=15,font=80},
WIDGET.newButton{name="game", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=WIDGET.lnk_swapScene("setting_game","swipeR")},
@@ -68,4 +70,6 @@ WIDGET.init("setting_sound",{
WIDGET.newSelector{name="cv", x=1100, y=380,w=200, list={"miya","naki"}, disp=WIDGET.lnk_STPval("cv"),code=WIDGET.lnk_STPsto("cv")},
WIDGET.newButton{name="apply", x=1100, y=460,w=180,h=80, code=function()SETTING.cv=sceneTemp.cv VOC.loadAll()end,hide=function()return SETTING.cv==sceneTemp.cv end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80, font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -4,7 +4,9 @@ local Timer=love.timer.getTime
local int,sin=math.floor,math.sin
function sceneInit.setting_touch()
local scene={}
function scene.sceneInit()
BG.set("rainbow")
sceneTemp={
default=1,
@@ -12,7 +14,7 @@ function sceneInit.setting_touch()
sel=nil,
}
end
function sceneBack.setting_touch()
function scene.sceneBack()
FILE.save(VK_org,"virtualkey")
end
@@ -31,34 +33,34 @@ local function onVK_org(x,y)
end
return nearest
end
function mouseDown.setting_touch(x,y,k)
function scene.mouseDown(x,y,k)
if k==2 then SCN.back()end
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel
end
function mouseMove.setting_touch(_,_,dx,dy)
function scene.mouseMove(_,_,dx,dy)
if sceneTemp.sel and ms.isDown(1)and not WIDGET.sel then
local B=VK_org[sceneTemp.sel]
B.x,B.y=B.x+dx,B.y+dy
end
end
function mouseUp.setting_touch()
function scene.mouseUp()
if sceneTemp.sel then
local B=VK_org[sceneTemp.sel]
local k=sceneTemp.snap
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function touchDown.setting_touch(_,x,y)
function scene.touchDown(_,x,y)
sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel
end
function touchUp.setting_touch()
function scene.touchUp()
if sceneTemp.sel then
local B=VK_org[sceneTemp.sel]
local k=sceneTemp.snap
B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k
end
end
function touchMove.setting_touch(_,_,_,dx,dy)
function scene.touchMove(_,_,_,dx,dy)
if sceneTemp.sel and not WIDGET.sel then
local B=VK_org[sceneTemp.sel]
B.x,B.y=B.x+dx,B.y+dy
@@ -79,7 +81,7 @@ local function VirtualkeyPreview()
end
end
end
function Pnt.setting_touch()
function scene.Pnt()
gc.setColor(1,1,1)
gc.setLineWidth(7)gc.rectangle("line",340,15,600,690)
gc.setLineWidth(3)gc.rectangle("line",490,85,300,600)
@@ -169,7 +171,7 @@ local virtualkeySet={
{20,1210, 50,30},--zangiRight
},--PC key feedback(top&in a row)
}
WIDGET.init("setting_touch",{
scene.widgetList={
WIDGET.newButton{name="default", x=520,y=90,w=200,h=80,font=35,
code=function()
local D=virtualkeySet[sceneTemp.default]
@@ -208,4 +210,6 @@ WIDGET.init("setting_touch",{
hide=function()
return not sceneTemp.sel
end},
})
}
return scene

View File

@@ -1,11 +1,13 @@
function sceneInit.setting_touchSwitch()
local scene={}
function scene.sceneInit()
BG.set("matrix")
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
WIDGET.init("setting_touchSwitch",{
scene.widgetList={
WIDGET.newSwitch{name="b1", x=280, y=80, font=35,disp=VKAdisp(1),code=VKAcode(1)},
WIDGET.newSwitch{name="b2", x=280, y=140, font=35,disp=VKAdisp(2),code=VKAcode(2)},
WIDGET.newSwitch{name="b3", x=280, y=200, font=35,disp=VKAdisp(3),code=VKAcode(3)},
@@ -42,4 +44,6 @@ WIDGET.init("setting_touchSwitch",{
end},
WIDGET.newSlider{name="alpha", x=840, y=540, w=400,font=40,disp=WIDGET.lnk_SETval("VKAlpha"),code=WIDGET.lnk_SETsto("VKAlpha")},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,15 +1,19 @@
local gc=love.graphics
function Pnt.setting_trackSetting()
local scene={}
function scene.Pnt()
gc.setColor(1,1,1)
mText(drawableText.VKTchW,140+50*SETTING.VKTchW,260)
mText(drawableText.VKOrgW,140+50*SETTING.VKTchW+50*SETTING.VKCurW,320)
mText(drawableText.VKCurW,640+50*SETTING.VKCurW,380)
end
WIDGET.init("setting_trackSetting",{
scene.widgetList={
WIDGET.newSwitch{name="VKDodge",x=400, y=200, font=35, disp=WIDGET.lnk_SETval("VKDodge"),code=WIDGET.lnk_SETrev("VKDodge")},
WIDGET.newSlider{name="VKTchW", x=140, y=310, w=1000, unit=10,font=35,disp=WIDGET.lnk_SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end},
WIDGET.newSlider{name="VKCurW", x=140, y=370, w=1000, unit=10,font=35,disp=WIDGET.lnk_SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end},
WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,11 +1,13 @@
function sceneInit.setting_video()
local scene={}
function scene.sceneInit()
BG.set("space")
end
function sceneBack.setting_video()
function scene.sceneBack()
FILE.save(SETTING,"settings")
end
WIDGET.init("setting_video",{
scene.widgetList={
WIDGET.newText{name="title", x=640, y=15,font=80},
WIDGET.newButton{name="sound", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=WIDGET.lnk_swapScene("setting_sound","swipeR")},
@@ -56,4 +58,6 @@ WIDGET.init("setting_video",{
SETTING.powerInfo=not SETTING.powerInfo
end},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,6 +1,8 @@
local int=math.floor
function sceneInit.sound()
local scene={}
function scene.sceneInit()
sceneTemp={
mini=false,
b2b=false,
@@ -11,7 +13,7 @@ end
local blockName={"z","s","j","l","t","o","i"}
local lineCount={"single","double","triple","techrash"}
function keyDown.sound(key)
function scene.keyDown(key)
local S=sceneTemp
if key=="1"then
S.mini=not S.mini
@@ -39,7 +41,7 @@ function keyDown.sound(key)
end
end
WIDGET.init("sound",{
scene.widgetList={
WIDGET.newText{name="title", x=30, y=15,font=70,align="L"},
WIDGET.newSlider{name="sfx", x=510, y=60,w=330,font=35,change=function()SFX.play("blip_1")end,disp=WIDGET.lnk_SETval("sfx"),code=WIDGET.lnk_SETsto("sfx")},
WIDGET.newSlider{name="voc", x=510, y=120,w=330,font=35,change=function()VOC.play("test")end,disp=WIDGET.lnk_SETval("voc"),code=WIDGET.lnk_SETsto("voc")},
@@ -107,4 +109,6 @@ WIDGET.init("sound",{
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=WIDGET.lnk_STPval("pc"),code=WIDGET.lnk_pressKey("4")},
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -1,7 +1,9 @@
local gc=love.graphics
local kb,tc=love.keyboard,love.touch
function sceneInit.staff()
local scene={}
function scene.sceneInit()
sceneTemp={
time=0,
v=1,
@@ -9,7 +11,7 @@ function sceneInit.staff()
BG.set("space")
end
function mouseDown.staff(x,y)
function scene.mouseDown(x,y)
if x>230 and x<1050 then
if math.abs(y-800+sceneTemp.time*40)<70 then
SCN.pop()SCN.push()
@@ -21,11 +23,11 @@ function mouseDown.staff(x,y)
end
end
function touchDown.staff(_,x,y)
mouseDown(nil,x,y)
function scene.touchDown(_,x,y)
scene.mouseDown(x,y)
end
function keyDown.staff(k)
function scene.keyDown(k)
if kb.isDown("s")then
if k=="l"then
SCN.pop()
@@ -37,7 +39,7 @@ function keyDown.staff(k)
end
end
function Tmr.staff(dt)
function scene.Tmr(dt)
local S=sceneTemp
if(kb.isDown("space","return")or tc.getTouches()[1])and S.v<6.26 then
S.v=S.v+.26
@@ -50,7 +52,7 @@ function Tmr.staff(dt)
end
end
function Pnt.staff()
function scene.Pnt()
local L=text.staff
local t=sceneTemp.time
setFont(40)
@@ -62,6 +64,8 @@ function Pnt.staff()
mDraw(IMG.title_color,640,2160-t*40,nil,2)
end
WIDGET.init("staff",{
scene.widgetList={
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
})
}
return scene

View File

@@ -6,7 +6,9 @@ local format=string.format
local mStr=mStr
function sceneInit.stat()
local scene={}
function scene.sceneInit()
local S=STAT
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}
for i=1,7 do
@@ -43,7 +45,7 @@ function sceneInit.stat()
end
end
function Pnt.stat()
function scene.Pnt()
local chart=sceneTemp.chart
setFont(25)
local _,__=SKIN.libColor,SETTING.skin
@@ -95,8 +97,10 @@ function Pnt.stat()
gc.draw(TEXTURE.miniBlock[R],680,300,0,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
end
WIDGET.init("stat",{
scene.widgetList={
WIDGET.newButton{name="path",x=1000,y=540,w=250,h=80,font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=MOBILE},
WIDGET.newButton{name="save",x=1000,y=640,w=250,h=80,font=25,code=WIDGET.lnk_goScene("savedata")},
WIDGET.newButton{name="back",x=640,y=620,w=200,h=80,font=35,code=WIDGET.lnk_BACK},
})
}
return scene