BGM模块新增setChange方法可以设置切换BGM的时候会触发的事件
切换BGM时弹出BGM名称
This commit is contained in:
@@ -5,12 +5,16 @@ local BGM={
|
|||||||
play=NULL,
|
play=NULL,
|
||||||
freshVolume=NULL,
|
freshVolume=NULL,
|
||||||
stop=NULL,
|
stop=NULL,
|
||||||
|
onChange=NULL,
|
||||||
--nowPlay=[str:playing ID]
|
--nowPlay=[str:playing ID]
|
||||||
--playing=[src:playing SRC]
|
--playing=[src:playing SRC]
|
||||||
}
|
}
|
||||||
function BGM.setDefault(bgm)
|
function BGM.setDefault(bgm)
|
||||||
BGM.default=bgm
|
BGM.default=bgm
|
||||||
end
|
end
|
||||||
|
function BGM.setChange(func)
|
||||||
|
BGM.onChange=func
|
||||||
|
end
|
||||||
function BGM.init(list)
|
function BGM.init(list)
|
||||||
BGM.init=nil
|
BGM.init=nil
|
||||||
local Sources={}
|
local Sources={}
|
||||||
@@ -85,6 +89,7 @@ function BGM.init(list)
|
|||||||
BGM.nowPlay=name
|
BGM.nowPlay=name
|
||||||
BGM.playing=Sources[name]
|
BGM.playing=Sources[name]
|
||||||
BGM.playing:play()
|
BGM.playing:play()
|
||||||
|
BGM.onChange(name)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ local mesIcon={
|
|||||||
{'fRect',2,4,36,26,3},
|
{'fRect',2,4,36,26,3},
|
||||||
{'fPoly',2,27,2,37,14,25},
|
{'fPoly',2,27,2,37,14,25},
|
||||||
{'setCL',.5,.5,.5},
|
{'setCL',.5,.5,.5},
|
||||||
{'fRect',6,11,4,4},{'fRect',14,11,19,4},
|
{'fRect',6,11,4,4,1},{'fRect',14,11,19,4,1},
|
||||||
{'fRect',6,19,4,4},{'fRect',14,19,19,4},
|
{'fRect',6,19,4,4,1},{'fRect',14,19,19,4,1},
|
||||||
},
|
},
|
||||||
warn=GC.DO{40,40,
|
warn=GC.DO{40,40,
|
||||||
{'setCL',.95,.83,.4},
|
{'setCL',.95,.83,.4},
|
||||||
{'fPoly',20.5,1,0,38,40,38},
|
{'fPoly',20.5,1,0,38,40,38},
|
||||||
{'setCL',0,0,0},
|
{'setCL',0,0,0},
|
||||||
{'dPoly',20.5,1,0,38,40,38},
|
{'dPoly',20.5,1,0,38,40,38},
|
||||||
{'fRect',17,10,7,18},
|
{'fRect',17,10,7,18,2},
|
||||||
{'fRect',17,29,7,7},
|
{'fRect',17,29,7,7,2},
|
||||||
{'setCL',1,1,1},
|
{'setCL',1,1,1},
|
||||||
{'fRect',18,11,5,16},
|
{'fRect',18,11,5,16,2},
|
||||||
{'fRect',18,30,5,5},
|
{'fRect',18,30,5,5,2},
|
||||||
},
|
},
|
||||||
error=GC.DO{40,40,
|
error=GC.DO{40,40,
|
||||||
{'setCL',.95,.3,.3},
|
{'setCL',.95,.3,.3},
|
||||||
@@ -56,22 +56,27 @@ local mesIcon={
|
|||||||
{'line',11,11,29,29},
|
{'line',11,11,29,29},
|
||||||
{'line',11,29,29,11},
|
{'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 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)
|
function MES.new(icon,str,time)
|
||||||
local backColor={.5,.5,.5,.7}
|
local backColor={.5,.5,.5,.7}
|
||||||
if type(icon)=='string'then
|
if type(icon)=='string'then
|
||||||
if icon=='check'then
|
backColor=backColors[icon]or backColor
|
||||||
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
|
|
||||||
icon=mesIcon[icon]
|
icon=mesIcon[icon]
|
||||||
end
|
end
|
||||||
local t=gc.newText(getFont(30),str)
|
local t=gc.newText(getFont(30),str)
|
||||||
|
|||||||
1
main.lua
1
main.lua
@@ -46,6 +46,7 @@ end
|
|||||||
--Load modules
|
--Load modules
|
||||||
require'Zframework'
|
require'Zframework'
|
||||||
SCR.setSize(1280,720)--Initialize Screen size
|
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)
|
--Delete all naked files (from too old version)
|
||||||
FILE.clear('')
|
FILE.clear('')
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ return{
|
|||||||
pasteWrongPlace="Paste at wrong place?",
|
pasteWrongPlace="Paste at wrong place?",
|
||||||
noFile="File not found",
|
noFile="File not found",
|
||||||
|
|
||||||
|
nowPlaying="Now Playing:",
|
||||||
|
|
||||||
VKTchW="Touch Weight",
|
VKTchW="Touch Weight",
|
||||||
VKOrgW="Origin Weight",
|
VKOrgW="Origin Weight",
|
||||||
VKCurW="Current. Pos. Weight",
|
VKCurW="Current. Pos. Weight",
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ return{
|
|||||||
pasteWrongPlace="¿Pegaste en la carpeta correcta?",
|
pasteWrongPlace="¿Pegaste en la carpeta correcta?",
|
||||||
noFile="Archivo no encontrado",
|
noFile="Archivo no encontrado",
|
||||||
|
|
||||||
|
nowPlaying="Reproduciendo:",
|
||||||
|
|
||||||
VKTchW="Sens. al tacto",
|
VKTchW="Sens. al tacto",
|
||||||
VKOrgW="Sens. al origen",
|
VKOrgW="Sens. al origen",
|
||||||
VKCurW="Sens. Cur. Pos.",
|
VKCurW="Sens. Cur. Pos.",
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ return{
|
|||||||
-- pasteWrongPlace="Paste at wrong place?",
|
-- pasteWrongPlace="Paste at wrong place?",
|
||||||
-- noFile="File not found",
|
-- noFile="File not found",
|
||||||
|
|
||||||
|
nowPlaying="En train de jouer :",
|
||||||
|
|
||||||
VKTchW="Poids du toucher",
|
VKTchW="Poids du toucher",
|
||||||
VKOrgW="Poids d'origine",
|
VKOrgW="Poids d'origine",
|
||||||
VKCurW="Poids de la pos. du cur.",
|
VKCurW="Poids de la pos. du cur.",
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ return{
|
|||||||
pasteWrongPlace="_?X.",
|
pasteWrongPlace="_?X.",
|
||||||
-- noFile="File not found",
|
-- noFile="File not found",
|
||||||
|
|
||||||
|
nowPlaying="~:",
|
||||||
|
|
||||||
VKTchW="Tch↓",
|
VKTchW="Tch↓",
|
||||||
VKOrgW="Org↓",
|
VKOrgW="Org↓",
|
||||||
VKCurW="Cur↓",
|
VKCurW="Cur↓",
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ return{
|
|||||||
pasteWrongPlace="提醒:可能粘贴错地方了",
|
pasteWrongPlace="提醒:可能粘贴错地方了",
|
||||||
noFile="找不到文件",
|
noFile="找不到文件",
|
||||||
|
|
||||||
|
nowPlaying="正在播放:",
|
||||||
|
|
||||||
VKTchW="触摸点权重",
|
VKTchW="触摸点权重",
|
||||||
VKOrgW="原始点权重",
|
VKOrgW="原始点权重",
|
||||||
VKCurW="当前点权重",
|
VKCurW="当前点权重",
|
||||||
|
|||||||
Reference in New Issue
Block a user