Skip to content

Commit 9e0e93d

Browse files
committedSep 27, 2022
修音乐室和一些bgm模块更新后的小错误
框架跟进a
1 parent d031dc3 commit 9e0e93d

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed
 

‎Zframework

Submodule Zframework updated 1 file

‎parts/scenes/app_console.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ local commands={}do
442442
commands.playbgm={
443443
code=function(bgm)
444444
if bgm~=""then
445-
if bgm~=BGM.nowPlay then
445+
if bgm~=BGM.getPlaying()[1] then
446446
if BGM.play(bgm)then
447447
log("Now playing: "..bgm)
448448
else

‎parts/scenes/launchpad.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pad={x=140,y=65,page=1,
2020
function()pad.page=4 end,
2121
function()pad.page=5 end,
2222
function()pad.page=6 end,
23-
function()BGM.seek(0)BGM.play(BGM.nowPlay)end,
23+
function()BGM.set('all','seek',0)BGM.play()end,
2424
function()BGM.stop()end,
2525
},
2626
funcAlpha=TABLE.new(0,8),

‎parts/scenes/music.lua

+17-13
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ local author={
1717

1818
local scene={}
1919

20+
local playing
2021
local selected--Music selected
2122

2223
local bgmList=BGM.getList()
2324
if #bgmList==0 then bgmList={"[NO BGM]"}end
25+
2426
function scene.sceneInit()
25-
selected=TABLE.find(bgmList,BGM.nowPlay)or 1
27+
playing=BGM.getPlaying()[1]
28+
selected=TABLE.find(bgmList,playing)or 1
2629
end
2730

2831
function scene.wheelMoved(_,y)
@@ -42,7 +45,8 @@ function scene.keyDown(key,isRep)
4245
end
4346
elseif not isRep then
4447
if key=='return'or key=='space'then
45-
if BGM.nowPlay~=bgmList[S]then
48+
playing=BGM.getPlaying()[1]
49+
if playing~=bgmList[S]then
4650
BGM.play(bgmList[S])
4751
SFX.play('click')
4852
else
@@ -94,40 +98,40 @@ function scene.draw()
9498
if selected<#bgmList-1 then GC.print(bgmList[selected+2],322,350+110)end
9599

96100
--Title
97-
if BGM.nowPlay then
101+
if playing then
98102
mDraw(TEXTURE.title,570,190,nil,.42)
99103
local a=-t%2.3/2.3
100104
GC.setColor(1,1,1,math.min(a,1))
101105
mDraw(TEXTURE.title_color,570,190,nil,.42+.062-.062*a)
102106
end
103107

104108
--Music player
105-
if BGM.nowPlay then
109+
if playing then
106110
setFont(45)
107-
GC.shadedPrint(BGM.nowPlay,710,508,'left',2)
111+
GC.shadedPrint(playing,710,508,'left',2)
108112
GC.setColor(sin(t*.5)*.2+.8,sin(t*.7)*.2+.8,sin(t)*.2+.8)
109-
GC.print(BGM.nowPlay,710,508)
113+
GC.print(playing,710,508)
110114
setFont(35)
111115
GC.setColor(1,sin(t*2.6)*.5+.5,sin(t*2.6)*.5+.5)
112-
GC.print(author[BGM.nowPlay]or"MrZ",670,465)
116+
GC.print(author[playing]or"MrZ",670,465)
113117

114118
setFont(20)
115119
GC.setColor(COLOR.Z)
116-
local cur=BGM.playing:tell()
117-
local dur=BGM.playing:getDuration()
120+
local cur=BGM.tell()
121+
local dur=BGM.getDuration()
118122
GC.print(STRING.time_simp(cur%dur).." / "..STRING.time_simp(dur),480,626)
119123
end
120124
end
121125

122126
scene.widgetList={
123127
WIDGET.newText{name='title', x=30,y=30,font=80,align='L'},
124128
WIDGET.newText{name='arrow', x=270,y=360,font=45,align='L'},
125-
WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function()return not BGM.nowPlay end},
129+
WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function()return not playing end},
126130
WIDGET.newSlider{name='slide',x=480,y=600,w=400,
127-
disp=function()return BGM.playing:tell()/BGM.playing:getDuration()%1 end,
131+
disp=function()return BGM.tell()/BGM.getDuration()%1 end,
128132
show=false,
129-
code=function(v)BGM.seek(v*BGM.playing:getDuration())end,
130-
hideF=function()return not BGM.nowPlay end
133+
code=function(v)BGM.set('all','seek',v*BGM.getDuration())end,
134+
hideF=function()return not playing end
131135
},
132136
WIDGET.newSlider{name='bgm', x=760,y=80,w=400,disp=SETval('bgm'),code=function(v)SETTING.bgm=v BGM.setVol(SETTING.bgm)end},
133137
WIDGET.newButton{name='up', x=200,y=250,w=120,sound=false,code=pressKey'up',hideF=function()return selected==1 end,font=60,fText=CHAR.key.up},

0 commit comments

Comments
 (0)
Please sign in to comment.