Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pu09
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
pu09
Commits
92c31301
Commit
92c31301
authored
Jun 12, 2020
by
Seaborn Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: 播放器
parent
eff49446
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
5 deletions
+79
-5
play.component.ts
src/app/play/play.component.ts
+74
-5
resources.js
src/app/play/resources.js
+5
-0
btn_current_position.png
src/assets/play/btn_current_position.png
+0
-0
btn_pause.png
src/assets/play/btn_pause.png
+0
-0
btn_play.png
src/assets/play/btn_play.png
+0
-0
progressbar_bg.png
src/assets/play/progressbar_bg.png
+0
-0
progressbar_played.png
src/assets/play/progressbar_played.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
92c31301
import
{
Component
,
ElementRef
,
HostListener
,
OnDestroy
,
OnInit
,
ViewChild
}
from
'
@angular/core
'
;
import
{
Label
,
MySprite
,
tweenChange
,
}
from
'
./Unit
'
;
import
{
Label
,
MySprite
,
tweenChange
,}
from
'
./Unit
'
;
import
{
res
,
resAudio
}
from
'
./resources
'
;
import
{
Subject
}
from
'
rxjs
'
;
...
...
@@ -488,6 +484,8 @@ export class PlayComponent implements OnInit, OnDestroy {
initView
()
{
this
.
initBg
();
this
.
initBoard
();
this
.
initAudioPlayer
();
// initBoard();
// initAudioPlayer();
...
...
@@ -710,5 +708,76 @@ export class PlayComponent implements OnInit, OnDestroy {
}
private
initAudioPlayer
()
{
const
audioPlayer
=
this
.
createAudioPlayer
();
audioPlayer
.
x
=
1200
;
audioPlayer
.
y
=
100
;
this
.
renderArr
.
push
(
audioPlayer
);
}
private
createAudioPlayer
()
{
const
audioPlayer
=
new
MySprite
();
audioPlayer
.
addChild
(
this
.
createPlayPauseButton
());
const
progressBar
=
this
.
createProgressBar
();
progressBar
.
x
=
80
;
progressBar
.
y
=
20
;
audioPlayer
.
addChild
(
progressBar
);
// addCurrentTime();
// addTotalTime();
return
audioPlayer
;
}
private
createPlayPauseButton
()
{
const
button
=
this
.
createSprite
(
'
btn_play
'
);
const
btnPause
=
new
MySprite
();
btnPause
.
init
(
this
.
images
.
get
(
'
btn_pause
'
));
this
.
hide
(
btnPause
);
button
.
addChild
(
btnPause
);
return
button
;
}
private
createSprite
(
key
:
string
)
{
const
sprite
=
new
MySprite
();
sprite
.
init
(
this
.
images
.
get
(
key
));
return
sprite
;
}
private
hide
(
element
:
MySprite
)
{
element
.
alpha
=
0
;
}
private
createProgressBar
()
{
const
container
=
new
MySprite
();
const
progressBarBg
=
this
.
createSprite
(
'
progressbar_bg
'
);
progressBarBg
.
anchorX
=
0
;
const
progressBarPlayed
=
this
.
createSprite
(
'
progressbar_played
'
);
progressBarPlayed
.
anchorX
=
0
;
progressBarPlayed
.
scaleX
=
0
;
const
currentTime
=
this
.
createTime
();
currentTime
.
text
=
'
0:00
'
;
currentTime
.
x
=
-
10
;
currentTime
.
y
=
-
35
;
const
totalTime
=
this
.
createTime
();
totalTime
.
text
=
'
1:24
'
;
totalTime
.
refreshSize
();
totalTime
.
x
=
progressBarBg
.
width
-
totalTime
.
width
;
totalTime
.
y
=
currentTime
.
y
;
container
.
addChild
(
progressBarBg
);
container
.
addChild
(
progressBarPlayed
);
container
.
addChild
(
this
.
createSprite
(
'
btn_current_position
'
));
container
.
addChild
(
currentTime
)
container
.
addChild
(
totalTime
)
return
container
;
}
private
createTime
()
{
const
label
=
new
Label
();
label
.
fontSize
=
28
;
label
.
fontColor
=
'
#FFFFFF
'
;
return
label
;
}
}
src/app/play/resources.js
View file @
92c31301
...
...
@@ -2,6 +2,11 @@ const res = [
[
'
bg
'
,
"
assets/play/bg.jpg
"
],
[
'
board
'
,
"
assets/play/board.png
"
],
[
'
btn_play
'
,
"
assets/play/btn_play.png
"
],
[
'
btn_pause
'
,
"
assets/play/btn_pause.png
"
],
[
'
btn_current_position
'
,
"
assets/play/btn_current_position.png
"
],
[
'
progressbar_bg
'
,
"
assets/play/progressbar_bg.png
"
],
[
'
progressbar_played
'
,
"
assets/play/progressbar_played.png
"
],
[
'
btn_left
'
,
"
assets/play/btn_left.png
"
],
[
'
btn_right
'
,
"
assets/play/btn_right.png
"
],
// ['text_bg', "assets/play/text_bg.png"],
...
...
src/assets/play/btn_current_position.png
0 → 100644
View file @
92c31301
953 Bytes
src/assets/play/btn_pause.png
0 → 100644
View file @
92c31301
14.5 KB
src/assets/play/btn_play.png
0 → 100644
View file @
92c31301
10.5 KB
src/assets/play/progressbar_bg.png
0 → 100644
View file @
92c31301
1.02 KB
src/assets/play/progressbar_played.png
0 → 100644
View file @
92c31301
1.02 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment