皮肤/音效/BGM文件缺失时不崩溃,只弹出警告
This commit is contained in:
@@ -40,6 +40,8 @@ function BGM.loadOne(N)
|
||||
BGM.list[N]=love.audio.newSource(file,"stream")
|
||||
BGM.list[N]:setLooping(true)
|
||||
BGM.list[N]:setVolume(0)
|
||||
else
|
||||
LOG.print("No BGM file: "..N,color.red)
|
||||
end
|
||||
end
|
||||
function BGM.loadAll()
|
||||
@@ -52,10 +54,7 @@ function BGM.play(s)
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.suspend,BGM.nowPlay=s
|
||||
return
|
||||
elseif not s then
|
||||
return
|
||||
elseif not BGM.list[s]then
|
||||
LOG.print("Cannot find BGM: "..s,"short",color.red)
|
||||
elseif not(s and BGM.list[s])then
|
||||
return
|
||||
end
|
||||
if BGM.nowPlay~=s then
|
||||
|
||||
@@ -26,7 +26,12 @@ SFX.list={
|
||||
}
|
||||
function SFX.loadOne(_)
|
||||
_,SFX.list[_]=SFX.list[_]
|
||||
SFX.list[_]={love.audio.newSource("/SFX/".._..".ogg","static")}
|
||||
local N="/SFX/".._..".ogg"
|
||||
if love.filesystem.getInfo(N)then
|
||||
SFX.list[_]={love.audio.newSource(N,"static")}
|
||||
else
|
||||
LOG.print("No SFX file: "..N,color.red)
|
||||
end
|
||||
end
|
||||
function SFX.loadAll()
|
||||
for i=1,#SFX.list do
|
||||
|
||||
Reference in New Issue
Block a user