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
3f66e0db
Commit
3f66e0db
authored
Apr 11, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
c22de964
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
play.component.ts
src/app/play/play.component.ts
+29
-10
No files found.
src/app/play/play.component.ts
View file @
3f66e0db
...
...
@@ -181,9 +181,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
stopAllInterval
();
this
.
stopAllTimeout
()
this
.
g_cartoon
.
stopAllAudio
()
this
.
m_allCardIds
=
[]
this
.
cardRunControl
(
false
)
clearInterval
(
this
.
m_runIntervalId
)
this
.
m_rightBuffer
=
[]
this
.
m_requestAfterCard
=
false
;
this
.
m_requestID
=
null
;
...
...
@@ -194,6 +195,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// 背景
initBackground
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
'
my-background
'
,
"
bg-background
"
,
this
.
g_canvasWidth
,
this
.
g_canvasHeight
,
this
.
g_canvasWidth
/
2
,
this
.
g_canvasHeight
/
2
,)
this
.
subscribeMapMoveEvent
(
'
my-background
'
,
()
=>
{
...
...
@@ -206,6 +209,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
// 标题
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
)
...
...
@@ -219,6 +224,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
// 跑道
initCardRunway
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
'
card-runway
'
,
"
bg_card_runway
"
,
(
w
,
h
)
=>
{
return
{
...
...
@@ -244,6 +251,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
// 桌子
initTable
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
'
desk
'
,
"
desk
"
,
(
w
,
h
)
=>
{
return
{
...
...
@@ -259,6 +268,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
// 卡片容器(盘子 桌布)
initCardContainer
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
'
card-container
'
,
"
dish
"
,
(
w
,
h
)
=>
{
return
{
...
...
@@ -274,11 +284,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
// 选择卡片
initCards
(){
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
<
6
;
index
++
){
for
(
let
index
=
0
;
index
<
8
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
);
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
...
...
@@ -290,6 +302,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
render
(
newCard
.
ref
)
}
console
.
log
(
this
.
m_rightBuffer
)
}
createCard
(
index
,
x
,
y
){
...
...
@@ -328,16 +341,19 @@ export class PlayComponent implements OnInit, OnDestroy {
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_runStatus
=
status
if
(
!
this
.
m_runIntervalId
){
this
.
m_runIntervalId
=
setInterval
(()
=>
{
max_x
=
0
;
if
(
!
this
.
m_runStatus
){
return
}
this
.
m_allCardIds
.
forEach
((
id
)
=>
{
cardElement
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
if
(
!
cardElement
.
waiting
){
...
...
@@ -347,12 +363,11 @@ export class PlayComponent implements OnInit, OnDestroy {
})
this
.
m_runStatus
=
true
;
},
10
)
}
else
{
clearInterval
(
this
.
m_runIntervalId
)
this
.
m_runStatus
=
false
;;
}
}
// 灯光
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
)
...
...
@@ -366,13 +381,16 @@ 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
;
this
.
m_requestID
=
id
if
(
this
.
m_requestID
!=
id
){
this
.
m_requestAfterCard
=
true
;
this
.
m_requestID
=
id
}
}
if
(
this
.
m_rightBuffer
[
0
]
&&
this
.
m_requestAfterCard
){
...
...
@@ -388,6 +406,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
getCartoonElement
(
id
).
waiting
=
true
;
this
.
m_rightBuffer
.
push
(
id
)
}
}
...
...
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