BGM模块新增setChange方法可以设置切换BGM的时候会触发的事件

切换BGM时弹出BGM名称
This commit is contained in:
MrZ626
2021-08-26 03:37:06 +08:00
parent 12c96f321b
commit 442b3bd233
8 changed files with 37 additions and 16 deletions

View File

@@ -5,12 +5,16 @@ local BGM={
play=NULL,
freshVolume=NULL,
stop=NULL,
onChange=NULL,
--nowPlay=[str:playing ID]
--playing=[src:playing SRC]
}
function BGM.setDefault(bgm)
BGM.default=bgm
end
function BGM.setChange(func)
BGM.onChange=func
end
function BGM.init(list)
BGM.init=nil
local Sources={}
@@ -85,6 +89,7 @@ function BGM.init(list)
BGM.nowPlay=name
BGM.playing=Sources[name]
BGM.playing:play()
BGM.onChange(name)
end
return true
end