BGM和BG模块设置成功(包括重复)返回true
This commit is contained in:
@@ -34,17 +34,20 @@ function BG.setDefault(bg)
|
|||||||
end
|
end
|
||||||
function BG.set(background)
|
function BG.set(background)
|
||||||
if not background then background=BG.default end
|
if not background then background=BG.default end
|
||||||
if not BGs[background]or background==BG.cur or not SETTING.bg then return end
|
if not BGs[background]or not SETTING.bg then return end
|
||||||
BG.discard()
|
if background~=BG.cur then
|
||||||
BG.cur=background
|
BG.discard()
|
||||||
background=BGs[background]
|
BG.cur=background
|
||||||
|
background=BGs[background]
|
||||||
|
|
||||||
BG.init= background.init or NULL
|
BG.init= background.init or NULL
|
||||||
BG.resize= background.resize or NULL
|
BG.resize= background.resize or NULL
|
||||||
BG.update= background.update or NULL
|
BG.update= background.update or NULL
|
||||||
BG.draw= background.draw or NULL
|
BG.draw= background.draw or NULL
|
||||||
BG.event= background.event or NULL
|
BG.event= background.event or NULL
|
||||||
BG.discard= background.discard or NULL
|
BG.discard= background.discard or NULL
|
||||||
BG.init()
|
BG.init()
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return BG
|
return BG
|
||||||
@@ -63,17 +63,20 @@ function BGM.init(list)
|
|||||||
if SETTING.bgm==0 then
|
if SETTING.bgm==0 then
|
||||||
BGM.nowPlay=s
|
BGM.nowPlay=s
|
||||||
BGM.playing=Sources[s]
|
BGM.playing=Sources[s]
|
||||||
return
|
return true
|
||||||
end
|
end
|
||||||
if s and Sources[s]and BGM.nowPlay~=s then
|
if s and Sources[s]then
|
||||||
if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end
|
if BGM.nowPlay~=s then
|
||||||
TASK.removeTask_iterate(removeCurFadeOut,fadeOut,Sources[s])
|
if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end
|
||||||
TASK.removeTask_code(fadeIn)
|
TASK.removeTask_iterate(removeCurFadeOut,fadeOut,Sources[s])
|
||||||
|
TASK.removeTask_code(fadeIn)
|
||||||
|
|
||||||
TASK.new(fadeIn,Sources[s])
|
TASK.new(fadeIn,Sources[s])
|
||||||
BGM.nowPlay=s
|
BGM.nowPlay=s
|
||||||
BGM.playing=Sources[s]
|
BGM.playing=Sources[s]
|
||||||
BGM.playing:play()
|
BGM.playing:play()
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function BGM.freshVolume()
|
function BGM.freshVolume()
|
||||||
|
|||||||
Reference in New Issue
Block a user