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
5f1054f1
Commit
5f1054f1
authored
Apr 10, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
8fa94689
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
9 deletions
+77
-9
play.component.ts
src/app/play/play.component.ts
+77
-9
No files found.
src/app/play/play.component.ts
View file @
5f1054f1
...
...
@@ -107,6 +107,15 @@ export class PlayComponent implements OnInit, OnDestroy {
m_runIntervalId
=
null
m_runStatus
=
false
;
m_mouseInRunway
=
false
;
m_leftBuffer
=
[]
m_rightBuffer
=
[]
m_lineIndex
=
0
;
m_requestAfterCard
=
false
;
m_requestID
=
null
;
m_enableRunway
=
false
;
m_lastCard_x
=
null
;
m_lastCard_id
=
null
;
// ------------------------------------
...
...
@@ -178,6 +187,15 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
stopAllAudio
()
this
.
m_allCardIds
=
[]
this
.
cardRunControl
(
false
)
this
.
m_leftBuffer
=
[]
this
.
m_rightBuffer
=
[]
this
.
m_lineIndex
=
0
;
this
.
m_requestAfterCard
=
false
;
this
.
m_requestID
=
null
;
this
.
m_enableRunway
=
false
;
this
.
m_lastCard_x
=
null
;
this
.
m_lastCard_id
=
null
;
}
endGame
(){
...
...
@@ -268,8 +286,20 @@ export class PlayComponent implements OnInit, OnDestroy {
let
boundingBox
=
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
getBoundingBox
()
let
cardWidth
=
251
*
this
.
g_mapScale
let
cardNumber
=
Math
.
ceil
(
this
.
g_canvasWidth
/
cardWidth
);
for
(
let
index
=
0
;
index
<
cardNumber
;
index
++
){
this
.
render
(
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
).
ref
)
for
(
let
index
=
0
;
index
<
6
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
);
if
(
index
+
1
==
cardNumber
){
this
.
m_lastCard_x
=
index
*
cardWidth
}
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
newCard
.
waiting
=
true
;
this
.
m_rightBuffer
.
push
(
newCard
.
id
)
}
if
(
newCard
.
ref
.
x
+
115
*
this
.
g_mapScale
>
this
.
g_canvasWidth
){
this
.
m_enableRunway
=
true
;
}
this
.
render
(
newCard
.
ref
)
}
}
...
...
@@ -286,6 +316,7 @@ export class PlayComponent implements OnInit, OnDestroy {
y
:
y
+
150
*
this
.
g_mapScale
}
})
element
.
lineIndex
=
this
.
m_lineIndex
++
;
let
imageContainer
=
new
MySprite
()
imageContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
card
"
))
...
...
@@ -296,7 +327,7 @@ export class PlayComponent implements OnInit, OnDestroy {
textContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
text_container
"
))
textContainer
.
setScaleXY
(
150
/
textContainer
.
width
)
let
textContent
=
new
Label
()
textContent
.
text
=
"
AVA
"
// + index + "This is for test"
textContent
.
text
=
"
T:
"
+
index
textContent
.
fontColor
=
"
#e05e14
"
;
textContent
.
fontName
=
"
BerlinSansFBDemi-Bold
"
;
textContent
.
maxSingalLineWidth
=
170
*
this
.
g_mapScale
...
...
@@ -304,22 +335,27 @@ export class PlayComponent implements OnInit, OnDestroy {
textContent
.
fontSize
=
50
textContainer
.
addChild
(
textContent
)
textContainer
.
x
=
-
textContainer
.
width
/
4
// textContainer.y = -textContainer.height/2
element
.
ref
.
addChild
(
textContainer
)
return
element
;
}
cardRunControl
(
status
){
if
(
!
this
.
m_enableRunway
){
return
;
}
let
step
=
1
*
this
.
g_mapScale
;
let
cardElement
=
null
;
let
max_x
=
0
;
if
(
status
){
this
.
m_runIntervalId
=
setInterval
(()
=>
{
max_x
=
0
;
this
.
m_allCardIds
.
forEach
((
id
)
=>
{
this
.
g_cartoon
.
getCartoonElementRef
(
id
).
x
-=
step
cardElement
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
if
(
!
cardElement
.
waiting
){
cardElement
.
ref
.
x
-=
step
}
this
.
cardRecyclingAndPreparation
(
id
)
})
this
.
m_runStatus
=
true
;
},
10
)
...
...
@@ -342,6 +378,38 @@ export class PlayComponent implements OnInit, OnDestroy {
return
element
;
}
cardRecyclingAndPreparation
(
id
){
let
ele
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
let
x
=
ele
.
ref
.
x
;
let
width
=
230
*
this
.
g_mapScale
;
if
(
(
x
+
width
*
0.5
)
<
this
.
g_canvasWidth
&&
(
(
x
+
width
*
0.5
)
>
this
.
g_canvasWidth
-
21
*
this
.
g_mapScale
)
&&
!
this
.
m_requestAfterCard
){
this
.
m_requestAfterCard
=
true
;
console
.
log
(
"
Request: id=
"
+
id
)
this
.
m_requestID
=
id
// + 115*this.g_mapScale;
}
if
(
this
.
m_rightBuffer
[
0
]
&&
this
.
m_requestAfterCard
){
this
.
m_requestAfterCard
=
false
;
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]).
alpha
=
0
;
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]).
x
=
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_requestID
).
x
+
width
+
21
*
this
.
g_mapScale
tweenChange
(
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]),
{
alpha
:
1
},
0.2
)
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_rightBuffer
[
0
]).
waiting
=
false
;
this
.
m_rightBuffer
.
splice
(
0
,
1
)
}
if
(
x
<
-
0.5
*
width
&&
!
this
.
g_cartoon
.
getCartoonElement
(
id
).
waiting
){
console
.
log
(
"
回收:
"
+
id
)
this
.
g_cartoon
.
getCartoonElement
(
id
).
waiting
=
true
;
this
.
m_rightBuffer
.
push
(
id
)
}
}
duplicateCard
(){
}
...
...
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