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
d0e39d58
Commit
d0e39d58
authored
Apr 11, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
1d000050
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
21 deletions
+103
-21
play.component.ts
src/app/play/play.component.ts
+100
-20
resources.js
src/app/play/resources.js
+3
-1
bg_1280_180.png
src/assets/play/bg_1280_180.png
+0
-0
bg_1280_180_1.png
src/assets/play/bg_1280_180_1.png
+0
-0
bg_selected_card.png
src/assets/play/bg_selected_card.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
d0e39d58
...
...
@@ -114,6 +114,7 @@ export class PlayComponent implements OnInit, OnDestroy {
m_enableRunway
=
false
;
m_pickupCard
=
false
;
m_currentPickupCardID
=
null
;
m_allSelectedHotZone
=
[]
// ------------------------------------
...
...
@@ -177,6 +178,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initCards
()
this
.
initLights
()
this
.
cardRunControl
(
true
)
this
.
initSelectedCardArea
()
this
.
initStartButton
()
}
cleanGameVar
(){
...
...
@@ -194,6 +197,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_enableRunway
=
false
;
this
.
m_pickupCard
=
false
;
this
.
m_currentPickupCardID
=
null
;
this
.
m_allSelectedHotZone
=
[]
}
endGame
(){
...
...
@@ -286,16 +290,6 @@ export class PlayComponent implements OnInit, OnDestroy {
y
:
this
.
g_cartoon
.
getOrigin
().
y
+
(
h
/
2
)
*
this
.
g_mapScale
+
481
*
this
.
g_mapScale
}
})
this
.
subscribeMapUpEvent
(
'
card-container
'
,
()
=>
{
if
(
this
.
m_currentPickupCardID
){
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
if
(
card
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
card
.
parentID
).
content
=
null
card
.
parentID
=
null
;
}
}
})
this
.
render
(
element
.
ref
)
}
...
...
@@ -305,7 +299,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
boundingBox
=
this
.
g_cartoon
.
getCartoonElement
(
'
card-runway
'
).
ref
.
getBoundingBox
()
let
cardWidth
=
244
*
this
.
g_mapScale
let
cardNumber
=
Math
.
ceil
(
this
.
g_canvasWidth
/
cardWidth
);
for
(
let
index
=
0
;
index
<
5
0
;
index
++
){
for
(
let
index
=
0
;
index
<
1
0
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
);
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
...
...
@@ -333,10 +327,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
element
.
content
=
null
;
// let imageContainer= new MySprite()
// imageContainer.init(this.g_cartoon.images.get("card"))
// imageContainer.setScaleXY(180/imageContainer.width)
// element.ref.addChild(imageContainer)
// 可移动卡片
let
cardContent
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`card-content-
${
index
}
`
,
"
card
"
,
(
w
,
h
)
=>
{
...
...
@@ -360,6 +350,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
m_pickupCard
=
true
;
this
.
m_currentPickupCardID
=
`card-content-
${
index
}
`
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
show
()
this
.
topOfRenderArray
(
cardContent
.
ref
)
this
.
g_enableMapDown
=
true
;
})
...
...
@@ -375,16 +366,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
subscribeMapUpEvent
(
`card-content-
${
index
}
`
,
()
=>
{
let
card
=
cardContent
if
(
card
.
canMove
){
setTimeout
(()
=>
{
card
.
canMove
=
false
;
card
.
backToParent
()
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
hide
()
this
.
m_pickupCard
=
false
;
},
100
)
}
this
.
g_enableMapUp
=
true
;
})
element
.
content
=
cardContent
cardContent
.
backToParent
=
()
=>
{
cardContent
.
canMove
=
false
;
this
.
m_pickupCard
=
false
;
...
...
@@ -425,8 +417,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
element
.
setContent
=
(
content
)
=>
{
content
.
ref
.
x
=
element
.
ref
.
x
content
.
ref
.
y
=
element
.
ref
.
y
tweenChange
(
content
.
ref
,
{
x
:
element
.
ref
.
x
,
y
:
element
.
ref
.
y
},
0.1
)
element
.
content
=
content
content
.
parentID
=
element
.
id
}
...
...
@@ -590,10 +581,99 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
getCartoonElement
(
id
).
waiting
=
true
;
this
.
m_rightBuffer
.
push
(
id
)
}
}
// 已选择卡片放置点
initSelectedCardArea
(){
let
totalLightCount
=
Math
.
floor
(
this
.
g_canvasWidth
/
(
190
*
this
.
g_mapScale
))
-
1
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`selected-card-hotzone`
,
"
bg_1280_180
"
,
(
w
,
h
)
=>
{
return
{
sx
:
1
,
//this.g_canvasWidth/w,
sy
:
1
//(180*this.g_mapScale)/h
}
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_canvasHeight
/
2
+
165
*
this
.
g_mapScale
}
})
element
.
ref
.
alpha
=
0
;
let
base_X
=
-
1
*
(
200
*
this
.
g_mapScale
*
totalLightCount
)
/
2
for
(
let
index
=
0
;
index
<
totalLightCount
;
index
++
){
let
a
=
index
%
2
==
1
?
-
1
:
1
element
.
ref
.
addChild
(
this
.
createSelectedCardArea
(
index
,
base_X
+
190
*
this
.
g_mapScale
*
index
,
0
))
}
element
.
show
=
()
=>
{
this
.
m_allSelectedHotZone
.
forEach
((
id
)
=>
{
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
alpha
:
0.7
},
0.2
)
})
}
element
.
hide
=
()
=>
{
this
.
m_allSelectedHotZone
.
forEach
((
id
)
=>
{
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
alpha
:
0
},
0.2
)
})
}
this
.
render
(
element
.
ref
)
}
createSelectedCardArea
(
index
,
x
,
y
){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`selected-card-hotzone-
${
index
}
`
,
"
bg_selected_card
"
,
(
w
,
h
)
=>
{
return
{
sx
:
180
*
this
.
g_mapScale
/
w
,
sy
:
180
*
this
.
g_mapScale
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
x
+
90
*
this
.
g_mapScale
,
y
:
y
}
})
element
.
ref
.
alpha
=
0
;
element
.
content
=
null
element
.
setContent
=
(
content
)
=>
{
let
box
=
element
.
ref
.
getBoundingBox
()
tweenChange
(
content
.
ref
,
{
x
:
box
.
x
+
box
.
width
/
2
,
y
:
box
.
y
+
box
.
height
/
2
},
0.2
)
element
.
content
=
content
content
.
parentID
=
element
.
id
}
this
.
subscribeMapUpEvent
(
`selected-card-hotzone-
${
index
}
`
,
()
=>
{
if
(
!
element
.
content
){
if
(
this
.
m_currentPickupCardID
){
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
if
(
card
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
card
.
parentID
).
content
=
null
;
}
element
.
setContent
(
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
))
this
.
m_currentPickupCardID
=
null
;
}
}
this
.
g_enableMapUp
=
true
;
})
this
.
m_allSelectedHotZone
.
push
(
element
.
id
)
return
element
.
ref
}
initStartButton
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
start-button
"
,
"
btn-ok
"
,
(
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
}
})
this
.
render
(
element
.
ref
)
}
...
...
src/app/play/resources.js
View file @
d0e39d58
...
...
@@ -39,7 +39,9 @@ const localImages = {
'
bg_title
'
:
'
assets/play/bg_title.png
'
,
'
bg_card
'
:
'
assets/play/bg_card.png
'
,
'
bg_card_runway
'
:
'
assets/play/bg_card_runway.png
'
,
'
text_container
'
:
'
assets/play/text_container.png
'
'
text_container
'
:
'
assets/play/text_container.png
'
,
'
bg_selected_card
'
:
'
assets/play/bg_selected_card.png
'
,
'
bg_1280_180
'
:
'
assets/play/bg_1280_180_1.png
'
};
...
...
src/assets/play/bg_1280_180.png
0 → 100644
View file @
d0e39d58
4.01 KB
src/assets/play/bg_1280_180_1.png
0 → 100644
View file @
d0e39d58
4.01 KB
src/assets/play/bg_selected_c
ra
d.png
→
src/assets/play/bg_selected_c
ar
d.png
View file @
d0e39d58
File moved
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