Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DF-L220
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
DF-L220
Commits
8c6bda2d
Commit
8c6bda2d
authored
Mar 17, 2020
by
Chen Jiping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善
parent
dd10053f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
123 additions
and
23 deletions
+123
-23
play.component.ts
src/app/play/play.component.ts
+119
-22
resources.js
src/app/play/resources.js
+4
-1
play.png
src/assets/play/play.png
+0
-0
playing.png
src/assets/play/playing.png
+0
-0
playing_1.png
src/assets/play/playing_1.png
+0
-0
prompt.png
src/assets/play/prompt.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
8c6bda2d
...
...
@@ -107,6 +107,8 @@ export class PlayComponent implements OnInit, OnDestroy {
playingPic
;
playingPic_1
;
//正在播放
playing
;
...
...
@@ -347,9 +349,6 @@ export class PlayComponent implements OnInit, OnDestroy {
* @param callback
*/
playPracticeAudio
(
key
,
now
=
false
,
callback
=
null
){
this
.
playPic
.
alpha
=
0
;
this
.
playingPic
.
alpha
=
1
;
this
.
playAudio
(
key
,
now
,
callback
);
...
...
@@ -359,27 +358,67 @@ export class PlayComponent implements OnInit, OnDestroy {
}
showPlayStauts
(){
if
(
this
.
playing
){
const
show1
=
()
=>
{
if
(
this
.
playing
){
this
.
playPic
.
alpha
=
0
;
this
.
playingPic
.
alpha
=
1
;
this
.
playingPic_1
.
alpha
=
0
;
setTimeout
(()
=>
{
show2
();
},
500
);
}
else
{
this
.
setPause
();
}
if
(
this
.
playPic
.
alpha
==
0
){
};
const
show2
=
()
=>
{
if
(
this
.
playing
){
this
.
playPic
.
alpha
=
0
;
this
.
playingPic
.
alpha
=
0
;
this
.
playPic
.
alpha
=
1
this
.
playingPic_1
.
alpha
=
1
;
setTimeout
(()
=>
{
show3
();
},
500
);
}
else
{
this
.
playingPic
.
alpha
=
1
;
this
.
playPic
.
alpha
=
0
;
this
.
setPause
();
}
};
setTimeout
(()
=>
{
this
.
showPlayStauts
();
},
1000
);
}
else
{
this
.
playingPic
.
alpha
=
0
;
this
.
playPic
.
alpha
=
1
;
}
const
show3
=
()
=>
{
if
(
this
.
playing
){
this
.
playPic
.
alpha
=
1
;
this
.
playingPic
.
alpha
=
0
;
this
.
playingPic_1
.
alpha
=
0
;
setTimeout
(()
=>
{
show1
();
},
500
);
}
else
{
this
.
setPause
();
}
};
show1
();
}
setPause
(){
this
.
playingPic
.
alpha
=
0
;
this
.
playPic
.
alpha
=
1
;
this
.
playingPic_1
.
alpha
=
0
;
}
playAudio
(
key
,
now
=
false
,
callback
=
null
)
{
const
audio
=
this
.
audioObj
[
key
];
...
...
@@ -408,6 +447,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
playingPic
.
alpha
=
0
;
this
.
playingPic_1
.
alpha
=
0
;
this
.
pauseAudio
(
key
,
callback
);
this
.
playing
=
false
;
...
...
@@ -788,6 +829,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
renderArr
.
push
(
playingPic
);
this
.
playingPic
=
playingPic
;
const
playingPic_1
=
new
MySprite
();
playingPic_1
.
init
(
this
.
images
.
get
(
'
playing_1
'
));
playingPic_1
.
x
=
btnPlay
.
x
;
playingPic_1
.
y
=
btnPlay
.
y
;
playingPic_1
.
alpha
=
0
;
playingPic_1
.
setScaleXY
(
this
.
mapScale
);
this
.
renderArr
.
push
(
playingPic_1
);
this
.
playingPic_1
=
playingPic_1
;
}
initPic
()
{
...
...
@@ -1393,6 +1445,9 @@ export class PlayComponent implements OnInit, OnDestroy {
//如果未全部结束,则初始化下一个练习题
if
(
!
end
){
this
.
showPrompt
();
setTimeout
(()
=>
{
tweenChange
(
cover
,
{
alpha
:
0
},
6
,
()
=>
{
...
...
@@ -1403,6 +1458,32 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
/**
* 显示练习题结束提示
*/
showPrompt
(){
//显示练习题剩余提示
const
prompt
=
new
MySprite
();
prompt
.
init
(
this
.
images
.
get
(
'
prompt
'
));
prompt
.
setScaleXY
(
this
.
mapScale
);
prompt
.
y
=
this
.
canvasHeight
/
2
;
prompt
.
x
=
this
.
canvasWidth
/
2
;
this
.
endPageArr
.
push
(
prompt
);
let
prompt_val
=
new
Label
();
prompt_val
.
text
=
(
this
.
nextPracticeIndex
-
1
)
+
"
|
"
+
this
.
data
.
practices
.
length
;
prompt_val
.
textAlign
=
'
middle
'
;
prompt_val
.
fontSize
=
50
;
prompt_val
.
fontName
=
"
ARIALBD
"
;
prompt_val
.
fontColor
=
"
#FFFFFF
"
;
prompt_val
.
refreshSize
();
prompt_val
.
x
=
-
prompt_val
.
width
/
2
;
prompt_val
.
y
=
0
;
prompt
.
addChild
(
prompt_val
);
prompt
.
childDepandAlpha
=
true
;
}
/**
* 添加结束花辨效果
*/
...
...
@@ -1499,6 +1580,13 @@ export class PlayComponent implements OnInit, OnDestroy {
return
;
}
if
(
this
.
checkClickTarget
(
this
.
playingPic_1
)
&&
this
.
playing
)
{
this
.
pausePracticeAudio
(
'
practice_
'
+
(
this
.
nextPracticeIndex
-
1
));
return
;
}
}
mapMove
(
event
)
{
...
...
@@ -1548,13 +1636,13 @@ export class PlayComponent implements OnInit, OnDestroy {
};
let
out
=
-
bullet_pic
.
height
;
tweenChange
(
bullet
.
pic
,
{
y
:
out
},
1
,
()
=>
{
let
bulletTween
=
tweenChange
(
bullet
.
pic
,
{
y
:
out
},
1
,
()
=>
{
removeItemFromArr
(
this
.
bulletRenderArr
,
bullet
);
},
null
,()
=>
{
this
.
checkHit
(
bullet
);
this
.
checkHit
(
bullet
,
bulletTween
);
});
...
...
@@ -1602,8 +1690,9 @@ export class PlayComponent implements OnInit, OnDestroy {
/**
* 检查是否碰撞
* @param item
* @param bulletTween
*/
checkHit
(
item
){
checkHit
(
item
,
bulletTween
){
if
(
!
item
){
return
;
...
...
@@ -1636,10 +1725,18 @@ export class PlayComponent implements OnInit, OnDestroy {
break
;
}
item
.
pic
.
scaleY
=
0
;
item
.
pic
.
scaleX
=
0
;
bulletTween
.
pause
();
//延迟隐藏子弹
setTimeout
(()
=>
{
item
.
pic
.
scaleY
=
0
;
item
.
pic
.
scaleX
=
0
;
item
.
pic
.
alpha
=
0
;
item
.
pic
.
alpha
=
0
;
bulletTween
.
resume
();
},
100
);
item
.
hit
=
true
;
...
...
src/app/play/resources.js
View file @
8c6bda2d
...
...
@@ -23,8 +23,11 @@ const res = [
[
'
play
'
,
"
assets/play/play.png
"
],
[
'
playing
'
,
"
assets/play/playing.png
"
],
[
'
playing_1
'
,
"
assets/play/playing_1.png
"
],
[
'
start
'
,
"
assets/play/start.png
"
],
[
'
restart
'
,
"
assets/play/restart.png
"
]
[
'
restart
'
,
"
assets/play/restart.png
"
],
[
'
prompt
'
,
"
assets/play/prompt.png
"
]
];
...
...
src/assets/play/play.png
View replaced file @
dd10053f
View file @
8c6bda2d
21.5 KB
|
W:
|
H:
21.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/assets/play/playing.png
View replaced file @
dd10053f
View file @
8c6bda2d
22.2 KB
|
W:
|
H:
21.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/assets/play/playing_1.png
0 → 100644
View file @
8c6bda2d
22.2 KB
src/assets/play/prompt.png
0 → 100644
View file @
8c6bda2d
1.65 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