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
209e23c0
Commit
209e23c0
authored
Apr 11, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
3f66e0db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
17 deletions
+90
-17
play.component.ts
src/app/play/play.component.ts
+90
-17
No files found.
src/app/play/play.component.ts
View file @
209e23c0
...
...
@@ -185,6 +185,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_allCardIds
=
[]
this
.
cardRunControl
(
false
)
clearInterval
(
this
.
m_runIntervalId
)
this
.
m_runIntervalId
=
null
this
.
m_rightBuffer
=
[]
this
.
m_requestAfterCard
=
false
;
this
.
m_requestID
=
null
;
...
...
@@ -213,7 +214,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 标题
initTitle
(){
let
titleText
=
"
Drag and drop games
"
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
'
title
'
,
"
bg_title
"
,
576
*
this
.
g_mapScale
,
66
*
this
.
g_mapScale
,
this
.
g_canvasWidth
/
2
,
this
.
g_cartoon
.
getOrigin
().
y
+
48
*
this
.
g_mapScale
)
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
'
title
'
,
"
bg_title
"
,
576
*
this
.
g_mapScale
,
66
*
this
.
g_mapScale
,
this
.
g_canvasWidth
/
2
,
this
.
g_cartoon
.
getOrigin
().
y
+
34
*
this
.
g_mapScale
)
let
title
=
new
Label
()
title
.
text
=
titleText
title
.
fontColor
=
"
#fffc1d
"
;
...
...
@@ -235,7 +236,7 @@ export class PlayComponent implements OnInit, OnDestroy {
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_cartoon
.
getOrigin
().
y
+
(
h
/
2
)
*
this
.
g_mapScale
+
96
*
this
.
g_mapScale
y
:
this
.
g_cartoon
.
getOrigin
().
y
+
(
h
/
2
)
*
this
.
g_mapScale
+
78
*
this
.
g_mapScale
}
})
...
...
@@ -288,9 +289,9 @@ export class PlayComponent implements OnInit, OnDestroy {
// 选择卡片
initCards
(){
let
boundingBox
=
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
getBoundingBox
()
let
cardWidth
=
2
51
*
this
.
g_mapScale
let
cardWidth
=
2
44
*
this
.
g_mapScale
let
cardNumber
=
Math
.
ceil
(
this
.
g_canvasWidth
/
cardWidth
);
for
(
let
index
=
0
;
index
<
8
;
index
++
){
for
(
let
index
=
0
;
index
<
50
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
);
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
...
...
@@ -302,7 +303,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
render
(
newCard
.
ref
)
}
console
.
log
(
this
.
m_rightBuffer
)
}
createCard
(
index
,
x
,
y
){
...
...
@@ -314,7 +314,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
},
(
w
,
h
)
=>
{
return
{
x
:
x
+
(
w
/
2
)
*
this
.
g_mapScale
+
21
*
this
.
g_mapScale
,
x
:
x
+
(
w
/
2
)
*
this
.
g_mapScale
+
14
*
this
.
g_mapScale
,
y
:
y
+
150
*
this
.
g_mapScale
}
})
...
...
@@ -346,7 +346,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
this
.
m_enableRunway
){
return
;
}
let
step
=
1
*
this
.
g_mapScale
;
let
step
=
Math
.
floor
(
this
.
g_mapScale
*
10000
)
/
20000
;
let
cardElement
=
null
;
this
.
m_runStatus
=
status
if
(
!
this
.
m_runIntervalId
){
...
...
@@ -369,16 +369,89 @@ export class PlayComponent implements OnInit, OnDestroy {
// 灯光
initLights
(){
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
addChild
(
this
.
createLights
(
0
,
0
).
ref
)
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
addChild
(
this
.
createLights
(
1
,
0
).
ref
)
}
createLights
(
line
,
row
){
let
totalLightCount
=
Math
.
ceil
(
this
.
g_canvasWidth
/
(
82
*
this
.
g_mapScale
))
let
baseY
=
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
y
let
height
=
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
height
*
this
.
g_mapScale
let
pos_y
=
[
-
126
,
126
baseY
-
height
/
2
+
22
*
this
.
g_mapScale
,
baseY
+
height
/
2
-
22
*
this
.
g_mapScale
]
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
`
,
"
light-1
"
,
48
,
48
,
0
,
pos_y
[
line
])
return
element
;
let
base_x
=
24
*
this
.
g_mapScale
;
for
(
let
line
=
0
;
line
<
2
;
line
++
){
for
(
let
row
=
0
;
row
<
totalLightCount
;
row
++
){
this
.
render
(
this
.
createLights
(
line
,
row
,
base_x
,
pos_y
,
true
).
ref
)
}
}
for
(
let
line
=
0
;
line
<
2
;
line
++
){
for
(
let
row
=
0
;
row
<
totalLightCount
;
row
++
){
this
.
render
(
this
.
createLights
(
line
,
row
,
base_x
,
pos_y
,
false
).
ref
)
}
}
this
.
runWaterLights
(
totalLightCount
)
}
createLights
(
line
,
row
,
base_x
,
pos_y
,
stuats
){
if
(
stuats
){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-on`
,
"
light-2
"
,
48
*
this
.
g_mapScale
,
48
*
this
.
g_mapScale
,
base_x
+
row
*
82
*
this
.
g_mapScale
,
pos_y
[
line
])
element
.
ref
.
visible
=
false
;
return
element
;
}
else
{
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-off`
,
"
light-1
"
,
48
*
this
.
g_mapScale
,
48
*
this
.
g_mapScale
,
base_x
+
row
*
82
*
this
.
g_mapScale
,
pos_y
[
line
])
return
element
;
}
}
lightOn
(
line
,
row
){
this
.
g_cartoon
.
getCartoonElementRef
(
`water-light-
${
line
}
-
${
row
}
-on`
).
visible
=
true
;
}
lightOff
(
line
,
row
){
this
.
g_cartoon
.
getCartoonElementRef
(
`water-light-
${
line
}
-
${
row
}
-on`
).
visible
=
false
;
}
runWaterLights
(
totalLightCount
){
let
runTime
=
3
//Math.floor(totalLightCount/5)
for
(
let
count
=
0
;
count
<
runTime
;
count
++
){
this
.
m_setTimeoutIDs
.
push
(
setTimeout
(()
=>
{
let
count_l0
=
0
;
let
dir_l0
=
true
;
this
.
m_setIntervalIDs
.
push
(
setInterval
(()
=>
{
this
.
lightOff
(
0
,
count_l0
)
if
(
dir_l0
){
count_l0
++
}
else
{
count_l0
--
}
if
(
count_l0
>=
totalLightCount
){
count_l0
--
dir_l0
=!
dir_l0
;
}
else
if
(
count_l0
<=
-
1
){
count_l0
++
dir_l0
=!
dir_l0
;
}
this
.
lightOn
(
0
,
count_l0
)
},
100
))
let
count_l1
=
totalLightCount
-
1
;
let
dir_l1
=
true
;
this
.
m_setIntervalIDs
.
push
(
setInterval
(()
=>
{
this
.
lightOff
(
1
,
count_l1
)
if
(
dir_l1
){
count_l1
++
}
else
{
count_l1
--
}
if
(
count_l1
>=
totalLightCount
){
count_l1
--
dir_l1
=!
dir_l1
;
}
else
if
(
count_l1
<=
-
1
){
count_l1
++
dir_l1
=!
dir_l1
;
}
this
.
lightOn
(
1
,
count_l1
)
},
100
))
},
count
*
500
))
}
}
// 卡片回收与准备控制
...
...
@@ -386,7 +459,7 @@ export class PlayComponent implements OnInit, OnDestroy {
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
){
if
(
(
x
+
width
*
0.5
)
<
this
.
g_canvasWidth
&&
(
(
x
+
width
*
0.5
)
>
this
.
g_canvasWidth
-
14
*
this
.
g_mapScale
)
&&
!
this
.
m_requestAfterCard
){
if
(
this
.
m_requestID
!=
id
){
this
.
m_requestAfterCard
=
true
;
this
.
m_requestID
=
id
...
...
@@ -396,7 +469,7 @@ export class PlayComponent implements OnInit, OnDestroy {
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
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]).
x
=
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_requestID
).
x
+
width
+
14
*
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
)
...
...
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