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

View File

@@ -29,19 +29,19 @@ local mesIcon={
{'fRect',2,4,36,26,3},
{'fPoly',2,27,2,37,14,25},
{'setCL',.5,.5,.5},
{'fRect',6,11,4,4},{'fRect',14,11,19,4},
{'fRect',6,19,4,4},{'fRect',14,19,19,4},
{'fRect',6,11,4,4,1},{'fRect',14,11,19,4,1},
{'fRect',6,19,4,4,1},{'fRect',14,19,19,4,1},
},
warn=GC.DO{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},
{'fRect',17,10,7,18,2},
{'fRect',17,29,7,7,2},
{'setCL',1,1,1},
{'fRect',18,11,5,16},
{'fRect',18,30,5,5},
{'fRect',18,11,5,16,2},
{'fRect',18,30,5,5,2},
},
error=GC.DO{40,40,
{'setCL',.95,.3,.3},
@@ -56,22 +56,27 @@ local mesIcon={
{'line',11,11,29,29},
{'line',11,29,29,11},
},
music=GC.DO{40,40,
{'setLW',2},
{'dRect',1,3,38,34,3},
{'setLW',4},
{'line',21,26,21,10,28,10},
{'fElps',17,26,6,5},
},
}
local MES={}
local backColors={
check={.3,.6,.3,.7},
broadcast={.3,.3,.6,.8},
warn={.4,.4,.2,.9},
error={.4,.2,.2,.9},
music={.2,.4,.4,.9},
}
function MES.new(icon,str,time)
local backColor={.5,.5,.5,.7}
if type(icon)=='string'then
if icon=='check'then
backColor={.3,.6,.3,.7}
elseif icon=='broadcast'then
backColor={.3,.3,.6,.8}
elseif icon=='warn'then
backColor={.4,.4,.2,.9}
elseif icon=='error'then
backColor={.4,.2,.2,.9}
end
backColor=backColors[icon]or backColor
icon=mesIcon[icon]
end
local t=gc.newText(getFont(30),str)

View File

@@ -46,6 +46,7 @@ end
--Load modules
require'Zframework'
SCR.setSize(1280,720)--Initialize Screen size
BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end)
--Delete all naked files (from too old version)
FILE.clear('')

View File

@@ -73,6 +73,8 @@ return{
pasteWrongPlace="Paste at wrong place?",
noFile="File not found",
nowPlaying="Now Playing:",
VKTchW="Touch Weight",
VKOrgW="Origin Weight",
VKCurW="Current. Pos. Weight",

View File

@@ -62,6 +62,8 @@ return{
pasteWrongPlace="¿Pegaste en la carpeta correcta?",
noFile="Archivo no encontrado",
nowPlaying="Reproduciendo:",
VKTchW="Sens. al tacto",
VKOrgW="Sens. al origen",
VKCurW="Sens. Cur. Pos.",

View File

@@ -63,6 +63,8 @@ return{
-- pasteWrongPlace="Paste at wrong place?",
-- noFile="File not found",
nowPlaying="En train de jouer :",
VKTchW="Poids du toucher",
VKOrgW="Poids d'origine",
VKCurW="Poids de la pos. du cur.",

View File

@@ -49,6 +49,8 @@ return{
pasteWrongPlace="_?X.",
-- noFile="File not found",
nowPlaying="~:",
VKTchW="Tch↓",
VKOrgW="Org↓",
VKCurW="Cur↓",

View File

@@ -73,6 +73,8 @@ return{
pasteWrongPlace="提醒:可能粘贴错地方了",
noFile="找不到文件",
nowPlaying="正在播放:",
VKTchW="触摸点权重",
VKOrgW="原始点权重",
VKCurW="当前点权重",