From 36522c71464f01543be90f1622257e30bb6290b9 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 3 Aug 2023 16:04:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=8D=E5=85=B8=E7=94=A8?= =?UTF-8?q?=E4=B8=8D=E4=BA=86=E6=BB=9A=E8=BD=AE=20=E6=95=B4=E7=90=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_triple.lua | 10 ++++------ parts/scenes/dict.lua | 26 +++++++++++++++----------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/parts/scenes/app_triple.lua b/parts/scenes/app_triple.lua index 21fbb33f..6e3a1c4d 100644 --- a/parts/scenes/app_triple.lua +++ b/parts/scenes/app_triple.lua @@ -152,11 +152,10 @@ function player:click(y,x) self.board[y][x]=rem(self.nexts,1) SFX.play('touch') - local merged - repeat-- ::REPEAT_merge:: - local repeating - local cur=self.board[y][x] + local cur,merged + repeat local b1=TABLE.shift(self.board) + cur=b1[y][x] self.mergedTiles={} local count=self:merge(b1,cur,y,x) if count>2 then @@ -178,9 +177,8 @@ function player:click(y,x) for i=1,#self.mergedTiles do newMergeFX(self.mergedTiles[i][1],self.mergedTiles[i][2],cur+1) end - repeating=true-- goto REPEAT_merge end - until not repeating + until count<=2 ins(self.nexts,self:newTile()) diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 68d5471d..e983caa5 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -51,7 +51,7 @@ local function _scanDict(D) 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 listBox =WIDGET.newListBox {name='listBox',x=20, y=180,w=280,h=526,font=30,lineH=35,drawF=function(item,id,ifSel) -- Background @@ -135,22 +135,22 @@ local function _updateInfoBox(c) _t,t=nil,nil end local _w,c=FONT.get(currentFontSize):getWrap(c,840) - infoBox:setTexts(c) + textBox:setTexts(c) end -- Zoom and reset zoom local function _resetZoom() - currentFontSize,infoBox.font=25,25 - infoBox.lineH,infoBox.capacity=35,math.ceil((infoBox.h-10)/35) + currentFontSize,textBox.font=25,25 + textBox.lineH,textBox.capacity=35,math.ceil((textBox.h-10)/35) _updateInfoBox() MES.new("check",text.dict.sizeReset,1.26) end local function _setZoom(z) if z~=0 then currentFontSize=MATH.clamp(currentFontSize+z,15,40) - infoBox.font=currentFontSize - infoBox.lineH=currentFontSize*7/5 -- Recalculate the line's height - infoBox.capacity=math.ceil((infoBox.h-10)/infoBox.lineH) + textBox.font=currentFontSize + textBox.lineH=currentFontSize*7/5 -- Recalculate the line's height + textBox.capacity=math.ceil((textBox.h-10)/textBox.lineH) _updateInfoBox() MES.new("check",text.dict.sizeChanged:repD(currentFontSize),1.26) end @@ -175,12 +175,16 @@ function scene.enter() end function scene.wheelMoved(_,y) - WHEELMOV(y) + if WIDGET.sel==listBox then + listBox:scroll(-y) + else + textBox:scroll(-y) + end end function scene.keyDown(key) -- Switching selected items 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 _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 _setZoom(key=='dpup' and 5 or -5) else - infoBox:scroll(key=='dpup' and -3 or 3) + textBox:scroll(key=='dpup' and -3 or 3) end elseif key=='dpleft' or key=='dpright' then _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'}, listBox, 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='copy', x=1234,y=670,w=60,font=40,fText=CHAR.icon.copy, code=pressKey'cC',hideF=function() return not (listBox.selected>0) end},