修复词典用不了滚轮
整理代码
This commit is contained in:
@@ -152,11 +152,10 @@ function player:click(y,x)
|
|||||||
self.board[y][x]=rem(self.nexts,1)
|
self.board[y][x]=rem(self.nexts,1)
|
||||||
SFX.play('touch')
|
SFX.play('touch')
|
||||||
|
|
||||||
local merged
|
local cur,merged
|
||||||
repeat-- ::REPEAT_merge::
|
repeat
|
||||||
local repeating
|
|
||||||
local cur=self.board[y][x]
|
|
||||||
local b1=TABLE.shift(self.board)
|
local b1=TABLE.shift(self.board)
|
||||||
|
cur=b1[y][x]
|
||||||
self.mergedTiles={}
|
self.mergedTiles={}
|
||||||
local count=self:merge(b1,cur,y,x)
|
local count=self:merge(b1,cur,y,x)
|
||||||
if count>2 then
|
if count>2 then
|
||||||
@@ -178,9 +177,8 @@ function player:click(y,x)
|
|||||||
for i=1,#self.mergedTiles do
|
for i=1,#self.mergedTiles do
|
||||||
newMergeFX(self.mergedTiles[i][1],self.mergedTiles[i][2],cur+1)
|
newMergeFX(self.mergedTiles[i][1],self.mergedTiles[i][2],cur+1)
|
||||||
end
|
end
|
||||||
repeating=true-- goto REPEAT_merge
|
|
||||||
end
|
end
|
||||||
until not repeating
|
until count<=2
|
||||||
|
|
||||||
ins(self.nexts,self:newTile())
|
ins(self.nexts,self:newTile())
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ local function _scanDict(D)
|
|||||||
end
|
end
|
||||||
local function _getList() return result[1] and result or dict end
|
local function _getList() return result[1] and result or dict end
|
||||||
|
|
||||||
local infoBox =WIDGET.newTextBox {name='infoBox',x=320,y=180,w=862,h=526,font=25,fix=true}
|
local textBox =WIDGET.newTextBox {name='infoBox',x=320,y=180,w=862,h=526,font=25,fix=true}
|
||||||
local inputBox=WIDGET.newInputBox{name='input', x=20, y=110,w=762,h=60, font=40,limit=32}
|
local inputBox=WIDGET.newInputBox{name='input', x=20, y=110,w=762,h=60, font=40,limit=32}
|
||||||
local listBox =WIDGET.newListBox {name='listBox',x=20, y=180,w=280,h=526,font=30,lineH=35,drawF=function(item,id,ifSel)
|
local listBox =WIDGET.newListBox {name='listBox',x=20, y=180,w=280,h=526,font=30,lineH=35,drawF=function(item,id,ifSel)
|
||||||
-- Background
|
-- Background
|
||||||
@@ -135,22 +135,22 @@ local function _updateInfoBox(c)
|
|||||||
_t,t=nil,nil
|
_t,t=nil,nil
|
||||||
end
|
end
|
||||||
local _w,c=FONT.get(currentFontSize):getWrap(c,840)
|
local _w,c=FONT.get(currentFontSize):getWrap(c,840)
|
||||||
infoBox:setTexts(c)
|
textBox:setTexts(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Zoom and reset zoom
|
-- Zoom and reset zoom
|
||||||
local function _resetZoom()
|
local function _resetZoom()
|
||||||
currentFontSize,infoBox.font=25,25
|
currentFontSize,textBox.font=25,25
|
||||||
infoBox.lineH,infoBox.capacity=35,math.ceil((infoBox.h-10)/35)
|
textBox.lineH,textBox.capacity=35,math.ceil((textBox.h-10)/35)
|
||||||
_updateInfoBox()
|
_updateInfoBox()
|
||||||
MES.new("check",text.dict.sizeReset,1.26)
|
MES.new("check",text.dict.sizeReset,1.26)
|
||||||
end
|
end
|
||||||
local function _setZoom(z)
|
local function _setZoom(z)
|
||||||
if z~=0 then
|
if z~=0 then
|
||||||
currentFontSize=MATH.clamp(currentFontSize+z,15,40)
|
currentFontSize=MATH.clamp(currentFontSize+z,15,40)
|
||||||
infoBox.font=currentFontSize
|
textBox.font=currentFontSize
|
||||||
infoBox.lineH=currentFontSize*7/5 -- Recalculate the line's height
|
textBox.lineH=currentFontSize*7/5 -- Recalculate the line's height
|
||||||
infoBox.capacity=math.ceil((infoBox.h-10)/infoBox.lineH)
|
textBox.capacity=math.ceil((textBox.h-10)/textBox.lineH)
|
||||||
_updateInfoBox()
|
_updateInfoBox()
|
||||||
MES.new("check",text.dict.sizeChanged:repD(currentFontSize),1.26)
|
MES.new("check",text.dict.sizeChanged:repD(currentFontSize),1.26)
|
||||||
end
|
end
|
||||||
@@ -175,12 +175,16 @@ function scene.enter()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.wheelMoved(_,y)
|
function scene.wheelMoved(_,y)
|
||||||
WHEELMOV(y)
|
if WIDGET.sel==listBox then
|
||||||
|
listBox:scroll(-y)
|
||||||
|
else
|
||||||
|
textBox:scroll(-y)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
-- Switching selected items
|
-- Switching selected items
|
||||||
if key=='up' or key=='down' then
|
if key=='up' or key=='down' then
|
||||||
listBox:scroll(key=='up' and -1 or 1)
|
textBox:scroll(key=='up' and -1 or 1)
|
||||||
|
|
||||||
elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then
|
elseif (key=='left' or key=='pageup' or key=='right' or key=='pagedown') then
|
||||||
_jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12)
|
_jumpover(key,love.keyboard.isDown('lctrl','rctrl','lalt','ralt','lshift','rshift') and 12)
|
||||||
@@ -229,7 +233,7 @@ function scene.gamepadDown(key)
|
|||||||
if Joystick:isGamepadDown('a') then
|
if Joystick:isGamepadDown('a') then
|
||||||
_setZoom(key=='dpup' and 5 or -5)
|
_setZoom(key=='dpup' and 5 or -5)
|
||||||
else
|
else
|
||||||
infoBox:scroll(key=='dpup' and -3 or 3)
|
textBox:scroll(key=='dpup' and -3 or 3)
|
||||||
end
|
end
|
||||||
elseif key=='dpleft' or key=='dpright' then
|
elseif key=='dpleft' or key=='dpright' then
|
||||||
_jumpover(key:gsub('dp',''),Joystick:isGamepadDown('a') and 12)
|
_jumpover(key:gsub('dp',''),Joystick:isGamepadDown('a') and 12)
|
||||||
@@ -294,7 +298,7 @@ scene.widgetList={
|
|||||||
WIDGET.newText {name='title', x=100, y=15, font=70,align='L'},
|
WIDGET.newText {name='title', x=100, y=15, font=70,align='L'},
|
||||||
listBox,
|
listBox,
|
||||||
inputBox,
|
inputBox,
|
||||||
infoBox,
|
textBox,
|
||||||
WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not (listBox.selected>0 and _getList()[listBox.selected].url) end},
|
WIDGET.newKey {name='link', x=1234,y=600,w=60,font=45,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not (listBox.selected>0 and _getList()[listBox.selected].url) end},
|
||||||
WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC',hideF=function() return not (listBox.selected>0) end},
|
WIDGET.newKey {name='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC',hideF=function() return not (listBox.selected>0) end},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user