MES模块支持带内部图标(目前只有warn)

This commit is contained in:
MrZ626
2021-06-13 20:48:39 +08:00
parent e77f415f38
commit 0ee460b679
18 changed files with 41 additions and 26 deletions

View File

@@ -50,7 +50,7 @@ function BGM.init(list)
Sources[list[i]]:setLooping(true)
Sources[list[i]]:setVolume(0)
else
MES.new("No BGM file: "..list[i],5)
MES.new('warn',"No BGM file: "..list[i],5)
end
if not skip and i~=count then
coroutine.yield()

View File

@@ -4,7 +4,7 @@ return function(name,libName)
if r1 and r2 then
return r2
else
MES.new("Cannot load "..name..": "..(r2 or r3))
MES.new('warn',"Cannot load "..name..": "..(r2 or r3))
end
elseif SYSTEM=="Android"then
local fs=love.filesystem
@@ -20,7 +20,7 @@ return function(name,libName)
MES.new(name.." lib loaded")
break
else
MES.new("Cannot load "..name..": "..mes2)
MES.new('warn',"Cannot load "..name..": "..mes2)
end
else
MES.new(("Write %s-%s to saving failed: %s"):format(name,platform[i],mes2))
@@ -30,12 +30,12 @@ return function(name,libName)
end
end
if not libFunc then
MES.new("Cannot load "..name)
MES.new('warn',"Cannot load "..name)
return
end
return libFunc()
else
MES.new("No "..name.." for "..SYSTEM)
MES.new('warn',"No "..name.." for "..SYSTEM)
return
end
return true

View File

@@ -5,12 +5,27 @@ local gc_translate,gc_setColor,gc_draw=gc.translate,gc.setColor,gc.draw
local ins,rem=table.insert,table.remove
local mesList={}
local mesIcon={
warn=DOGC{40,40,
{'setCL',.95,.83,.4},
{'fPoly',20.5,1,0,38,40,38},
{'setCL',0,0,0},
{'dPoly',20.5,1,0,38,40,38},
{'fRect',17,10,7,18},
{'fRect',17,29,7,7},
{'setCL',1,1,1},
{'fRect',18,11,5,16},
{'fRect',18,30,5,5},
},
}
local MES={}
function MES.new(...)
local icon,str,time=...
if type(icon)~='userdata'then
if type(icon)=='string'and mesIcon[icon]then
icon=mesIcon[icon]
elseif type(icon)~='userdata'then
icon,str,time=false,icon,str
else
end

View File

@@ -150,7 +150,7 @@ function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back
S.time,S.mid,S.draw=s[1],s[2],s[3]
end
else
MES.new("No Scene: "..tar)
MES.new('warn',"No Scene: "..tar)
end
end
function SCN.go(tar,style)--Normal scene swapping, can back
@@ -158,7 +158,7 @@ function SCN.go(tar,style)--Normal scene swapping, can back
SCN.push()
SCN.swapTo(tar,style)
else
MES.new("No Scene: "..tar)
MES.new('warn',"No Scene: "..tar)
end
end
function SCN.back()

View File

@@ -17,7 +17,7 @@ function SFX.init(list)
if love.filesystem.getInfo(N)then
Sources[list[i]]={love.audio.newSource(N,'static')}
else
MES.new("No SFX file: "..N,.1)
MES.new('warn',"No SFX file: "..N,.1)
end
if not skip and i~=count then
coroutine.yield()

View File

@@ -45,7 +45,7 @@ function VOC.init(list)
if n==1 then
if not loadVoiceFile(list[i],list[i])then
MES.new("No VOICE file: "..list[i],.1)
MES.new('warn',"No VOICE file: "..list[i],.1)
end
end
if not Source[list[i]][1]then Source[list[i]]=nil end

View File

@@ -617,7 +617,7 @@ function selector:reset()
self.selText=self.list[i]
else
self.hide=true
MES.new("Selector "..self.name.." dead, disp= "..tostring(V))
MES.new('warn',"Selector "..self.name.." dead, disp= "..tostring(V))
end
end
function selector:isAbove(x,y)
@@ -771,7 +771,7 @@ function inputBox:addText(str)
if type(str)=='string'then
self.value=self.value..str
else
MES.new("inputBox "..self.name.." dead, addText("..type(str)..")")
MES.new('warn',"inputBox "..self.name.." dead, addText("..type(str)..")")
end
end
function inputBox:clear()