From cb23837684ee3d2e1ee01cbd7ee775a263d6ac33 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 28 Dec 2020 22:14:02 +0800 Subject: [PATCH] =?UTF-8?q?BGM=E6=A8=A1=E5=9D=97=E4=B9=9F=E6=94=AF?= =?UTF-8?q?=E6=8C=81setDefault?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/bgm.lua | 5 +++++ main.lua | 1 + parts/scenes/customGame.lua | 2 +- parts/scenes/intro.lua | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index cd2d2c89..b4f45289 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -1,4 +1,5 @@ local BGM={ + default=false, getList={}, getCount=function()return 0 end, play=NULL, @@ -8,6 +9,9 @@ local BGM={ --nowPlay=[str:playing ID] --playing=[src:playing SRC] } +function BGM.setDefault(bgm) + BGM.default=bgm +end function BGM.init(list) BGM.init=nil local min=math.min @@ -56,6 +60,7 @@ function BGM.init(list) BGM.loadOne=nil function BGM.play(s) + if not s then s=BGM.default end if SETTING.bgm==0 then BGM.nowPlay=s BGM.playing=Sources[s] diff --git a/main.lua b/main.lua index 2989cf7a..7a76d5bf 100644 --- a/main.lua +++ b/main.lua @@ -354,3 +354,4 @@ do end BG.setDefault(FESTIVAL=="Xmas"and"snow"or"space") +BGM.setDefault(FESTIVAL=="Xmas"and"mXmas"or"blank") \ No newline at end of file diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index 68267eb6..2f0f396e 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -28,7 +28,7 @@ function scene.sceneInit() end end function scene.sceneBack() - BGM.play(FESTIVAL=="Xmas"and"mXmas"or"blank") + BGM.play() end function scene.keyDown(key) diff --git a/parts/scenes/intro.lua b/parts/scenes/intro.lua index a815386a..1ebb8141 100644 --- a/parts/scenes/intro.lua +++ b/parts/scenes/intro.lua @@ -10,7 +10,7 @@ local t1,t2,r function scene.sceneInit() BG.set() - BGM.play(FESTIVAL=="Xmas"and"mXmas"or"blank") + BGM.play() t1,t2=0,0--Timer r={}--Random animation type for i=1,8 do r[i]=rnd(5)end