From 915598dec460fdaef423987c7144b0002ebefafe Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 1 Dec 2021 19:23:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8CSF?= =?UTF-8?q?X=E6=A8=A1=E5=9D=97load=E6=97=B6=E4=BC=9A=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E5=A4=9A=E5=B0=91=E9=9F=B3=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/sfx.lua | 12 +++++++++ Zframework/widget.lua | 6 ++--- main.lua | 3 +-- parts/player/player.lua | 1 - parts/scenes/custom_field.lua | 48 +++++++++++++++++------------------ 5 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 5b507dc0..a1f90819 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -42,16 +42,28 @@ function SFX.init(list) end function SFX.load(path) local c=0 + local missing=0 for i=1,#sfxList do local fullPath=path..sfxList[i]..'.ogg' if love.filesystem.getInfo(fullPath)then + if Sources[sfxList[i]]then + for j=1,#Sources[sfxList[i]]do + Sources[sfxList[i]][j]:release() + end + end Sources[sfxList[i]]={love.audio.newSource(fullPath,'static')} c=c+1 else LOG("No SFX: "..sfxList[i]..'.ogg',.1) + missing=missing+1 end end LOG(c.."/"..#sfxList.." SFX files loaded") + LOG(missing.." SFX files missing") + if missing>0 then + MES.new('info',missing.." SFX files missing") + end + collectgarbage() end function SFX.loadSample(pack) assert(type(pack)=='table',"Usage: SFX.loadsample([table])") diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 53361f42..f6a2dc61 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -374,7 +374,7 @@ function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,fShade][,noFrame][,color][,fo noFrame=D.noFrame, color= D.color and(COLOR[D.color]or D.color)or COLOR.Z, font= D.font or 30, - fType=D.fType, + fType= D.fType, sound= D.sound~=false, align= D.align or'M', edge= D.edge or 0, @@ -635,7 +635,7 @@ function WIDGET.newSlider(D)--name,x,y,w[,lim][,fText][,color][,unit][,smooth][, unit= D.unit or 1, smooth=false, font= D.font or 30, - fType=D.fType, + fType= D.fType, change=D.change, disp= D.disp, code= D.code or NULL, @@ -951,7 +951,7 @@ function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,fType][,secret][,regex }, font= D.font or int(D.h/7-1)*5, - fType=D.fType, + fType= D.fType, secret=D.secret==true, regex= D.regex, limit= D.limit, diff --git a/main.lua b/main.lua index d67ea2e8..b2f8180d 100644 --- a/main.lua +++ b/main.lua @@ -23,8 +23,7 @@ local fs=love.filesystem VERSION=require"version" TIME=love.timer.getTime YIELD=coroutine.yield -SYSTEM=love.system.getOS() -if SYSTEM=='OS X'then SYSTEM='macOS'end +SYSTEM=love.system.getOS()if SYSTEM=='OS X'then SYSTEM='macOS'end FNSF=SYSTEM:find'\79\83'--What does FNSF stand for? IDK so don't ask me lol MOBILE=SYSTEM=='Android'or SYSTEM=='iOS' SAVEDIR=fs.getSaveDirectory() diff --git a/parts/player/player.lua b/parts/player/player.lua index fe949df5..29208edb 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -317,7 +317,6 @@ function Player:act_softDrop() end end function Player:act_hold() - print(self.control,self.cur) if self.cur then if self:hold()then self.keyPressing[8]=false diff --git a/parts/scenes/custom_field.lua b/parts/scenes/custom_field.lua index a30048ca..239e6e32 100644 --- a/parts/scenes/custom_field.lua +++ b/parts/scenes/custom_field.lua @@ -438,32 +438,32 @@ scene.widgetList={ WIDGET.newText{name='title', x=1020,y=5,font=70,align='R'}, WIDGET.newText{name='subTitle', x=1030,y=50,font=35,align='L',color='H'}, - WIDGET.newButton{name='b1', x=580, y=130,w=76,fText="",color='R',code=_setPen(1)},--B1 - WIDGET.newButton{name='b2', x=660, y=130,w=76,fText="",color='F',code=_setPen(2)},--B2 - WIDGET.newButton{name='b3', x=740, y=130,w=76,fText="",color='O',code=_setPen(3)},--B3 - WIDGET.newButton{name='b4', x=820, y=130,w=76,fText="",color='Y',code=_setPen(4)},--B4 - WIDGET.newButton{name='b5', x=900, y=130,w=76,fText="",color='L',code=_setPen(5)},--B5 - WIDGET.newButton{name='b6', x=980, y=130,w=76,fText="",color='J',code=_setPen(6)},--B6 - WIDGET.newButton{name='b7', x=1060,y=130,w=76,fText="",color='G',code=_setPen(7)},--B7 - WIDGET.newButton{name='b8', x=1140,y=130,w=76,fText="",color='A',code=_setPen(8)},--B8 + WIDGET.newButton{name='b1', x=580, y=130,w=73,fText="",color='R',code=_setPen(1)},--B1 + WIDGET.newButton{name='b2', x=660, y=130,w=73,fText="",color='F',code=_setPen(2)},--B2 + WIDGET.newButton{name='b3', x=740, y=130,w=73,fText="",color='O',code=_setPen(3)},--B3 + WIDGET.newButton{name='b4', x=820, y=130,w=73,fText="",color='Y',code=_setPen(4)},--B4 + WIDGET.newButton{name='b5', x=900, y=130,w=73,fText="",color='L',code=_setPen(5)},--B5 + WIDGET.newButton{name='b6', x=980, y=130,w=73,fText="",color='J',code=_setPen(6)},--B6 + WIDGET.newButton{name='b7', x=1060,y=130,w=73,fText="",color='G',code=_setPen(7)},--B7 + WIDGET.newButton{name='b8', x=1140,y=130,w=73,fText="",color='A',code=_setPen(8)},--B8 - WIDGET.newButton{name='b9', x=580, y=210,w=76,fText="",color='C',code=_setPen(9)},--B9 - WIDGET.newButton{name='b10', x=660, y=210,w=76,fText="",color='N',code=_setPen(10)},--B10 - WIDGET.newButton{name='b11', x=740, y=210,w=76,fText="",color='S',code=_setPen(11)},--B11 - WIDGET.newButton{name='b12', x=820, y=210,w=76,fText="",color='B',code=_setPen(12)},--B12 - WIDGET.newButton{name='b13', x=900, y=210,w=76,fText="",color='V',code=_setPen(13)},--B13 - WIDGET.newButton{name='b14', x=980, y=210,w=76,fText="",color='P',code=_setPen(14)},--B14 - WIDGET.newButton{name='b15', x=1060,y=210,w=76,fText="",color='M',code=_setPen(15)},--B15 - WIDGET.newButton{name='b16', x=1140,y=210,w=76,fText="",color='W',code=_setPen(16)},--B16 + WIDGET.newButton{name='b9', x=580, y=210,w=73,fText="",color='C',code=_setPen(9)},--B9 + WIDGET.newButton{name='b10', x=660, y=210,w=73,fText="",color='N',code=_setPen(10)},--B10 + WIDGET.newButton{name='b11', x=740, y=210,w=73,fText="",color='S',code=_setPen(11)},--B11 + WIDGET.newButton{name='b12', x=820, y=210,w=73,fText="",color='B',code=_setPen(12)},--B12 + WIDGET.newButton{name='b13', x=900, y=210,w=73,fText="",color='V',code=_setPen(13)},--B13 + WIDGET.newButton{name='b14', x=980, y=210,w=73,fText="",color='P',code=_setPen(14)},--B14 + WIDGET.newButton{name='b15', x=1060,y=210,w=73,fText="",color='M',code=_setPen(15)},--B15 + WIDGET.newButton{name='b16', x=1140,y=210,w=73,fText="",color='W',code=_setPen(16)},--B16 - WIDGET.newButton{name='b17', x=580, y=290,w=76,font=40,fText=CHAR.icon.bone, color='dH',code=_setPen(17)},--BONE - WIDGET.newButton{name='b18', x=660, y=290,w=76,font=40,fText=CHAR.icon.invis, color='D', code=_setPen(18)},--HIDE - WIDGET.newButton{name='b19', x=740, y=290,w=76,font=40,fText=CHAR.icon.bomb, color='lY',code=_setPen(19)},--BOMB - WIDGET.newButton{name='b20', x=820, y=290,w=76,font=40,fText=CHAR.icon.garbage,color='H', code=_setPen(20)},--GB1 - WIDGET.newButton{name='b21', x=900, y=290,w=76,font=40,fText=CHAR.icon.garbage,color='lH',code=_setPen(21)},--GB2 - WIDGET.newButton{name='b22', x=980, y=290,w=76,font=40,fText=CHAR.icon.garbage,color='dV',code=_setPen(22)},--GB3 - WIDGET.newButton{name='b23', x=1060,y=290,w=76,font=40,fText=CHAR.icon.garbage,color='dR',code=_setPen(23)},--GB4 - WIDGET.newButton{name='b24', x=1140,y=290,w=76,font=40,fText=CHAR.icon.garbage,color='dG',code=_setPen(24)},--GB5 + WIDGET.newButton{name='b17', x=580, y=290,w=73,font=40,fText=CHAR.icon.bone, color='dH',code=_setPen(17)},--BONE + WIDGET.newButton{name='b18', x=660, y=290,w=73,font=40,fText=CHAR.icon.invis, color='D', code=_setPen(18)},--HIDE + WIDGET.newButton{name='b19', x=740, y=290,w=73,font=40,fText=CHAR.icon.bomb, color='lY',code=_setPen(19)},--BOMB + WIDGET.newButton{name='b20', x=820, y=290,w=73,font=40,fText=CHAR.icon.garbage,color='H', code=_setPen(20)},--GB1 + WIDGET.newButton{name='b21', x=900, y=290,w=73,font=40,fText=CHAR.icon.garbage,color='lH',code=_setPen(21)},--GB2 + WIDGET.newButton{name='b22', x=980, y=290,w=73,font=40,fText=CHAR.icon.garbage,color='dV',code=_setPen(22)},--GB3 + WIDGET.newButton{name='b23', x=1060,y=290,w=73,font=40,fText=CHAR.icon.garbage,color='dR',code=_setPen(23)},--GB4 + WIDGET.newButton{name='b24', x=1140,y=290,w=73,font=40,fText=CHAR.icon.garbage,color='dG',code=_setPen(24)},--GB5 WIDGET.newButton{name='any', x=600, y=400,w=120,color='lH', font=40,code=_setPen(0)}, WIDGET.newButton{name='space', x=730, y=400,w=120,color='H', font=55,code=_setPen(-1),fText=CHAR.icon.cross_thick},