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
1d000050
Commit
1d000050
authored
Apr 11, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
209e23c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
9 deletions
+127
-9
play.component.ts
src/app/play/play.component.ts
+126
-8
resources.js
src/app/play/resources.js
+1
-1
bg_selected_crad.png
src/assets/play/bg_selected_crad.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
1d000050
...
@@ -112,6 +112,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -112,6 +112,8 @@ export class PlayComponent implements OnInit, OnDestroy {
m_requestAfterCard
=
false
;
m_requestAfterCard
=
false
;
m_requestID
=
null
;
m_requestID
=
null
;
m_enableRunway
=
false
;
m_enableRunway
=
false
;
m_pickupCard
=
false
;
m_currentPickupCardID
=
null
;
// ------------------------------------
// ------------------------------------
...
@@ -190,6 +192,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -190,6 +192,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_requestAfterCard
=
false
;
this
.
m_requestAfterCard
=
false
;
this
.
m_requestID
=
null
;
this
.
m_requestID
=
null
;
this
.
m_enableRunway
=
false
;
this
.
m_enableRunway
=
false
;
this
.
m_pickupCard
=
false
;
this
.
m_currentPickupCardID
=
null
;
}
}
endGame
(){
endGame
(){
...
@@ -282,6 +286,16 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -282,6 +286,16 @@ export class PlayComponent implements OnInit, OnDestroy {
y
:
this
.
g_cartoon
.
getOrigin
().
y
+
(
h
/
2
)
*
this
.
g_mapScale
+
481
*
this
.
g_mapScale
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
)
this
.
render
(
element
.
ref
)
}
}
...
@@ -318,11 +332,69 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -318,11 +332,69 @@ export class PlayComponent implements OnInit, OnDestroy {
y
:
y
+
150
*
this
.
g_mapScale
y
:
y
+
150
*
this
.
g_mapScale
}
}
})
})
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
)
=>
{
return
{
sx
:
(
180
*
this
.
g_mapScale
)
/
w
,
sy
:
(
180
*
this
.
g_mapScale
)
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
element
.
ref
.
x
,
y
:
element
.
ref
.
y
}
})
cardContent
.
parentID
=
`card-bckground-
${
index
}
`
cardContent
.
canMove
=
false
;
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
"
sm-click
"
)
cardContent
.
canMove
=
true
;
if
(
cardContent
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
content
=
null
}
this
.
m_pickupCard
=
true
;
this
.
m_currentPickupCardID
=
`card-content-
${
index
}
`
this
.
topOfRenderArray
(
cardContent
.
ref
)
this
.
g_enableMapDown
=
true
;
})
this
.
subscribeMapMoveEvent
(
`card-content-
${
index
}
`
,
()
=>
{
if
(
cardContent
.
canMove
){
cardContent
.
ref
.
x
=
this
.
g_clickX
cardContent
.
ref
.
y
=
this
.
g_clickY
}
this
.
g_enableMapMove
=
true
;
})
this
.
subscribeMapUpEvent
(
`card-content-
${
index
}
`
,
()
=>
{
let
card
=
cardContent
if
(
card
.
canMove
){
card
.
canMove
=
false
;
card
.
backToParent
()
this
.
m_pickupCard
=
false
;
}
this
.
g_enableMapUp
=
true
;
})
element
.
content
=
cardContent
let
imageContainer
=
new
MySprite
()
imageContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
card
"
))
cardContent
.
backToParent
=
()
=>
{
imageContainer
.
setScaleXY
(
180
/
imageContainer
.
width
)
cardContent
.
canMove
=
false
;
element
.
ref
.
addChild
(
imageContainer
)
this
.
m_pickupCard
=
false
;
if
(
cardContent
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
setContent
(
cardContent
)
}
}
this
.
render
(
cardContent
.
ref
,
999
)
//
let
textContainer
=
new
MySprite
()
let
textContainer
=
new
MySprite
()
textContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
text_container
"
))
textContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
text_container
"
))
...
@@ -336,8 +408,46 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -336,8 +408,46 @@ export class PlayComponent implements OnInit, OnDestroy {
textContent
.
fontSize
=
50
textContent
.
fontSize
=
50
textContainer
.
addChild
(
textContent
)
textContainer
.
addChild
(
textContent
)
textContainer
.
x
=
-
textContainer
.
width
/
4
textContainer
.
x
=
-
textContainer
.
width
/
4
element
.
ref
.
addChild
(
textContainer
)
cardContent
.
ref
.
addChild
(
textContainer
)
element
.
moveLeft
=
(
distance
)
=>
{
element
.
ref
.
x
-=
distance
if
(
element
.
content
){
element
.
content
.
ref
.
x
-=
distance
;
}
}
element
.
readyGoOut
=
(
x
)
=>
{
element
.
ref
.
x
=
x
if
(
element
.
content
){
element
.
content
.
ref
.
x
=
x
;
}
}
element
.
setContent
=
(
content
)
=>
{
content
.
ref
.
x
=
element
.
ref
.
x
content
.
ref
.
y
=
element
.
ref
.
y
element
.
content
=
content
content
.
parentID
=
element
.
id
}
element
.
cleanContent
=
()
=>
{
element
.
content
=
null
}
this
.
subscribeMapUpEvent
(
`card-bckground-
${
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
;
})
return
element
;
return
element
;
}
}
...
@@ -357,7 +467,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -357,7 +467,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_allCardIds
.
forEach
((
id
)
=>
{
this
.
m_allCardIds
.
forEach
((
id
)
=>
{
cardElement
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
cardElement
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
if
(
!
cardElement
.
waiting
){
if
(
!
cardElement
.
waiting
){
cardElement
.
ref
.
x
-=
step
cardElement
.
moveLeft
(
step
)
}
}
this
.
cardRecyclingAndPreparation
(
id
)
this
.
cardRecyclingAndPreparation
(
id
)
})
})
...
@@ -469,7 +579,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -469,7 +579,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
m_rightBuffer
[
0
]
&&
this
.
m_requestAfterCard
){
if
(
this
.
m_rightBuffer
[
0
]
&&
this
.
m_requestAfterCard
){
this
.
m_requestAfterCard
=
false
;
this
.
m_requestAfterCard
=
false
;
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]).
alpha
=
0
;
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
+
14
*
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
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_rightBuffer
[
0
]).
readyGoOut
(
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
)
tweenChange
(
this
.
g_cartoon
.
getCartoonElementRef
(
this
.
m_rightBuffer
[
0
]),
{
alpha
:
1
},
0.2
)
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_rightBuffer
[
0
]).
waiting
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_rightBuffer
[
0
]).
waiting
=
false
;
this
.
m_rightBuffer
.
splice
(
0
,
1
)
this
.
m_rightBuffer
.
splice
(
0
,
1
)
...
@@ -677,7 +788,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -677,7 +788,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
this
.
m_mapMoveArray
.
forEach
((
item
)
=>
{
this
.
m_mapMoveArray
.
forEach
((
item
)
=>
{
if
(
!
myStopPropagation
){
if
(
!
myStopPropagation
||
this
.
m_pickupCard
){
if
(
this
.
checkClickTarget
(
this
.
g_cartoon
.
getCartoonElementRef
(
item
.
id
)))
{
if
(
this
.
checkClickTarget
(
this
.
g_cartoon
.
getCartoonElementRef
(
item
.
id
)))
{
this
.
g_enableMapMove
=
false
;
this
.
g_enableMapMove
=
false
;
if
(
item
.
callback
()){
if
(
item
.
callback
()){
...
@@ -1015,6 +1126,13 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -1015,6 +1126,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_setIntervalIDs
=
[]
this
.
m_setIntervalIDs
=
[]
}
}
topOfRenderArray
(
element
){
let
index
=
this
.
m_renderArr
.
indexOf
(
element
)
if
(
index
!=-
1
){
this
.
m_renderArr
.
splice
(
index
,
1
)
this
.
m_renderArr
.
push
(
element
)
}
}
...
...
src/app/play/resources.js
View file @
1d000050
...
@@ -39,7 +39,7 @@ const localImages = {
...
@@ -39,7 +39,7 @@ const localImages = {
'
bg_title
'
:
'
assets/play/bg_title.png
'
,
'
bg_title
'
:
'
assets/play/bg_title.png
'
,
'
bg_card
'
:
'
assets/play/bg_card.png
'
,
'
bg_card
'
:
'
assets/play/bg_card.png
'
,
'
bg_card_runway
'
:
'
assets/play/bg_card_runway.png
'
,
'
bg_card_runway
'
:
'
assets/play/bg_card_runway.png
'
,
'
text_container
'
:
'
assets/play/text_container
-1
.png
'
'
text_container
'
:
'
assets/play/text_container.png
'
};
};
...
...
src/assets/play/bg_selected_crad.png
0 → 100644
View file @
1d000050
9.47 KB
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