控件系统支持开关音效,key控件添加音效
This commit is contained in:
@@ -187,9 +187,9 @@ end
|
|||||||
function button:press()
|
function button:press()
|
||||||
self.code()
|
self.code()
|
||||||
self:FX()
|
self:FX()
|
||||||
SFX.play("button")
|
if self.sound then SFX.play("button")end
|
||||||
end
|
end
|
||||||
function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font][,align="M"[,edge]],code[,hide]
|
function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font=30][,sound=true][,align="M"][,edge=0],code[,hide]
|
||||||
if not D.h then D.h=D.w end
|
if not D.h then D.h=D.w end
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
@@ -212,6 +212,7 @@ function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font][,align="M"[,
|
|||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
align= D.align or"M",
|
align= D.align or"M",
|
||||||
edge= D.edge or 0,
|
edge= D.edge or 0,
|
||||||
|
sound= D.sound~=false,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
hide= D.hide,
|
hide= D.hide,
|
||||||
}
|
}
|
||||||
@@ -279,8 +280,9 @@ function key:getInfo()
|
|||||||
end
|
end
|
||||||
function key:press()
|
function key:press()
|
||||||
self.code()
|
self.code()
|
||||||
|
if self.sound then SFX.play("key")end
|
||||||
end
|
end
|
||||||
function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,color][,font][,align="M"[,edge]],code[,hide]
|
function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,color][,font=30][,sound=true][,align="M"][,edge=0],code[,hide]
|
||||||
if not D.h then D.h=D.w end
|
if not D.h then D.h=D.w end
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
@@ -301,6 +303,7 @@ function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,color][,font][,align="M"[,edg
|
|||||||
fText= D.fText,
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
|
sound= D.sound~=false,
|
||||||
align= D.align or"M",
|
align= D.align or"M",
|
||||||
edge= D.edge or 0,
|
edge= D.edge or 0,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
@@ -365,9 +368,9 @@ function switch:getInfo()
|
|||||||
end
|
end
|
||||||
function switch:press()
|
function switch:press()
|
||||||
self.code()
|
self.code()
|
||||||
SFX.play("move")
|
if self.sound then SFX.play("move")end
|
||||||
end
|
end
|
||||||
function WIDGET.newSwitch(D)--name,x,y[,fText][,color][,font][,disp],code,hide
|
function WIDGET.newSwitch(D)--name,x,y[,fText][,color][,font=30][,sound=true][,disp],code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -381,6 +384,7 @@ function WIDGET.newSwitch(D)--name,x,y[,fText][,color][,font][,disp],code,hide
|
|||||||
fText= D.fText,
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
|
sound= D.sound~=false,
|
||||||
disp= D.disp,
|
disp= D.disp,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
hide= D.hide,
|
hide= D.hide,
|
||||||
@@ -517,7 +521,7 @@ function slider:arrowKey(isLeft)
|
|||||||
self.change()
|
self.change()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.newSlider(D)--name,x,y,w[,fText][,color][,unit][,smooth][,font][,change],disp,code,hide
|
function WIDGET.newSlider(D)--name,x,y,w[,fText][,color][,unit][,smooth][,font=30][,change],disp,code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -664,7 +668,7 @@ function selector:press(x)
|
|||||||
self.code(self.list[s])
|
self.code(self.list[s])
|
||||||
self.select=s
|
self.select=s
|
||||||
self.selText=self.list[s]
|
self.selText=self.list[s]
|
||||||
SFX.play("prerotate")
|
if self.sound then SFX.play("prerotate")end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -681,9 +685,9 @@ function selector:arrowKey(isLeft)
|
|||||||
self.code(self.list[s])
|
self.code(self.list[s])
|
||||||
self.select=s
|
self.select=s
|
||||||
self.selText=self.list[s]
|
self.selText=self.list[s]
|
||||||
SFX.play("prerotate")
|
if self.sound then SFX.play("prerotate")end
|
||||||
end
|
end
|
||||||
function WIDGET.newSelector(D)--name,x,y,w[,fText][,color],list,disp,code,hide
|
function WIDGET.newSelector(D)--name,x,y,w[,fText][,color][,sound=true],list,disp,code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -701,6 +705,7 @@ function WIDGET.newSelector(D)--name,x,y,w[,fText][,color],list,disp,code,hide
|
|||||||
|
|
||||||
fText= D.fText,
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.Z,
|
||||||
|
sound= D.sound~=false,
|
||||||
font= 30,
|
font= 30,
|
||||||
list= D.list,
|
list= D.list,
|
||||||
disp= D.disp,
|
disp= D.disp,
|
||||||
@@ -799,7 +804,7 @@ function inputBox:keypress(k)
|
|||||||
self.value=t
|
self.value=t
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.newInputBox(D)--name,x,y,w[,h][,font][,secret][,regex],hide
|
function WIDGET.newInputBox(D)--name,x,y,w[,h][,font=30][,secret][,regex],hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -943,7 +948,7 @@ end
|
|||||||
function textBox:getInfo()
|
function textBox:getInfo()
|
||||||
return format("x=%d,y=%d,w=%d,h=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
return format("x=%d,y=%d,w=%d,h=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
||||||
end
|
end
|
||||||
function WIDGET.newTextBox(D)--name,x,y,w,h[,font][,lineH][,fix],hide
|
function WIDGET.newTextBox(D)--name,x,y,w,h[,font=30][,lineH][,fix],hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
|
|||||||
BIN
media/SFX/key.ogg
Normal file
BIN
media/SFX/key.ogg
Normal file
Binary file not shown.
@@ -39,73 +39,73 @@ end
|
|||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newText{name="title", x=30, y=15,font=70,align="L"},
|
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=SETval("sfx"),code=SETsto("sfx")},
|
WIDGET.newSlider{name="sfx", x=510, y=60,w=330,font=35,change=function()SFX.play("blip_1")end,disp=SETval("sfx"),sound=false,code=SETsto("sfx")},
|
||||||
WIDGET.newSlider{name="voc", x=510, y=120,w=330,font=35,change=function()VOC.play("test")end,disp=SETval("voc"),code=SETsto("voc")},
|
WIDGET.newSlider{name="voc", x=510, y=120,w=330,font=35,change=function()VOC.play("test")end,disp=SETval("voc"),sound=false,code=SETsto("voc")},
|
||||||
|
|
||||||
WIDGET.newKey{name="move", x=110, y=140,w=160,h=50,font=20,code=function()SFX.play("move")end},
|
WIDGET.newKey{name="move", x=110, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play("move")end},
|
||||||
WIDGET.newKey{name="lock", x=110, y=205,w=160,h=50,font=20,code=function()SFX.play("lock")end},
|
WIDGET.newKey{name="lock", x=110, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play("lock")end},
|
||||||
WIDGET.newKey{name="drop", x=110, y=270,w=160,h=50,font=20,code=function()SFX.play("drop")end},
|
WIDGET.newKey{name="drop", x=110, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play("drop")end},
|
||||||
WIDGET.newKey{name="fall", x=110, y=335,w=160,h=50,font=20,code=function()SFX.play("fall")end},
|
WIDGET.newKey{name="fall", x=110, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play("fall")end},
|
||||||
WIDGET.newKey{name="rotate", x=110, y=400,w=160,h=50,font=20,code=function()SFX.play("rotate")end},
|
WIDGET.newKey{name="rotate", x=110, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play("rotate")end},
|
||||||
WIDGET.newKey{name="rotatekick",x=110, y=465,w=160,h=50,font=20,code=function()SFX.play("rotatekick")end},
|
WIDGET.newKey{name="rotatekick",x=110, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play("rotatekick")end},
|
||||||
WIDGET.newKey{name="hold", x=110, y=530,w=160,h=50,font=20,code=function()SFX.play("hold")end},
|
WIDGET.newKey{name="hold", x=110, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play("hold")end},
|
||||||
WIDGET.newKey{name="prerotate",x=110, y=595,w=160,h=50,font=20,code=function()SFX.play("prerotate")end},
|
WIDGET.newKey{name="prerotate",x=110, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play("prerotate")end},
|
||||||
WIDGET.newKey{name="prehold", x=110, y=660,w=160,h=50,font=20,code=function()SFX.play("prehold")end},
|
WIDGET.newKey{name="prehold", x=110, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play("prehold")end},
|
||||||
|
|
||||||
WIDGET.newKey{name="clear1", x=280, y=140,w=160,h=50,font=20,code=function()SFX.play("clear_1")end},
|
WIDGET.newKey{name="clear1", x=280, y=140,w=160,h=50,font=20,sound=false,code=function()SFX.play("clear_1")end},
|
||||||
WIDGET.newKey{name="clear2", x=280, y=205,w=160,h=50,font=20,code=function()SFX.play("clear_2")end},
|
WIDGET.newKey{name="clear2", x=280, y=205,w=160,h=50,font=20,sound=false,code=function()SFX.play("clear_2")end},
|
||||||
WIDGET.newKey{name="clear3", x=280, y=270,w=160,h=50,font=20,code=function()SFX.play("clear_3")end},
|
WIDGET.newKey{name="clear3", x=280, y=270,w=160,h=50,font=20,sound=false,code=function()SFX.play("clear_3")end},
|
||||||
WIDGET.newKey{name="clear4", x=280, y=335,w=160,h=50,font=20,code=function()SFX.play("clear_4")end},
|
WIDGET.newKey{name="clear4", x=280, y=335,w=160,h=50,font=20,sound=false,code=function()SFX.play("clear_4")end},
|
||||||
WIDGET.newKey{name="spin0", x=280, y=400,w=160,h=50,font=20,code=function()SFX.play("spin_0")end},
|
WIDGET.newKey{name="spin0", x=280, y=400,w=160,h=50,font=20,sound=false,code=function()SFX.play("spin_0")end},
|
||||||
WIDGET.newKey{name="spin1", x=280, y=465,w=160,h=50,font=20,code=function()SFX.play("spin_1")end},
|
WIDGET.newKey{name="spin1", x=280, y=465,w=160,h=50,font=20,sound=false,code=function()SFX.play("spin_1")end},
|
||||||
WIDGET.newKey{name="spin2", x=280, y=530,w=160,h=50,font=20,code=function()SFX.play("spin_2")end},
|
WIDGET.newKey{name="spin2", x=280, y=530,w=160,h=50,font=20,sound=false,code=function()SFX.play("spin_2")end},
|
||||||
WIDGET.newKey{name="spin3", x=280, y=595,w=160,h=50,font=20,code=function()SFX.play("spin_3")end},
|
WIDGET.newKey{name="spin3", x=280, y=595,w=160,h=50,font=20,sound=false,code=function()SFX.play("spin_3")end},
|
||||||
WIDGET.newKey{name="_pc", x=280, y=660,w=160,h=50,font=20,code=function()SFX.play("clear")end},
|
WIDGET.newKey{name="_pc", x=280, y=660,w=160,h=50,font=20,sound=false,code=function()SFX.play("clear")end},
|
||||||
|
|
||||||
WIDGET.newKey{name="_1", x=970, y=75,w=140,h=50,font=20,code=pressKey(1)},
|
WIDGET.newKey{name="_1", x=970, y=75,w=140,h=50,font=20,sound=false,code=pressKey(1)},
|
||||||
WIDGET.newKey{name="_2", x=1130, y=75,w=140,h=50,font=20,code=pressKey(2)},
|
WIDGET.newKey{name="_2", x=1130, y=75,w=140,h=50,font=20,sound=false,code=pressKey(2)},
|
||||||
WIDGET.newKey{name="_3", x=970, y=140,w=140,h=50,font=20,code=pressKey(3)},
|
WIDGET.newKey{name="_3", x=970, y=140,w=140,h=50,font=20,sound=false,code=pressKey(3)},
|
||||||
WIDGET.newKey{name="_4", x=1130, y=140,w=140,h=50,font=20,code=pressKey(4)},
|
WIDGET.newKey{name="_4", x=1130, y=140,w=140,h=50,font=20,sound=false,code=pressKey(4)},
|
||||||
|
|
||||||
WIDGET.newKey{name="z0", x=650, y=205,w=140,h=50,font=20,code=pressKey(10)},
|
WIDGET.newKey{name="z0", x=650, y=205,w=140,h=50,font=20,sound=false,code=pressKey(10)},
|
||||||
WIDGET.newKey{name="z1", x=650, y=270,w=140,h=50,font=20,code=pressKey(11)},
|
WIDGET.newKey{name="z1", x=650, y=270,w=140,h=50,font=20,sound=false,code=pressKey(11)},
|
||||||
WIDGET.newKey{name="z2", x=650, y=335,w=140,h=50,font=20,code=pressKey(12)},
|
WIDGET.newKey{name="z2", x=650, y=335,w=140,h=50,font=20,sound=false,code=pressKey(12)},
|
||||||
WIDGET.newKey{name="z3", x=650, y=400,w=140,h=50,font=20,code=pressKey(13)},
|
WIDGET.newKey{name="z3", x=650, y=400,w=140,h=50,font=20,sound=false,code=pressKey(13)},
|
||||||
WIDGET.newKey{name="t0", x=650, y=465,w=140,h=50,font=20,code=pressKey(50)},
|
WIDGET.newKey{name="t0", x=650, y=465,w=140,h=50,font=20,sound=false,code=pressKey(50)},
|
||||||
WIDGET.newKey{name="t1", x=650, y=530,w=140,h=50,font=20,code=pressKey(51)},
|
WIDGET.newKey{name="t1", x=650, y=530,w=140,h=50,font=20,sound=false,code=pressKey(51)},
|
||||||
WIDGET.newKey{name="t2", x=650, y=595,w=140,h=50,font=20,code=pressKey(52)},
|
WIDGET.newKey{name="t2", x=650, y=595,w=140,h=50,font=20,sound=false,code=pressKey(52)},
|
||||||
WIDGET.newKey{name="t3", x=650, y=660,w=140,h=50,font=20,code=pressKey(53)},
|
WIDGET.newKey{name="t3", x=650, y=660,w=140,h=50,font=20,sound=false,code=pressKey(53)},
|
||||||
|
|
||||||
WIDGET.newKey{name="s0", x=810, y=205,w=140,h=50,font=20,code=pressKey(20)},
|
WIDGET.newKey{name="s0", x=810, y=205,w=140,h=50,font=20,sound=false,code=pressKey(20)},
|
||||||
WIDGET.newKey{name="s1", x=810, y=270,w=140,h=50,font=20,code=pressKey(21)},
|
WIDGET.newKey{name="s1", x=810, y=270,w=140,h=50,font=20,sound=false,code=pressKey(21)},
|
||||||
WIDGET.newKey{name="s2", x=810, y=335,w=140,h=50,font=20,code=pressKey(22)},
|
WIDGET.newKey{name="s2", x=810, y=335,w=140,h=50,font=20,sound=false,code=pressKey(22)},
|
||||||
WIDGET.newKey{name="s3", x=810, y=400,w=140,h=50,font=20,code=pressKey(23)},
|
WIDGET.newKey{name="s3", x=810, y=400,w=140,h=50,font=20,sound=false,code=pressKey(23)},
|
||||||
WIDGET.newKey{name="o0", x=810, y=465,w=140,h=50,font=20,code=pressKey(60)},
|
WIDGET.newKey{name="o0", x=810, y=465,w=140,h=50,font=20,sound=false,code=pressKey(60)},
|
||||||
WIDGET.newKey{name="o1", x=810, y=530,w=140,h=50,font=20,code=pressKey(61)},
|
WIDGET.newKey{name="o1", x=810, y=530,w=140,h=50,font=20,sound=false,code=pressKey(61)},
|
||||||
WIDGET.newKey{name="o2", x=810, y=595,w=140,h=50,font=20,code=pressKey(62)},
|
WIDGET.newKey{name="o2", x=810, y=595,w=140,h=50,font=20,sound=false,code=pressKey(62)},
|
||||||
WIDGET.newKey{name="o3", x=810, y=660,w=140,h=50,font=20,code=pressKey(63)},
|
WIDGET.newKey{name="o3", x=810, y=660,w=140,h=50,font=20,sound=false,code=pressKey(63)},
|
||||||
|
|
||||||
WIDGET.newKey{name="j0", x=970, y=205,w=140,h=50,font=20,code=pressKey(30)},
|
WIDGET.newKey{name="j0", x=970, y=205,w=140,h=50,font=20,sound=false,code=pressKey(30)},
|
||||||
WIDGET.newKey{name="j1", x=970, y=270,w=140,h=50,font=20,code=pressKey(31)},
|
WIDGET.newKey{name="j1", x=970, y=270,w=140,h=50,font=20,sound=false,code=pressKey(31)},
|
||||||
WIDGET.newKey{name="j2", x=970, y=335,w=140,h=50,font=20,code=pressKey(32)},
|
WIDGET.newKey{name="j2", x=970, y=335,w=140,h=50,font=20,sound=false,code=pressKey(32)},
|
||||||
WIDGET.newKey{name="j3", x=970, y=400,w=140,h=50,font=20,code=pressKey(33)},
|
WIDGET.newKey{name="j3", x=970, y=400,w=140,h=50,font=20,sound=false,code=pressKey(33)},
|
||||||
WIDGET.newKey{name="i0", x=970, y=465,w=140,h=50,font=20,code=pressKey(70)},
|
WIDGET.newKey{name="i0", x=970, y=465,w=140,h=50,font=20,sound=false,code=pressKey(70)},
|
||||||
WIDGET.newKey{name="i1", x=970, y=530,w=140,h=50,font=20,code=pressKey(71)},
|
WIDGET.newKey{name="i1", x=970, y=530,w=140,h=50,font=20,sound=false,code=pressKey(71)},
|
||||||
WIDGET.newKey{name="i2", x=970, y=595,w=140,h=50,font=20,code=pressKey(72)},
|
WIDGET.newKey{name="i2", x=970, y=595,w=140,h=50,font=20,sound=false,code=pressKey(72)},
|
||||||
WIDGET.newKey{name="i3", x=970, y=660,w=140,h=50,font=20,code=pressKey(73)},
|
WIDGET.newKey{name="i3", x=970, y=660,w=140,h=50,font=20,sound=false,code=pressKey(73)},
|
||||||
|
|
||||||
WIDGET.newKey{name="l0", x=1130, y=205,w=140,h=50,font=20,code=pressKey(40)},
|
WIDGET.newKey{name="l0", x=1130, y=205,w=140,h=50,font=20,sound=false,code=pressKey(40)},
|
||||||
WIDGET.newKey{name="l1", x=1130, y=270,w=140,h=50,font=20,code=pressKey(41)},
|
WIDGET.newKey{name="l1", x=1130, y=270,w=140,h=50,font=20,sound=false,code=pressKey(41)},
|
||||||
WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,code=pressKey(42)},
|
WIDGET.newKey{name="l2", x=1130, y=335,w=140,h=50,font=20,sound=false,code=pressKey(42)},
|
||||||
WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,code=pressKey(43)},
|
WIDGET.newKey{name="l3", x=1130, y=400,w=140,h=50,font=20,sound=false,code=pressKey(43)},
|
||||||
|
|
||||||
WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=function()return mini end,code=pressKey"1"},
|
WIDGET.newSwitch{name="mini", x=515, y=465,font=25,disp=function()return mini end,sound=false,code=pressKey"1"},
|
||||||
WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=function()return b2b end,code=pressKey"2"},
|
WIDGET.newSwitch{name="b2b", x=515, y=530,font=25,disp=function()return b2b end,sound=false,code=pressKey"2"},
|
||||||
WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=function()return b3b end,code=pressKey"3"},
|
WIDGET.newSwitch{name="b3b", x=515, y=595,font=25,disp=function()return b3b end,sound=false,code=pressKey"3"},
|
||||||
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=function()return pc end,code=pressKey"4"},
|
WIDGET.newSwitch{name="pc", x=515, y=660,font=25,disp=function()return pc end,sound=false,code=pressKey"4"},
|
||||||
|
|
||||||
WIDGET.newButton{name="music", x=1140, y=540,w=170,h=80,font=40,code=pressKey"tab"},
|
WIDGET.newButton{name="music", x=1140, y=540,w=170,h=80,font=40,sound=false,code=pressKey"tab"},
|
||||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
|
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,sound=false,code=backScene},
|
||||||
}
|
}
|
||||||
|
|
||||||
return scene
|
return scene
|
||||||
Reference in New Issue
Block a user