Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PU03
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
PU03
Commits
f81caf51
Commit
f81caf51
authored
Jun 13, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
cea8eb1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
129 additions
and
6 deletions
+129
-6
play.component.ts
src/app/play/play.component.ts
+129
-6
No files found.
src/app/play/play.component.ts
View file @
f81caf51
...
@@ -121,6 +121,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -121,6 +121,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
// ------------ 游戏逻辑数据 ------------
m_currentSelectedCard
=
""
m_currentSelectedCard
=
""
m_allUpCards
=
[]
m_allUpCards
=
[]
m_fishes
=
[]
// ------------------------------------
// ------------------------------------
...
@@ -195,9 +196,13 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -195,9 +196,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initCard_up
();
this
.
initCard_up
();
this
.
initCard_down
();
this
.
initCard_down
();
this
.
initCutter
()
this
.
initCutter
()
this
.
initHand
()
this
.
initBlackMask
()
}
}
cleanGameVar
(){
cleanGameVar
(){
this
.
g_enableMapDown
=
true
;
this
.
stopEndPatal
()
this
.
m_currentSelectedCard
=
""
this
.
m_currentSelectedCard
=
""
this
.
m_allUpCards
=
[]
this
.
m_allUpCards
=
[]
}
}
...
@@ -212,7 +217,11 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -212,7 +217,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
endGame
(){
endGame
(){
this
.
g_cartoon
.
getCartoonElement
(
"
mask-layer
"
).
in
(()
=>
{
this
.
g_enableMapDown
=
false
;
this
.
showEndPatal
()
this
.
clapHand
()
})
}
}
...
@@ -736,18 +745,14 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -736,18 +745,14 @@ export class PlayComponent implements OnInit, OnDestroy {
card
.
ref
.
dot
=
dot
;
card
.
ref
.
dot
=
dot
;
// 链接关系
// 链接关系
card
.
lineTo
=
this
.
g_formData
.
textUp
[
index
].
lineTo
card
.
lineTo
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
g_formData
.
textUp
[
index
].
lineTo
))
card
.
complete
=
false
card
.
complete
=
false
card
.
checkLink
=
(
id
)
=>
{
card
.
checkLink
=
(
id
)
=>
{
this
.
log
(
id
,
card
.
lineTo
)
let
index
=
Number
(
id
.
split
(
"
-
"
)[
2
])
let
index
=
Number
(
id
.
split
(
"
-
"
)[
2
])
this
.
log
(
index
)
let
z
=
card
.
lineTo
.
indexOf
(
index
)
let
z
=
card
.
lineTo
.
indexOf
(
index
)
if
(
z
==-
1
){
if
(
z
==-
1
){
this
.
log
(
"
不正确
"
)
return
false
return
false
}
else
{
}
else
{
this
.
log
(
"
正确
"
)
card
.
lineTo
.
splice
(
z
,
1
)
card
.
lineTo
.
splice
(
z
,
1
)
if
(
card
.
lineTo
.
length
==
0
){
if
(
card
.
lineTo
.
length
==
0
){
card
.
complete
=
true
;
card
.
complete
=
true
;
...
@@ -1250,10 +1255,128 @@ checkEndGame(){
...
@@ -1250,10 +1255,128 @@ checkEndGame(){
return
result
return
result
}
}
initHand
(){
let
basePos
=
{
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_canvasHeight
/
2
}
let
elementLeft
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
hand-left
"
,
"
bg_hand1
"
,
391
,
254
,
basePos
.
x
,
basePos
.
y
,
true
)
elementLeft
.
pos_1
=
{
x
:
basePos
.
x
,
y
:
basePos
.
y
}
elementLeft
.
pos_2
=
{
x
:
basePos
.
x
-
50
*
this
.
g_mapScale
,
y
:
basePos
.
y
}
elementLeft
.
ref
.
setScaleXY
(
0
)
let
elementRight
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
hand-right
"
,
"
bg_hand2
"
,
392
,
392
,
basePos
.
x
,
basePos
.
y
,
true
)
elementRight
.
pos_1
=
{
x
:
basePos
.
x
,
y
:
basePos
.
y
}
elementRight
.
pos_2
=
{
x
:
basePos
.
x
+
50
*
this
.
g_mapScale
,
y
:
basePos
.
y
}
elementRight
.
ref
.
setScaleXY
(
0
)
let
fishPos
=
[
{
x
:
this
.
g_canvasWidth
/
2
+
280
*
this
.
g_mapScale
,
y
:
this
.
g_canvasHeight
/
2
-
150
*
this
.
g_mapScale
,
w
:
107
,
h
:
91
},
{
x
:
this
.
g_canvasWidth
/
2
+
150
*
this
.
g_mapScale
,
y
:
this
.
g_canvasHeight
/
2
-
250
*
this
.
g_mapScale
,
w
:
48
,
h
:
69
},
{
x
:
this
.
g_canvasWidth
/
2
+
50
*
this
.
g_mapScale
,
y
:
this
.
g_canvasHeight
/
2
-
220
*
this
.
g_mapScale
,
w
:
64
,
h
:
70
}
]
for
(
let
index
=
0
;
index
<
3
;
index
++
){
let
item
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
hand-fish-
"
+
index
,
"
icon_yu
"
+
(
index
+
1
),
fishPos
[
index
].
w
,
fishPos
[
index
].
h
,
fishPos
[
index
].
x
,
fishPos
[
index
].
y
,
true
)
elementRight
.
pos_1
=
{
x
:
basePos
.
x
,
y
:
basePos
.
y
}
item
.
ref
.
setScaleXY
(
0
)
item
.
show
=
()
=>
{
tweenChange
(
item
.
ref
,
{
scaleX
:
item
.
initScaleX
,
scaleY
:
item
.
initScaleY
},
0.2
,
()
=>
{})
}
item
.
rote
=
(
callback
?)
=>
{
setTimeout
(()
=>
{
this
.
m_setIntervalIDs
.
push
(
setInterval
(()
=>
{
tweenChange
(
item
.
ref
,
{
rotation
:
360
},
0.2
,
()
=>
{
item
.
ref
.
rotation
=
0
callback
&&
callback
})
},
410
))
},
505
);
}
this
.
m_fishes
.
push
(
item
)
}
elementRight
.
pos_2
=
{
x
:
basePos
.
x
+
50
*
this
.
g_mapScale
,
y
:
basePos
.
y
}
elementRight
.
ref
.
setScaleXY
(
0
)
elementLeft
.
clap
=
(
callback
?)
=>
{
tweenChange
(
elementLeft
.
ref
,
{
scaleX
:
elementLeft
.
initScaleX
,
scaleY
:
elementLeft
.
initScaleY
},
0.2
,
()
=>
{
this
.
m_setIntervalIDs
.
push
(
setInterval
(()
=>
{
tweenChange
(
elementLeft
.
ref
,
elementLeft
.
pos_2
,
0.2
,
()
=>
{
tweenChange
(
elementLeft
.
ref
,
elementLeft
.
pos_1
,
0.2
)
})
},
410
))
})
}
elementRight
.
clap
=
(
callback
?)
=>
{
tweenChange
(
elementRight
.
ref
,
{
scaleX
:
elementRight
.
initScaleX
,
scaleY
:
elementRight
.
initScaleY
},
0.2
,
()
=>
{
this
.
m_setIntervalIDs
.
push
(
setInterval
(()
=>
{
tweenChange
(
elementRight
.
ref
,
elementRight
.
pos_2
,
0.2
,
()
=>
{
tweenChange
(
elementRight
.
ref
,
elementRight
.
pos_1
,
0.2
)
})
},
410
))
})
}
this
.
m_fishes
.
forEach
(
item
=>
{
this
.
render
(
item
.
ref
,
9995
)
})
this
.
render
(
elementLeft
.
ref
,
9999
)
this
.
render
(
elementRight
.
ref
,
9990
)
}
clapHand
(
callback
?){
this
.
m_fishes
.
forEach
(
item
=>
{
item
.
show
()
item
.
rote
()
})
this
.
g_cartoon
.
getCartoonElement
(
"
hand-left
"
).
clap
()
this
.
g_cartoon
.
getCartoonElement
(
"
hand-right
"
).
clap
()
}
initBlackMask
(
callback
?){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
mask-layer
"
,
"
_mask_layer_1280_720
"
,
this
.
g_canvasWidth
,
this
.
g_canvasHeight
,
this
.
g_canvasWidth
/
2
,
this
.
g_canvasHeight
/
2
)
element
.
ref
.
visible
=
false
;
element
.
in
=
(
callback
?)
=>
{
element
.
ref
.
visible
=
true
;
tweenChange
(
element
.
ref
,
{
alpha
:
1
},
0.1
,
()
=>
{
callback
&&
callback
()
})
}
element
.
out
=
(
callback
?)
=>
{
tweenChange
(
element
.
ref
,
{
alpha
:
0
},
0.1
,
()
=>
{
element
.
ref
.
visible
=
false
;
callback
&&
callback
()
})
}
this
.
render
(
element
.
ref
,
998
)
}
...
...
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