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
cac2c33e
Commit
cac2c33e
authored
Jun 18, 2020
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 火箭没飞出屏幕问题
parent
5bd975e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
play.component.ts
src/app/play/play.component.ts
+31
-16
No files found.
src/app/play/play.component.ts
View file @
cac2c33e
...
...
@@ -17,7 +17,6 @@ import {Subject} from 'rxjs';
import
{
debounceTime
}
from
'
rxjs/operators
'
;
import
TWEEN
from
'
@tweenjs/tween.js
'
;
import
{
tar
}
from
"
compressing
"
;
@
Component
({
...
...
@@ -82,6 +81,7 @@ export class PlayComponent implements OnInit, OnDestroy {
private
endPageArr
:
any
;
private
petalTime
:
number
;
private
isFly
:
boolean
;
private
rocketBase
:
MySprite
;
@
HostListener
(
'
window:resize
'
,
[
'
$event
'
])
...
...
@@ -436,6 +436,21 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
data
.
pic_url
=
'
assets/play/default/pic.jpg
'
;
this
.
data
.
pic_url_2
=
'
assets/play/default/pic.jpg
'
;
}
if
(
!
this
.
data
.
sentences
)
{
this
.
data
.
sentences
=
[
{
text
:
'
1. test sentence ____ .
'
},
{
text
:
'
2. test sentence ____ .
'
}
];
}
if
(
!
this
.
data
.
audio_url
)
{
this
.
data
.
audio_url
=
'
assets/play/default/audio.mp3
'
;
}
}
...
...
@@ -520,6 +535,7 @@ export class PlayComponent implements OnInit, OnDestroy {
rocketBase
.
x
=
this
.
borad
.
x
;
rocketBase
.
y
=
this
.
canvasHeight
-
20
*
this
.
mapScale
;
rocketBase
.
setScaleXY
(
this
.
mapScale
);
this
.
rocketBase
=
rocketBase
;
const
rocket
=
this
.
createSprite
(
'
rocket
'
);
rocket
.
y
=
-
rocket
.
height
/
2
-
30
;
...
...
@@ -655,7 +671,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const
labelOffX
=
10
;
const
labelMaxWidth
=
sentenceBg
.
width
-
labelOffX
*
2
;
const
label
=
new
Label
();
label
.
text
=
sentence
.
text
+
'
Fg
'
;
label
.
text
=
sentence
.
text
;
label
.
fontColor
=
'
#f3f1da
'
;
label
.
fontSize
=
45
;
label
.
fontName
=
'
MMTextBook
'
;
...
...
@@ -916,13 +932,23 @@ export class PlayComponent implements OnInit, OnDestroy {
return
;
}
}
if
(
this
.
isFly
)
{
return
;
}
this
.
isFly
=
true
;
this
.
showSmoke
();
this
.
animationId
=
setTimeout
(()
=>
{
this
.
rocketFly
();
},
100
);
}
private
rocketFly
()
{
const
flyTime
=
2.7
;
tweenChange
(
this
.
rocket
,
{
x
:
this
.
rocket
.
x
,
y
:
-
this
.
canvasHeight
},
flyTime
,
()
=>
{
tweenChange
(
this
.
rocket
,
{
x
:
this
.
rocket
.
x
,
y
:
-
(
this
.
canvasHeight
*
1.5
+
this
.
rocket
.
height
)
/
this
.
rocketBase
.
scaleY
},
flyTime
,
()
=>
{
this
.
showEndPatal
();
},
TWEEN
.
Easing
.
Quintic
.
In
);
...
...
@@ -950,12 +976,10 @@ export class PlayComponent implements OnInit, OnDestroy {
const
shakeAnima
=
(
data
)
=>
{
const
offX
=
data
[
0
]
/
3
;
const
time
=
shakeTime
;
tweenChange
(
this
.
rocket
,
{
x
:
baseX
+
offX
},
time
,
()
=>
{
tweenChange
(
this
.
rocket
,
{
x
:
baseX
+
offX
},
shakeTime
,
()
=>
{
if
(
shakeOffArr
.
length
>
0
)
{
const
shakeData
=
shakeOffArr
.
shift
();
shakeAnima
(
shakeData
);
}
else
{
}
});
}
...
...
@@ -1045,18 +1069,13 @@ export class PlayComponent implements OnInit, OnDestroy {
}
private
showSmoke
()
{
if
(
this
.
isFly
)
{
return
;
}
this
.
isFly
=
true
;
const
anima
=
new
MyAnimation
();
anima
.
y
=
this
.
rocket
.
height
/
2
-
30
;
this
.
rocket
.
addChild
(
anima
,
-
1
);
for
(
let
i
=
1
;
i
<
10
;
i
++
)
{
const
key
=
'
smoke_
'
+
i
;
anima
.
addFrameByImg
(
this
.
images
.
get
(
key
));
anima
.
addFrameByImg
(
this
.
images
.
get
(
'
smoke_
'
+
i
));
}
anima
.
delayPerUnit
=
0.1
;
anima
.
loop
=
false
;
...
...
@@ -1067,10 +1086,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
anima
.
play
();
this
.
animationId
=
setTimeout
(()
=>
{
this
.
rocketFly
();
},
100
);
this
.
playAudio
(
'
smoke_mp3
'
);
}
...
...
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