@@ -17,12 +17,15 @@ local author={
17
17
18
18
local scene = {}
19
19
20
+ local playing
20
21
local selected -- Music selected
21
22
22
23
local bgmList = BGM .getList ()
23
24
if # bgmList == 0 then bgmList = {" [NO BGM]" }end
25
+
24
26
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
26
29
end
27
30
28
31
function scene .wheelMoved (_ ,y )
@@ -42,7 +45,8 @@ function scene.keyDown(key,isRep)
42
45
end
43
46
elseif not isRep then
44
47
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
46
50
BGM .play (bgmList [S ])
47
51
SFX .play (' click' )
48
52
else
@@ -94,40 +98,40 @@ function scene.draw()
94
98
if selected <# bgmList - 1 then GC .print (bgmList [selected + 2 ],322 ,350 + 110 )end
95
99
96
100
-- Title
97
- if BGM . nowPlay then
101
+ if playing then
98
102
mDraw (TEXTURE .title ,570 ,190 ,nil ,.42 )
99
103
local a =- t % 2.3 / 2.3
100
104
GC .setColor (1 ,1 ,1 ,math.min (a ,1 ))
101
105
mDraw (TEXTURE .title_color ,570 ,190 ,nil ,.42 + .062 - .062 * a )
102
106
end
103
107
104
108
-- Music player
105
- if BGM . nowPlay then
109
+ if playing then
106
110
setFont (45 )
107
- GC .shadedPrint (BGM . nowPlay ,710 ,508 ,' left' ,2 )
111
+ GC .shadedPrint (playing ,710 ,508 ,' left' ,2 )
108
112
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 )
110
114
setFont (35 )
111
115
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 )
113
117
114
118
setFont (20 )
115
119
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 ()
118
122
GC .print (STRING .time_simp (cur % dur ).. " / " .. STRING .time_simp (dur ),480 ,626 )
119
123
end
120
124
end
121
125
122
126
scene .widgetList = {
123
127
WIDGET .newText {name = ' title' , x = 30 ,y = 30 ,font = 80 ,align = ' L' },
124
128
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 },
126
130
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 ,
128
132
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
131
135
},
132
136
WIDGET .newSlider {name = ' bgm' , x = 760 ,y = 80 ,w = 400 ,disp = SETval (' bgm' ),code = function (v )SETTING .bgm = v BGM .setVol (SETTING .bgm )end },
133
137
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