Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
East_L215
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
East_L215
Commits
3f27e6d2
Commit
3f27e6d2
authored
Apr 12, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
ff2fcffb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
8 deletions
+82
-8
play.component.ts
src/app/play/play.component.ts
+82
-8
No files found.
src/app/play/play.component.ts
View file @
3f27e6d2
...
...
@@ -108,7 +108,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_showPetalFlag
;
m_elementPetalArr
;
m_showElementPetalFlag
;
m_PetalImage
=
"
petal_
"
// 飘落动画
m_PetalImage
=
"
_scrap-pic-
"
// 飘落动画
m_renderArr
// 渲染队列
m_renderObject
=
[];
m_defaultZindex
=
0
;
...
...
@@ -130,6 +130,8 @@ export class PlayComponent implements OnInit, OnDestroy {
m_currentPickupCardID
=
null
;
m_allSelectedHotZone
=
[];
m_moveAsstantIntervalId
=
null
m_endGame
=
false
;
m_restartGame
=
false
;
// ------------------------------------
...
...
@@ -169,8 +171,10 @@ export class PlayComponent implements OnInit, OnDestroy {
}
restartGame
()
{
this
.
initSystem
();
this
.
cleanGameVar
()
this
.
initGame
()
this
.
m_restartGame
=
true
;
}
...
...
@@ -196,6 +200,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initSelectedCardArea
()
this
.
initStartButton
()
this
.
initBackgroundMusic
()
this
.
initRestartButton
()
}
cleanGameVar
(){
...
...
@@ -214,11 +219,22 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_pickupCard
=
false
;
this
.
m_currentPickupCardID
=
null
;
this
.
m_allSelectedHotZone
=
[]
this
.
m_endGame
=
false
;
this
.
m_restartGame
=
false
;
this
.
disableMoveAsstant
()
}
endGame
(){
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
playAudio
(
"
sm-choice-complete
"
,
false
,
()
=>
{
setTimeout
(()
=>
{
this
.
stopEndPatal
()
this
.
g_cartoon
.
getCartoonElement
(
"
restart-button
"
).
show
();
},
(
500
));
})
this
.
showEndPatal
()
this
.
cardRunControl
(
false
)
this
.
m_endGame
=
true
;
}
// 播放背景音乐
...
...
@@ -228,7 +244,9 @@ export class PlayComponent implements OnInit, OnDestroy {
play
()
})
}
play
()
if
(
!
this
.
m_restartGame
){
play
()
}
}
// 背景
...
...
@@ -391,6 +409,13 @@ export class PlayComponent implements OnInit, OnDestroy {
hilightBackground
.
ref
.
visible
=
true
;
}
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
if
(
this
.
m_endGame
){
if
(
cardContent
.
parentID
.
indexOf
(
"
hot
"
)
!=
-
1
){
this
.
g_cartoon
.
playAudio
(
data
.
audio_url
);
}
this
.
g_enableMapDown
=
true
;
return
}
if
(
cardContent
.
parentID
.
indexOf
(
"
hot
"
)
!=
-
1
){
this
.
g_cartoon
.
playAudio
(
data
.
audio_url
)
cardContent
.
clickTime
=
new
Date
().
getTime
()
...
...
@@ -524,7 +549,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 跑道启停控制
cardRunControl
(
status
){
if
(
!
this
.
m_enableRunway
){
if
(
!
this
.
m_enableRunway
||
this
.
m_endGame
){
return
;
}
let
step
=
Math
.
floor
(
this
.
g_mapScale
*
10000
)
/
20000
;
...
...
@@ -770,13 +795,26 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
click
=
()
=>
{
tweenChange
(
element
.
ref
,
{
scaleX
:
element
.
ref
.
initScaleX
*
0.9
,
scaleY
:
element
.
ref
.
initScaleY
*
0.9
},
0.2
,
()
=>
{
tweenChange
(
element
.
ref
,
{
scaleX
:
element
.
ref
.
initScaleX
,
scaleY
:
element
.
ref
.
initScaleY
},
0.2
)
tweenChange
(
element
.
ref
,
{
scaleX
:
element
.
ref
.
initScaleX
,
scaleY
:
element
.
ref
.
initScaleY
},
0.2
,
()
=>
{
this
.
endGame
()
})
})
element
.
getAllCards
()
let
allIDs
=
element
.
getAllCards
()
let
cardWidth
=
180
*
this
.
g_mapScale
let
allWidth
=
allIDs
.
length
*
cardWidth
let
base_x
=
(
this
.
g_canvasWidth
-
allWidth
+
cardWidth
)
/
2
if
(
allIDs
.
length
>
0
){
allIDs
.
forEach
((
id
,
index
)
=>
{
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
x
:
base_x
+
index
*
cardWidth
},
0.2
)
});
}
element
.
ref
.
scaleX
=
0
;
element
.
ref
.
scaleY
=
0
;
element
.
ref
.
x
=
100000
;
this
.
g_enableMapDown
=
true
;
}
element
.
showHideCheck
=
()
=>
{
console
.
log
(
"
showHideCheck
"
,
element
.
getAllCards
())
if
(
element
.
getAllCards
().
length
>
0
&&
!
element
.
showStatus
){
tweenChange
(
element
.
ref
,
{
scaleX
:
element
.
ref
.
initScaleX
,
scaleY
:
element
.
ref
.
initScaleY
},
0.1
,
()
=>
{
jelly
(
element
.
ref
,
0.5
)
...
...
@@ -789,13 +827,49 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
subscribeMapDownEvent
(
"
start-button
"
,
()
=>
{
console
.
log
(
"
Ok - Clikc
"
)
element
.
click
()
this
.
g_enableMapDown
=
true
;
})
this
.
render
(
element
.
ref
)
}
initRestartButton
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
restart-button
"
,
"
btn-go
"
,
(
w
,
h
)
=>
{
return
{
sx
:
128
*
this
.
g_mapScale
/
w
,
sy
:
128
*
this
.
g_mapScale
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
-
36
*
this
.
g_mapScale
-
(
h
/
2
)
*
this
.
g_mapScale
,
y
:
554
*
this
.
g_mapScale
+
(
h
/
2
)
*
this
.
g_mapScale
}
})
element
.
ref
.
scaleX
=
0
;
element
.
ref
.
scaleY
=
0
;
element
.
show
=
()
=>
{
console
.
log
(
"
Show
"
)
element
.
ref
.
scaleX
=
element
.
ref
.
initScaleX
;
element
.
ref
.
scaleY
=
element
.
ref
.
initScaleY
;
}
element
.
hide
=
()
=>
{
element
.
ref
.
scaleX
=
0
;
element
.
ref
.
scaleY
=
0
;
}
this
.
subscribeMapDownEvent
(
"
restart-button
"
,
()
=>
{
console
.
log
(
"
Res - click
"
)
element
.
hide
()
this
.
restartGame
()
})
this
.
render
(
element
.
ref
)
}
enableMoveAsstant
(
element
){
if
(
this
.
m_moveAsstantIntervalId
){
clearInterval
(
this
.
m_moveAsstantIntervalId
)
...
...
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