框架keyDown事件机制微调,重构框架主循环和控件相关代码
可以用键盘和手柄控制光标(手柄不完善) 整理代码和部分语言文件细节
This commit is contained in:
@@ -60,6 +60,7 @@ BGM= require'Zframework.bgm'
|
|||||||
VOC= require'Zframework.voice'
|
VOC= require'Zframework.voice'
|
||||||
|
|
||||||
local ms,kb=love.mouse,love.keyboard
|
local ms,kb=love.mouse,love.keyboard
|
||||||
|
local KBisDown=kb.isDown
|
||||||
|
|
||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local gc_push,gc_pop,gc_clear,gc_discard=gc.push,gc.pop,gc.clear,gc.discard
|
local gc_push,gc_pop,gc_clear,gc_discard=gc.push,gc.pop,gc.clear,gc.discard
|
||||||
@@ -69,9 +70,11 @@ local gc_draw,gc_line,gc_circle,gc_print=gc.draw,gc.line,gc.circle,gc.print
|
|||||||
|
|
||||||
local WIDGET,SCR,SCN=WIDGET,SCR,SCN
|
local WIDGET,SCR,SCN=WIDGET,SCR,SCN
|
||||||
local xOy=SCR.xOy
|
local xOy=SCR.xOy
|
||||||
local ITP=xOy.inverseTransformPoint
|
|
||||||
|
|
||||||
local mx,my,mouseShow=-20,-20,false
|
local ITP=xOy.inverseTransformPoint
|
||||||
|
local max,min=math.max,math.min
|
||||||
|
|
||||||
|
local mx,my,mouseShow,cursorSpd=-20,-20,false,0
|
||||||
local jsState={}--map, joystickID->axisStates: {axisName->axisVal}
|
local jsState={}--map, joystickID->axisStates: {axisName->axisVal}
|
||||||
local errData={}--list, each error create {mes={errMes strings},scene=sceneNameStr}
|
local errData={}--list, each error create {mes={errMes strings},scene=sceneNameStr}
|
||||||
|
|
||||||
@@ -126,36 +129,61 @@ local function updatePowerInfo()
|
|||||||
end
|
end
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
local lastX,lastY=0,0--Last click pos
|
local lastX,lastY=0,0--Last click pos
|
||||||
|
local function _updateMousePos(x,y,dx,dy)
|
||||||
|
if SCN.swapping then return end
|
||||||
|
dx,dy=dx/SCR.k,dy/SCR.k
|
||||||
|
if SCN.mouseMove then SCN.mouseMove(x,y,dx,dy)end
|
||||||
|
if ms.isDown(1)then
|
||||||
|
WIDGET.drag(x,y,dx,dy)
|
||||||
|
else
|
||||||
|
WIDGET.cursorMove(x,y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function _triggerMouseDown(x,y,k)
|
||||||
|
if devMode==1 then
|
||||||
|
print(("(%d,%d)<-%d,%d ~~(%d,%d)<-%d,%d"):format(
|
||||||
|
x,y,
|
||||||
|
x-lastX,y-lastY,
|
||||||
|
math.floor(x/10)*10,math.floor(y/10)*10,
|
||||||
|
math.floor((x-lastX)/10)*10,math.floor((y-lastY)/10)*10
|
||||||
|
))
|
||||||
|
end
|
||||||
|
if SCN.swapping then return end
|
||||||
|
if SCN.mouseDown then SCN.mouseDown(x,y,k)end
|
||||||
|
WIDGET.press(x,y,k)
|
||||||
|
lastX,lastY=x,y
|
||||||
|
if SETTING.clickFX then SYSFX.newTap(3,x,y)end
|
||||||
|
end
|
||||||
|
local function _mouse_update(dt)
|
||||||
|
if not KBisDown('lctrl','rctrl')and KBisDown('up','down','left','right')then
|
||||||
|
local dx,dy=0,0
|
||||||
|
if KBisDown('up')then dy=dy-cursorSpd end
|
||||||
|
if KBisDown('down')then dy=dy+cursorSpd end
|
||||||
|
if KBisDown('left')then dx=dx-cursorSpd end
|
||||||
|
if KBisDown('right')then dx=dx+cursorSpd end
|
||||||
|
mx=max(min(mx+dx,1280),0)
|
||||||
|
my=max(min(my+dy,720),0)
|
||||||
|
if my==0 or my==720 then
|
||||||
|
WIDGET.sel=false
|
||||||
|
WIDGET.drag(0,0,0,-dy)
|
||||||
|
end
|
||||||
|
_updateMousePos(mx,my,dx,dy)
|
||||||
|
cursorSpd=min(cursorSpd+dt*26,12.6)
|
||||||
|
else
|
||||||
|
cursorSpd=6
|
||||||
|
end
|
||||||
|
end
|
||||||
function love.mousepressed(x,y,k,touch)
|
function love.mousepressed(x,y,k,touch)
|
||||||
if touch then return end
|
if touch then return end
|
||||||
mouseShow=true
|
mouseShow=true
|
||||||
mx,my=ITP(xOy,x,y)
|
mx,my=ITP(xOy,x,y)
|
||||||
if devMode==1 then
|
_triggerMouseDown(mx,my,k)
|
||||||
print(("(%d,%d)<-%d,%d ~~(%d,%d)<-%d,%d"):format(
|
|
||||||
mx,my,
|
|
||||||
mx-lastX,my-lastY,
|
|
||||||
math.floor(mx/10)*10,math.floor(my/10)*10,
|
|
||||||
math.floor((mx-lastX)/10)*10,math.floor((my-lastY)/10)*10
|
|
||||||
))
|
|
||||||
end
|
|
||||||
if SCN.swapping then return end
|
|
||||||
if SCN.mouseDown then SCN.mouseDown(mx,my,k)end
|
|
||||||
WIDGET.press(mx,my,k)
|
|
||||||
lastX,lastY=mx,my
|
|
||||||
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
|
||||||
end
|
end
|
||||||
function love.mousemoved(x,y,dx,dy,touch)
|
function love.mousemoved(x,y,dx,dy,touch)
|
||||||
if touch then return end
|
if touch then return end
|
||||||
mouseShow=true
|
mouseShow=true
|
||||||
mx,my=ITP(xOy,x,y)
|
mx,my=ITP(xOy,x,y)
|
||||||
if SCN.swapping then return end
|
_updateMousePos(mx,my,dx,dy)
|
||||||
dx,dy=dx/SCR.k,dy/SCR.k
|
|
||||||
if SCN.mouseMove then SCN.mouseMove(mx,my,dx,dy)end
|
|
||||||
if ms.isDown(1)then
|
|
||||||
WIDGET.drag(mx,my,dx/SCR.k,dy/SCR.k)
|
|
||||||
else
|
|
||||||
WIDGET.cursorMove(mx,my)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function love.mousereleased(x,y,k,touch)
|
function love.mousereleased(x,y,k,touch)
|
||||||
if touch or SCN.swapping then return end
|
if touch or SCN.swapping then return end
|
||||||
@@ -264,14 +292,26 @@ function love.keypressed(key,_,isRep)
|
|||||||
applyFullscreen()
|
applyFullscreen()
|
||||||
saveSettings()
|
saveSettings()
|
||||||
elseif not SCN.swapping then
|
elseif not SCN.swapping then
|
||||||
if SCN.keyDown then
|
if EDITING==""and(not SCN.keyDown or SCN.keyDown(key,isRep))then
|
||||||
if EDITING==""then
|
local W=WIDGET.sel
|
||||||
SCN.keyDown(key,isRep)
|
if key=='escape'and not isRep then
|
||||||
|
SCN.back()
|
||||||
|
elseif key=='up'or key=='down'or key=='left'or key=='right'then
|
||||||
|
mouseShow=true
|
||||||
|
if KBisDown('lctrl','rctrl')then
|
||||||
|
if W and W.arrowKey then W:arrowKey(key)end
|
||||||
|
end
|
||||||
|
elseif key=='space'or key=='return'then
|
||||||
|
mouseShow=true
|
||||||
|
if not isRep then
|
||||||
|
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
||||||
|
_triggerMouseDown(mx,my,1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if W and W.keypress then
|
||||||
|
W:keypress(key)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif key=='escape'and not isRep then
|
|
||||||
SCN.back()
|
|
||||||
else
|
|
||||||
WIDGET.keyPressed(key,isRep)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -367,13 +407,36 @@ function love.gamepadaxis(JS,axis,val)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function love.gamepadpressed(_,i)
|
function love.gamepadpressed(_,key)
|
||||||
mouseShow=false
|
mouseShow=false
|
||||||
if SCN.swapping then return end
|
if not SCN.swapping then
|
||||||
if SCN.gamepadDown then SCN.gamepadDown(i)
|
local cursorCtrl
|
||||||
elseif SCN.keyDown then SCN.keyDown(dPadToKey[i]or i)
|
if SCN.gamepadDown then
|
||||||
elseif i=="back"then SCN.back()
|
cursorCtrl=SCN.gamepadDown(key)
|
||||||
else WIDGET.gamepadPressed(dPadToKey[i]or i)
|
elseif SCN.keyDown then
|
||||||
|
cursorCtrl=SCN.keyDown(dPadToKey[key]or key)
|
||||||
|
else
|
||||||
|
cursorCtrl=true
|
||||||
|
end
|
||||||
|
if cursorCtrl then
|
||||||
|
key=dPadToKey[key]or key
|
||||||
|
mouseShow=true
|
||||||
|
local W=WIDGET.sel
|
||||||
|
if key=='back'then
|
||||||
|
SCN.back()
|
||||||
|
elseif key=='up'or key=='down'or key=='left'or key=='right'then
|
||||||
|
mouseShow=true
|
||||||
|
if W and W.arrowKey then W:arrowKey(key)end
|
||||||
|
elseif key=='return'then
|
||||||
|
mouseShow=true
|
||||||
|
if SETTING.clickFX then SYSFX.newTap(3,mx,my)end
|
||||||
|
_triggerMouseDown(mx,my,1)
|
||||||
|
else
|
||||||
|
if W and W.keypress then
|
||||||
|
W:keypress(key)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function love.gamepadreleased(_,i)
|
function love.gamepadreleased(_,i)
|
||||||
@@ -513,7 +576,7 @@ local devColor={
|
|||||||
}
|
}
|
||||||
local WS=WS
|
local WS=WS
|
||||||
local WSnames={'app','user','play','stream','chat','manage'}
|
local WSnames={'app','user','play','stream','chat','manage'}
|
||||||
local wsBottomImage do
|
local wsImg={}do
|
||||||
local L={78,18,
|
local L={78,18,
|
||||||
{'clear',1,1,1,0},
|
{'clear',1,1,1,0},
|
||||||
{'setCL',1,1,1,.3},
|
{'setCL',1,1,1,.3},
|
||||||
@@ -523,23 +586,23 @@ local wsBottomImage do
|
|||||||
table.insert(L,{'setCL',1,1,1,i*.005})
|
table.insert(L,{'setCL',1,1,1,i*.005})
|
||||||
table.insert(L,{'fRect',i,0,1,18})
|
table.insert(L,{'fRect',i,0,1,18})
|
||||||
end
|
end
|
||||||
wsBottomImage=GC.DO(L)
|
wsImg.bottom=GC.DO(L)
|
||||||
|
wsImg.dead=GC.DO{20,20,
|
||||||
|
{'rawFT',20},
|
||||||
|
{'setCL',1,.3,.3},
|
||||||
|
{'mText',"X",11,-1},
|
||||||
|
}
|
||||||
|
wsImg.connecting=GC.DO{20,20,
|
||||||
|
{'rawFT',20},
|
||||||
|
{'setLW',3},
|
||||||
|
{'mText',"C",11,-1},
|
||||||
|
}
|
||||||
|
wsImg.running=GC.DO{20,20,
|
||||||
|
{'rawFT',20},
|
||||||
|
{'setCL',.5,1,0},
|
||||||
|
{'mText',"R",11,-1},
|
||||||
|
}
|
||||||
end
|
end
|
||||||
local ws_deadImg=GC.DO{20,20,
|
|
||||||
{'rawFT',20},
|
|
||||||
{'setCL',1,.3,.3},
|
|
||||||
{'mText',"X",11,-1},
|
|
||||||
}
|
|
||||||
local ws_connectingImg=GC.DO{20,20,
|
|
||||||
{'rawFT',20},
|
|
||||||
{'setLW',3},
|
|
||||||
{'mText',"C",11,-1},
|
|
||||||
}
|
|
||||||
local ws_runningImg=GC.DO{20,20,
|
|
||||||
{'rawFT',20},
|
|
||||||
{'setCL',.5,1,0},
|
|
||||||
{'mText',"R",11,-1},
|
|
||||||
}
|
|
||||||
|
|
||||||
local function drawCursor(_,x,y)
|
local function drawCursor(_,x,y)
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
@@ -559,7 +622,7 @@ function love.run()
|
|||||||
local TASK_update=TASK.update
|
local TASK_update=TASK.update
|
||||||
local SYSFX_update,SYSFX_draw=SYSFX.update,SYSFX.draw
|
local SYSFX_update,SYSFX_draw=SYSFX.update,SYSFX.draw
|
||||||
local WIDGET_update,WIDGET_draw=WIDGET.update,WIDGET.draw
|
local WIDGET_update,WIDGET_draw=WIDGET.update,WIDGET.draw
|
||||||
|
local VOC_update,BG_update=VOC.update,BG.update
|
||||||
local STEP,WAIT=love.timer.step,love.timer.sleep
|
local STEP,WAIT=love.timer.step,love.timer.sleep
|
||||||
local FPS,MINI=love.timer.getFPS,love.window.isMinimized
|
local FPS,MINI=love.timer.getFPS,love.window.isMinimized
|
||||||
local PUMP,POLL=love.event.pump,love.event.poll
|
local PUMP,POLL=love.event.pump,love.event.poll
|
||||||
@@ -598,8 +661,9 @@ function love.run()
|
|||||||
|
|
||||||
--UPDATE
|
--UPDATE
|
||||||
STEP()
|
STEP()
|
||||||
VOC.update()
|
if mouseShow then _mouse_update(dt)end
|
||||||
BG.update(dt)
|
VOC_update()
|
||||||
|
BG_update(dt)
|
||||||
TEXT_update(dt)
|
TEXT_update(dt)
|
||||||
MES_update(dt)
|
MES_update(dt)
|
||||||
WS_update(dt)
|
WS_update(dt)
|
||||||
@@ -689,14 +753,14 @@ function love.run()
|
|||||||
for i=1,6 do
|
for i=1,6 do
|
||||||
local status=WS.status(WSnames[i])
|
local status=WS.status(WSnames[i])
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
gc.draw(wsBottomImage,-79,20*i-139)
|
gc.draw(wsImg.bottom,-79,20*i-139)
|
||||||
if status=='dead'then
|
if status=='dead'then
|
||||||
gc_draw(ws_deadImg,-20,20*i-140)
|
gc_draw(wsImg.dead,-20,20*i-140)
|
||||||
elseif status=='connecting'then
|
elseif status=='connecting'then
|
||||||
gc_setColor(1,1,1,.5+.3*math.sin(time*6.26))
|
gc_setColor(1,1,1,.5+.3*math.sin(time*6.26))
|
||||||
gc_draw(ws_connectingImg,-20,20*i-140)
|
gc_draw(wsImg.connecting,-20,20*i-140)
|
||||||
elseif status=='running'then
|
elseif status=='running'then
|
||||||
gc_draw(ws_runningImg,-20,20*i-140)
|
gc_draw(wsImg.running,-20,20*i-140)
|
||||||
end
|
end
|
||||||
local t1,t2,t3=WS.getTimers(WSnames[i])
|
local t1,t2,t3=WS.getTimers(WSnames[i])
|
||||||
gc_setColor(.9,.9,.9,t1)gc.rectangle('fill',-60,20*i-122,-16,-16)
|
gc_setColor(.9,.9,.9,t1)gc.rectangle('fill',-60,20*i-122,-16,-16)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ local kb=love.keyboard
|
|||||||
local timer=love.timer.getTime
|
local timer=love.timer.getTime
|
||||||
|
|
||||||
local next=next
|
local next=next
|
||||||
local int,ceil,abs=math.floor,math.ceil,math.abs
|
local int,ceil=math.floor,math.ceil
|
||||||
local max,min=math.max,math.min
|
local max,min=math.max,math.min
|
||||||
local sub,ins,rem=string.sub,table.insert,table.remove
|
local sub,ins,rem=string.sub,table.insert,table.remove
|
||||||
local mDraw,mDraw_X,mDraw_Y=GC.draw,GC.simpX,GC.simpY
|
local mDraw,mDraw_X,mDraw_Y=GC.draw,GC.simpX,GC.simpY
|
||||||
@@ -1380,59 +1380,6 @@ function WIDGET.release(x,y)
|
|||||||
W:release(x,y+WIDGET.scrollPos)
|
W:release(x,y+WIDGET.scrollPos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.keyPressed(k,isRep)
|
|
||||||
local W=WIDGET.sel
|
|
||||||
if k=='space'or k=='return'then
|
|
||||||
if not isRep then
|
|
||||||
WIDGET.press()
|
|
||||||
end
|
|
||||||
elseif k=='up'or k=='down'or k=='left'or k=='right'then
|
|
||||||
if kb.isDown('lshift','lalt','lctrl','rshift','ralt','rctrl')then
|
|
||||||
--Control some widgets with arrowkeys when hold shift/ctrl/alt
|
|
||||||
if W and W.arrowKey then W:arrowKey(k)end
|
|
||||||
else
|
|
||||||
if not W then
|
|
||||||
for _,w in next,WIDGET.active do
|
|
||||||
if not w.hide and w.isAbove then
|
|
||||||
WIDGET.focus(w)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif W.getCenter then
|
|
||||||
local WX,WY=W:getCenter()
|
|
||||||
local dir=(k=='right'or k=='down')and 1 or -1
|
|
||||||
local tar
|
|
||||||
local minDist=1e99
|
|
||||||
local swap_xy=k=='up'or k=='down'
|
|
||||||
if swap_xy then WX,WY=WY,WX end--note that we do not swap them back later
|
|
||||||
for _,W1 in ipairs(WIDGET.active)do
|
|
||||||
if W~=W1 and W1.resCtr and not W1.hide then
|
|
||||||
local L=W1.resCtr
|
|
||||||
for j=1,#L,2 do
|
|
||||||
local x,y=L[j],L[j+1]
|
|
||||||
if swap_xy then x,y=y,x end--note that we do not swap them back later
|
|
||||||
local dist=(x-WX)*dir
|
|
||||||
if dist>10 then
|
|
||||||
dist=dist+abs(y-WY)*6.26
|
|
||||||
if dist<minDist then
|
|
||||||
minDist=dist
|
|
||||||
tar=W1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if tar then
|
|
||||||
WIDGET.focus(tar)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if W and W.keypress then
|
|
||||||
W:keypress(k)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function WIDGET.textinput(texts)
|
function WIDGET.textinput(texts)
|
||||||
local W=WIDGET.sel
|
local W=WIDGET.sel
|
||||||
if W and W.type=='inputBox'then
|
if W and W.type=='inputBox'then
|
||||||
@@ -1444,37 +1391,6 @@ function WIDGET.textinput(texts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local keyMirror={
|
|
||||||
dpup='up',
|
|
||||||
dpdown='down',
|
|
||||||
dpleft='left',
|
|
||||||
dpright='right',
|
|
||||||
start='return',
|
|
||||||
back='escape',
|
|
||||||
}
|
|
||||||
function WIDGET.gamepadPressed(i)
|
|
||||||
if i=='start'then
|
|
||||||
WIDGET.press()
|
|
||||||
elseif i=='a'or i=='b'then
|
|
||||||
local W=WIDGET.sel
|
|
||||||
if W then
|
|
||||||
if W.type=='button'or W.type=='key'then
|
|
||||||
WIDGET.press()
|
|
||||||
elseif W.type=='slider'then
|
|
||||||
local p=W.disp()
|
|
||||||
local P=i=='left'and(p>0 and p-1)or p<W.unit and p+1
|
|
||||||
if p==P or not P then return end
|
|
||||||
W.code(P)
|
|
||||||
if W.change and timer()-W.lastTime>.18 then
|
|
||||||
W.lastTime=timer()
|
|
||||||
W.change()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif i=='dpup'or i=='dpdown'or i=='dpleft'or i=='dpright'then
|
|
||||||
WIDGET.keyPressed(keyMirror[i])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function WIDGET.update(dt)
|
function WIDGET.update(dt)
|
||||||
for _,W in next,WIDGET.active do
|
for _,W in next,WIDGET.active do
|
||||||
|
|||||||
@@ -541,13 +541,13 @@ return{
|
|||||||
any="Erase",
|
any="Erase",
|
||||||
smart="Smart",
|
smart="Smart",
|
||||||
|
|
||||||
push="Add Line(K)",
|
push="Add Line (K)",
|
||||||
del="Del Line(L)",
|
del="Del Line (L)",
|
||||||
|
|
||||||
demo="Don't Show ×",
|
demo="Don't Show ×",
|
||||||
|
|
||||||
newPg="New Page(N)",
|
newPg="New Page (N)",
|
||||||
delPg="Del Page(M)",
|
delPg="Del Page (M)",
|
||||||
prevPg="Prev Page",
|
prevPg="Prev Page",
|
||||||
nextPg="Next Page",
|
nextPg="Next Page",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ return{
|
|||||||
mod="Mods (F1)",
|
mod="Mods (F1)",
|
||||||
field="Modifier la matrice (F)",
|
field="Modifier la matrice (F)",
|
||||||
sequence="Modifier la séquence (S)",
|
sequence="Modifier la séquence (S)",
|
||||||
mission="Modifier la mission(M)",
|
mission="Modifier la mission (M)",
|
||||||
|
|
||||||
-- eventSet="Rule Set",
|
-- eventSet="Rule Set",
|
||||||
|
|
||||||
@@ -512,8 +512,8 @@ return{
|
|||||||
|
|
||||||
demo="Masquer les ×",
|
demo="Masquer les ×",
|
||||||
|
|
||||||
newPg="Nouvelle Page(N)",
|
newPg="Nouvelle Page (N)",
|
||||||
delPg="Supp. Page(M)",
|
delPg="Supp. Page (M)",
|
||||||
prevPg="Page Préc.",
|
prevPg="Page Préc.",
|
||||||
nextPg="Page Suiv.",
|
nextPg="Page Suiv.",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -529,13 +529,13 @@ return{
|
|||||||
any="Apagar",
|
any="Apagar",
|
||||||
-- smart="Smart",
|
-- smart="Smart",
|
||||||
|
|
||||||
push="Add Linha(K)",
|
push="Add Linha (K)",
|
||||||
del="Del Linha(L)",
|
del="Del Linha (L)",
|
||||||
|
|
||||||
demo="Não mostrar ×",
|
demo="Não mostrar ×",
|
||||||
|
|
||||||
newPg="Nova Página(N)",
|
newPg="Nova Página (N)",
|
||||||
delPg="Del Página(M)",
|
delPg="Del Página (M)",
|
||||||
prevPg="Página Ant.",
|
prevPg="Página Ant.",
|
||||||
nextPg="Prox. Página",
|
nextPg="Prox. Página",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ end
|
|||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if key=='escape'then
|
if key=='space'then
|
||||||
SCN.back()
|
|
||||||
elseif key=='space'then
|
|
||||||
loadGame('stack_e',true)
|
loadGame('stack_e',true)
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ scene.widgetList={
|
|||||||
WIDGET.newKey{name='7',x=540,y=320,w=90,font=60,fText="7",code=pressKey'7'},
|
WIDGET.newKey{name='7',x=540,y=320,w=90,font=60,fText="7",code=pressKey'7'},
|
||||||
WIDGET.newKey{name='8',x=640,y=320,w=90,font=60,fText="8",code=pressKey'8'},
|
WIDGET.newKey{name='8',x=640,y=320,w=90,font=60,fText="8",code=pressKey'8'},
|
||||||
WIDGET.newKey{name='9',x=740,y=320,w=90,font=60,fText="9",code=pressKey'9'},
|
WIDGET.newKey{name='9',x=740,y=320,w=90,font=60,fText="9",code=pressKey'9'},
|
||||||
WIDGET.newButton{name='back',x=1200,y=660,w=110,h=60,font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
WIDGET.newButton{name='back',x=1200,y=660,w=110,h=60,font=60,fText=CHAR.icon.back,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ local ins,rem=table.insert,table.remove
|
|||||||
local C=COLOR
|
local C=COLOR
|
||||||
|
|
||||||
local inputBox=WIDGET.newInputBox{name='input',x=40,y=650,w=1200,h=50,fType='mono'}
|
local inputBox=WIDGET.newInputBox{name='input',x=40,y=650,w=1200,h=50,fType='mono'}
|
||||||
local outputBox=WIDGET.newTextBox{name='output',x=40,y=30,w=1200,h=610,font=25,fType='mono',lineH=25,fix=true}
|
local outputBox=WIDGET.newTextBox{name='output',x=40,y=30,w=1200,h=610,font=25,fType='mono',lineH=23,fix=true}
|
||||||
|
|
||||||
local function log(str)outputBox:push(str)end
|
local function log(str)outputBox:push(str)end
|
||||||
log{C.lP,"Techmino Console"}
|
log{C.lP,"Techmino Console"}
|
||||||
@@ -1088,8 +1088,8 @@ function scene.keyDown(key)
|
|||||||
end
|
end
|
||||||
elseif key=='scrollup'then outputBox:scroll(-5)
|
elseif key=='scrollup'then outputBox:scroll(-5)
|
||||||
elseif key=='scrolldown'then outputBox:scroll(5)
|
elseif key=='scrolldown'then outputBox:scroll(5)
|
||||||
elseif key=='pageup'then outputBox:scroll(-20)
|
elseif key=='pageup'then outputBox:scroll(-25)
|
||||||
elseif key=='pagedown'then outputBox:scroll(20)
|
elseif key=='pagedown'then outputBox:scroll(25)
|
||||||
elseif key=='home'then outputBox:scroll(-1e99)
|
elseif key=='home'then outputBox:scroll(-1e99)
|
||||||
elseif key=='end'then outputBox:scroll(1e99)
|
elseif key=='end'then outputBox:scroll(1e99)
|
||||||
elseif combKey[key]and kb.isDown('lctrl','rctrl')then combKey[key]()
|
elseif combKey[key]and kb.isDown('lctrl','rctrl')then combKey[key]()
|
||||||
@@ -1103,7 +1103,7 @@ function scene.keyDown(key)
|
|||||||
if not WIDGET.isFocus(inputBox)then
|
if not WIDGET.isFocus(inputBox)then
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
end
|
end
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newButton{name='back',x=1140,y=60,w=170,h=80,font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
WIDGET.newButton{name='back',x=1140,y=60,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newKey{name='back',x=1140,y=60,w=170,h=80,color='D',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
WIDGET.newKey{name='back',x=1140,y=60,w=170,h=80,color='D',font=60,fText=CHAR.icon.back,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
|
|||||||
@@ -32,44 +32,46 @@ function scene.sceneInit()
|
|||||||
BGM.play(CUSTOMENV.bgm)
|
BGM.play(CUSTOMENV.bgm)
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
|
saveFile(CUSTOMENV,'conf/customEnv')
|
||||||
BGM.play()
|
BGM.play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key,isRep)
|
local function _play(mode)
|
||||||
if isRep then return end
|
if CUSTOMENV.opponent~="X"then
|
||||||
if key=='return'or key=='return2'then
|
if CUSTOMENV.opponent:sub(1,2)=='CC'then
|
||||||
if CUSTOMENV.opponent~="X"then
|
if CUSTOMENV.sequence=='fixed'then
|
||||||
if CUSTOMENV.opponent:sub(1,2)=='CC'then
|
MES.new('error',text.cc_fixed)
|
||||||
if CUSTOMENV.sequence=='fixed'then
|
return
|
||||||
MES.new('error',text.cc_fixed)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if CUSTOMENV.holdMode=='swap'then
|
|
||||||
MES.new('error',text.cc_swap)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if #BAG>0 then
|
if CUSTOMENV.holdMode=='swap'then
|
||||||
for _=1,#BAG do
|
MES.new('error',text.cc_swap)
|
||||||
if BAG[_]>7 then
|
|
||||||
MES.new('error',text.ai_prebag)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #MISSION>0 then
|
|
||||||
MES.new('error',text.ai_mission)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if key=='return2'or kb.isDown('lalt','lctrl','lshift')then
|
if #BAG>0 then
|
||||||
if #FIELD[1]>0 then
|
for _=1,#BAG do
|
||||||
saveFile(CUSTOMENV,'conf/customEnv')
|
if BAG[_]>7 then
|
||||||
loadGame('custom_puzzle',true)
|
MES.new('error',text.ai_prebag)
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
end
|
||||||
saveFile(CUSTOMENV,'conf/customEnv')
|
if #MISSION>0 then
|
||||||
loadGame('custom_clear',true)
|
MES.new('error',text.ai_mission)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
saveFile(CUSTOMENV,'conf/customEnv')
|
||||||
|
loadGame('custom_'..mode,true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function scene.keyDown(key,isRep)
|
||||||
|
if isRep then return true end
|
||||||
|
if key=='return'and kb.isDown('lctrl','lalt')then
|
||||||
|
if kb.isDown('lalt')and #FIELD[1]>0 then
|
||||||
|
_play('puzzle')
|
||||||
|
elseif kb.isDown('lctrl')then
|
||||||
|
_play('clear')
|
||||||
end
|
end
|
||||||
elseif key=='f'then
|
elseif key=='f'then
|
||||||
SCN.go('custom_field','swipeD')
|
SCN.go('custom_field','swipeD')
|
||||||
@@ -122,11 +124,8 @@ function scene.keyDown(key,isRep)
|
|||||||
MES.new('check',text.importSuccess)
|
MES.new('check',text.importSuccess)
|
||||||
do return end
|
do return end
|
||||||
::THROW_fail::MES.new('error',text.dataCorrupted)
|
::THROW_fail::MES.new('error',text.dataCorrupted)
|
||||||
elseif key=='escape'then
|
|
||||||
saveFile(CUSTOMENV,'conf/customEnv')
|
|
||||||
SCN.back()
|
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -124,8 +124,6 @@ function scene.keyDown(key)
|
|||||||
inputBox:clear()
|
inputBox:clear()
|
||||||
SFX.play('hold')
|
SFX.play('hold')
|
||||||
end
|
end
|
||||||
elseif key=='backspace'then
|
|
||||||
WIDGET.keyPressed("backspace")
|
|
||||||
elseif key=='escape'then
|
elseif key=='escape'then
|
||||||
if inputBox:hasText()then
|
if inputBox:hasText()then
|
||||||
scene.keyDown('delete')
|
scene.keyDown('delete')
|
||||||
@@ -143,7 +141,7 @@ function scene.keyDown(key)
|
|||||||
if not WIDGET.isFocus(inputBox)then
|
if not WIDGET.isFocus(inputBox)then
|
||||||
WIDGET.focus(inputBox)
|
WIDGET.focus(inputBox)
|
||||||
end
|
end
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -46,76 +46,9 @@ function scene.mouseDown(x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
local function _testButton(n)
|
|
||||||
if NET.getlock('access_and_login')then
|
|
||||||
MES.new('warn',text.wsConnecting)
|
|
||||||
else
|
|
||||||
if WIDGET.isFocus(scene.widgetList[n])then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
WIDGET.focus(scene.widgetList[n])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function scene.keyDown(key,isRep)
|
function scene.keyDown(key,isRep)
|
||||||
if isRep then return end
|
if isRep then return true end
|
||||||
if key=='1'then
|
if key=='escape'then
|
||||||
if _testButton(1)then
|
|
||||||
SCN.go('mode')
|
|
||||||
end
|
|
||||||
elseif key=='q'then
|
|
||||||
if _testButton(2)then
|
|
||||||
loadGame(STAT.lastPlay,true)
|
|
||||||
end
|
|
||||||
elseif key=='a'then
|
|
||||||
if _testButton(3)then
|
|
||||||
if WS.status('app')=='running'then
|
|
||||||
NET.tryLogin(false)
|
|
||||||
elseif WS.status('app')=='dead'then
|
|
||||||
NET.wsconn_app()
|
|
||||||
SFX.play('connect')
|
|
||||||
MES.new('info',text.wsConnecting)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
elseif key=='z'then
|
|
||||||
if _testButton(4)then
|
|
||||||
SCN.go('customGame')
|
|
||||||
end
|
|
||||||
elseif key=='-'then
|
|
||||||
if _testButton(5)then
|
|
||||||
SCN.go('setting_game')
|
|
||||||
end
|
|
||||||
elseif key=='p'then
|
|
||||||
if _testButton(6)then
|
|
||||||
SCN.go('stat')
|
|
||||||
end
|
|
||||||
elseif key=='l'then
|
|
||||||
if _testButton(7)then
|
|
||||||
SCN.go('dict')
|
|
||||||
end
|
|
||||||
elseif key==','then
|
|
||||||
if _testButton(8)then
|
|
||||||
SCN.go('replays')
|
|
||||||
end
|
|
||||||
elseif key=='2'then
|
|
||||||
if _testButton(9)then
|
|
||||||
SCN.go('music')
|
|
||||||
end
|
|
||||||
elseif key=='3'then
|
|
||||||
if _testButton(10)then
|
|
||||||
SCN.go('lang')
|
|
||||||
end
|
|
||||||
elseif key=='x'then
|
|
||||||
if _testButton(11)then
|
|
||||||
SCN.go('about')
|
|
||||||
end
|
|
||||||
elseif key=='m'then
|
|
||||||
if _testButton(12)then
|
|
||||||
SCN.go('manual')
|
|
||||||
end
|
|
||||||
elseif key=='c'then
|
|
||||||
enterConsole()
|
|
||||||
elseif key=='escape'then
|
|
||||||
if TIME()-lastQuitTime<1 then
|
if TIME()-lastQuitTime<1 then
|
||||||
VOC.play('bye')
|
VOC.play('bye')
|
||||||
SCN.swapTo('quit','slowFade')
|
SCN.swapTo('quit','slowFade')
|
||||||
@@ -123,6 +56,10 @@ function scene.keyDown(key,isRep)
|
|||||||
lastQuitTime=TIME()
|
lastQuitTime=TIME()
|
||||||
MES.new('warn',text.sureQuit)
|
MES.new('warn',text.sureQuit)
|
||||||
end
|
end
|
||||||
|
elseif key=='c'then
|
||||||
|
enterConsole()
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -183,21 +120,36 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function notConn()
|
||||||
|
if NET.getlock('access_and_login')then
|
||||||
|
MES.new('warn',text.wsConnecting)
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newButton{name='offline',x=-1200,y=210,w=800,h=100,color='lR',font=45,align='R',edge=30,code=pressKey'1'},
|
WIDGET.newButton{name='offline',x=-1200,y=210,w=800,h=100,color='lR',font=45,align='R',edge=30,code=function()if notConn()then SCN.go('mode')end end},
|
||||||
WIDGET.newButton{name='qplay', x=-1200,y=330,w=800,h=100,color='lM',font=40,align='R',edge=30,code=pressKey'q'},
|
WIDGET.newButton{name='qplay', x=-1200,y=330,w=800,h=100,color='lM',font=40,align='R',edge=30,code=function()loadGame(STAT.lastPlay,true)end},
|
||||||
WIDGET.newButton{name='online', x=-1200,y=450,w=800,h=100,color='lV',font=45,align='R',edge=30,code=pressKey'a'},
|
WIDGET.newButton{name='online', x=-1200,y=450,w=800,h=100,color='lV',font=45,align='R',edge=30,code=function()
|
||||||
WIDGET.newButton{name='custom', x=-1200,y=570,w=800,h=100,color='lS',font=45,align='R',edge=30,code=pressKey'z'},
|
if WS.status('app')=='running'then
|
||||||
|
NET.tryLogin(false)
|
||||||
|
elseif WS.status('app')=='dead'then
|
||||||
|
NET.wsconn_app()
|
||||||
|
SFX.play('connect')
|
||||||
|
MES.new('info',text.wsConnecting)
|
||||||
|
end
|
||||||
|
end},
|
||||||
|
WIDGET.newButton{name='custom', x=-1200,y=570,w=800,h=100,color='lS',font=45,align='R',edge=30,code=function()if notConn()then SCN.go('customGame')end end},
|
||||||
|
|
||||||
WIDGET.newButton{name='setting',x=2480,y=210,w=800,h=100, color='lO',font=40,align='L',edge=30,code=pressKey'-'},
|
WIDGET.newButton{name='setting',x=2480,y=210,w=800,h=100, color='lO',font=40,align='L',edge=30,code=function()if notConn()then SCN.go('setting_game')end end},
|
||||||
WIDGET.newButton{name='stat', x=2480,y=330,w=800,h=100, color='lL',font=40,align='L',edge=30,code=pressKey'p'},
|
WIDGET.newButton{name='stat', x=2480,y=330,w=800,h=100, color='lL',font=40,align='L',edge=30,code=function()if notConn()then SCN.go('stat')end end},
|
||||||
WIDGET.newButton{name='dict', x=2480,y=450,w=800,h=100, color='lG',font=40,align='L',edge=30,code=pressKey'l'},
|
WIDGET.newButton{name='dict', x=2480,y=450,w=800,h=100, color='lG',font=40,align='L',edge=30,code=function()if notConn()then SCN.go('dict')end end},
|
||||||
WIDGET.newButton{name='replays',x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=pressKey','},
|
WIDGET.newButton{name='replays',x=2480,y=570,w=800,h=100, color='lC',font=40,align='L',edge=30,code=function()if notConn()then SCN.go('replays')end end},
|
||||||
|
|
||||||
WIDGET.newButton{name='music', x=120,y=80,w=100, color='lO',code=pressKey'2',font=70,fText=CHAR.icon.music},
|
WIDGET.newButton{name='music', x=120,y=80,w=100, color='lO',code=function()if notConn()then SCN.go('music')end end,font=70,fText=CHAR.icon.music},
|
||||||
WIDGET.newButton{name='lang', x=280,y=80,w=100, color='lN',code=pressKey'3',font=70,fText=CHAR.icon.language},
|
WIDGET.newButton{name='lang', x=280,y=80,w=100, color='lN',code=function()if notConn()then SCN.go('lang')end end,font=70,fText=CHAR.icon.language},
|
||||||
WIDGET.newButton{name='about', x=-110,y=670,w=600,h=70, color='lB',align='R',edge=20,code=pressKey'x',font=50,fText=CHAR.icon.info},
|
WIDGET.newButton{name='about', x=-110,y=670,w=600,h=70, color='lB',align='R',edge=20,code=function()if notConn()then SCN.go('about')end end,font=50,fText=CHAR.icon.info},
|
||||||
WIDGET.newButton{name='manual', x=1390,y=670,w=600,h=70, color='lR',align='L',edge=20,code=pressKey'm',font=50,fText=CHAR.icon.help},
|
WIDGET.newButton{name='manual', x=1390,y=670,w=600,h=70, color='lR',align='L',edge=20,code=function()if notConn()then SCN.go('manual')end end,font=50,fText=CHAR.icon.help},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
|
|||||||
@@ -53,16 +53,6 @@ function scene.sceneBack()
|
|||||||
BGM.play()
|
BGM.play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
|
||||||
if key=='return'then
|
|
||||||
_createRoom()
|
|
||||||
elseif key=='escape'then
|
|
||||||
SCN.back()
|
|
||||||
else
|
|
||||||
WIDGET.keyPressed(key)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
scene.widgetScrollHeight=400
|
scene.widgetScrollHeight=400
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newText{name='title',x=40,y=15,font=70,align='L'},
|
WIDGET.newText{name='title',x=40,y=15,font=70,align='L'},
|
||||||
@@ -95,7 +85,7 @@ scene.widgetList={
|
|||||||
|
|
||||||
--Capacity & Create & Back
|
--Capacity & Create & Back
|
||||||
WIDGET.newSelector{name='capacity', x=1070,y=330,w=310,color='lY',list={2,3,4,5,7,10,17,31,49,99},disp=ROOMval('capacity'),code=ROOMsto('capacity')},
|
WIDGET.newSelector{name='capacity', x=1070,y=330,w=310,color='lY',list={2,3,4,5,7,10,17,31,49,99},disp=ROOMval('capacity'),code=ROOMsto('capacity')},
|
||||||
WIDGET.newButton{name='create', x=1070,y=480,w=310,h=140,color='lN',font=40,code=pressKey'return'},
|
WIDGET.newButton{name='create', x=1070,y=480,w=310,h=140,color='lN',font=40,code=_createRoom},
|
||||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
|
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
|
||||||
|
|
||||||
--Special rules
|
--Special rules
|
||||||
|
|||||||
@@ -61,31 +61,21 @@ function scene.sceneInit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if NET.getlock('enterRoom')then return end
|
if NET.getlock('enterRoom')then return true end
|
||||||
if WIDGET.sel~=passwordBox then
|
if key=='r'then
|
||||||
if key=='r'then
|
if fetchTimer<=7 then
|
||||||
if fetchTimer<=7 then
|
_fetchRoom()
|
||||||
_fetchRoom()
|
end
|
||||||
end
|
elseif roomList:getLen()>0 and(key=='join'or key=='return'and love.keyboard.isDown('lctrl','rctrl'))then
|
||||||
elseif key=='s'then
|
local R=roomList:getSel()
|
||||||
SCN.go('setting_game')
|
if NET.getlock('fetchRoom')or not R then return end
|
||||||
elseif key=='n'then
|
if R.roomInfo.version==VERSION.room then
|
||||||
SCN.go('net_newRoom')
|
NET.enterRoom(R,passwordBox.value)
|
||||||
elseif key=='escape'then
|
|
||||||
SCN.back()
|
|
||||||
elseif roomList:getLen()>0 and key=='return'then
|
|
||||||
local R=roomList:getSel()
|
|
||||||
if NET.getlock('fetchRoom')or not R then return end
|
|
||||||
if R.roomInfo.version==VERSION.room then
|
|
||||||
NET.enterRoom(R,passwordBox.value)
|
|
||||||
else
|
|
||||||
MES.new('error',text.versionNotMatch)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
MES.new('error',text.versionNotMatch)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -144,12 +134,12 @@ end
|
|||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
roomList,
|
roomList,
|
||||||
passwordBox,
|
passwordBox,
|
||||||
WIDGET.newKey{name='setting', x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=pressKey's'},
|
WIDGET.newKey{name='setting', x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=goScene'setting_game'},
|
||||||
WIDGET.newText{name='refreshing',x=450,y=240,font=45,hideF=function()return not NET.getlock('fetchRoom')end},
|
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.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='new', x=510,y=630,w=260,h=120,code=goScene'net_newRoom'},
|
||||||
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.newKey{name='join', x=780,y=630,w=140,h=120,code=pressKey'join',hideF=function()return roomList:getLen()==0 or NET.getlock('enterRoom')end},
|
||||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ function scene.sceneBack()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key,isRep)
|
function scene.keyDown(key,isRep)
|
||||||
if isRep then return end
|
if isRep then return true end
|
||||||
if key=='q'then
|
if key=='q'then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
GAME.playing=false
|
GAME.playing=false
|
||||||
@@ -165,7 +165,7 @@ function scene.keyDown(key,isRep)
|
|||||||
SYSFX.newShade(1.2,555,200,620,380,.6,.6,.6)
|
SYSFX.newShade(1.2,555,200,620,380,.6,.6,.6)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -137,10 +137,8 @@ function scene.keyDown(key)
|
|||||||
MES.new('info',text.sureReset)
|
MES.new('info',text.sureReset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif key=='escape'then
|
|
||||||
SCN.back()
|
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ local forbbidenKeys={
|
|||||||
["return"]=true,
|
["return"]=true,
|
||||||
}
|
}
|
||||||
function scene.keyDown(key,isRep)
|
function scene.keyDown(key,isRep)
|
||||||
if isRep then return end
|
if isRep then return true end
|
||||||
if key=='escape'then
|
if key=='escape'then
|
||||||
if selected then
|
if selected then
|
||||||
selected=false
|
selected=false
|
||||||
@@ -57,7 +57,7 @@ function scene.keyDown(key,isRep)
|
|||||||
SFX.play('reach',.5)
|
SFX.play('reach',.5)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.gamepadDown(key)
|
function scene.gamepadDown(key)
|
||||||
@@ -80,14 +80,14 @@ function scene.gamepadDown(key)
|
|||||||
selected=false
|
selected=false
|
||||||
SFX.play('reach',.5)
|
SFX.play('reach',.5)
|
||||||
else
|
else
|
||||||
WIDGET.gamepadPressed(key)
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
setFont(20)
|
setFont(20)
|
||||||
gc.setColor(COLOR.Z)
|
gc.setColor(COLOR.Z)
|
||||||
gc.printf(text.keySettingInstruction,540,620,500,'right')
|
gc.printf(text.keySettingInstruction,526,620,500,'right')
|
||||||
|
|
||||||
for i=0,20 do
|
for i=0,20 do
|
||||||
for j=1,#keyList[i]do
|
for j=1,#keyList[i]do
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ end
|
|||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if key=='escape'then
|
if key=='space'then
|
||||||
SCN.back()
|
|
||||||
elseif key=='space'then
|
|
||||||
scene.mouseDown(942,626)
|
scene.mouseDown(942,626)
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ end
|
|||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if key=='escape'then
|
if key=='l'then
|
||||||
SCN.back()
|
|
||||||
elseif key=='l'then
|
|
||||||
loadGame('sprintLock',true)
|
loadGame('sprintLock',true)
|
||||||
elseif key=='f'then
|
elseif key=='f'then
|
||||||
loadGame('sprintFix',true)
|
loadGame('sprintFix',true)
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ function scene.mouseDown(x,y)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
scene.touchDown=scene.mouseDown
|
scene.touchDown=scene.mouseDown
|
||||||
function scene.keyDown(key)
|
function scene.keyDown()
|
||||||
if key=='escape'then
|
if love.keyboard.isDown('m')and love.keyboard.isDown('d')then
|
||||||
SCN.back()
|
|
||||||
elseif love.keyboard.isDown('m')and love.keyboard.isDown('d')then
|
|
||||||
loadGame('sprintMD',true)
|
loadGame('sprintMD',true)
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user