BGM模块也支持setDefault
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
local BGM={
|
local BGM={
|
||||||
|
default=false,
|
||||||
getList={},
|
getList={},
|
||||||
getCount=function()return 0 end,
|
getCount=function()return 0 end,
|
||||||
play=NULL,
|
play=NULL,
|
||||||
@@ -8,6 +9,9 @@ local BGM={
|
|||||||
--nowPlay=[str:playing ID]
|
--nowPlay=[str:playing ID]
|
||||||
--playing=[src:playing SRC]
|
--playing=[src:playing SRC]
|
||||||
}
|
}
|
||||||
|
function BGM.setDefault(bgm)
|
||||||
|
BGM.default=bgm
|
||||||
|
end
|
||||||
function BGM.init(list)
|
function BGM.init(list)
|
||||||
BGM.init=nil
|
BGM.init=nil
|
||||||
local min=math.min
|
local min=math.min
|
||||||
@@ -56,6 +60,7 @@ function BGM.init(list)
|
|||||||
BGM.loadOne=nil
|
BGM.loadOne=nil
|
||||||
|
|
||||||
function BGM.play(s)
|
function BGM.play(s)
|
||||||
|
if not s then s=BGM.default end
|
||||||
if SETTING.bgm==0 then
|
if SETTING.bgm==0 then
|
||||||
BGM.nowPlay=s
|
BGM.nowPlay=s
|
||||||
BGM.playing=Sources[s]
|
BGM.playing=Sources[s]
|
||||||
|
|||||||
1
main.lua
1
main.lua
@@ -354,3 +354,4 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
BG.setDefault(FESTIVAL=="Xmas"and"snow"or"space")
|
BG.setDefault(FESTIVAL=="Xmas"and"snow"or"space")
|
||||||
|
BGM.setDefault(FESTIVAL=="Xmas"and"mXmas"or"blank")
|
||||||
@@ -28,7 +28,7 @@ function scene.sceneInit()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
BGM.play(FESTIVAL=="Xmas"and"mXmas"or"blank")
|
BGM.play()
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ local t1,t2,r
|
|||||||
|
|
||||||
function scene.sceneInit()
|
function scene.sceneInit()
|
||||||
BG.set()
|
BG.set()
|
||||||
BGM.play(FESTIVAL=="Xmas"and"mXmas"or"blank")
|
BGM.play()
|
||||||
t1,t2=0,0--Timer
|
t1,t2=0,0--Timer
|
||||||
r={}--Random animation type
|
r={}--Random animation type
|
||||||
for i=1,8 do r[i]=rnd(5)end
|
for i=1,8 do r[i]=rnd(5)end
|
||||||
|
|||||||
Reference in New Issue
Block a user