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
016ed50a
Commit
016ed50a
authored
Apr 14, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UAT feedback
parent
260bdaa3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
65 deletions
+99
-65
play.component.ts
src/app/play/play.component.ts
+97
-63
resources.js
src/app/play/resources.js
+2
-2
bg_1280_250.png
src/assets/play/bg_1280_250.png
+0
-0
bg_1280_250_1.png
src/assets/play/bg_1280_250_1.png
+0
-0
bg_card_runway_1.png
src/assets/play/bg_card_runway_1.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
016ed50a
...
@@ -134,6 +134,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -134,6 +134,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// ------------ 游戏逻辑数据 ------------
// ------------ 游戏逻辑数据 ------------
m_allCardIds
=
[]
m_allCardIds
=
[]
m_allCardContentIds
=
[]
m_runIntervalId
=
null
m_runIntervalId
=
null
m_runStatus
=
false
;
m_runStatus
=
false
;
m_mouseInRunway
=
false
;
m_mouseInRunway
=
false
;
...
@@ -237,6 +238,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -237,6 +238,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
stopAllAudio
()
this
.
m_allCardIds
=
[]
this
.
m_allCardIds
=
[]
this
.
m_allCardContentIds
=
[]
this
.
cardRunControl
(
false
)
this
.
cardRunControl
(
false
)
clearInterval
(
this
.
m_runIntervalId
)
clearInterval
(
this
.
m_runIntervalId
)
this
.
m_runIntervalId
=
null
this
.
m_runIntervalId
=
null
...
@@ -421,6 +423,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -421,6 +423,7 @@ export class PlayComponent implements OnInit, OnDestroy {
createCard
(
index
,
x
,
y
,
data
){
createCard
(
index
,
x
,
y
,
data
){
this
.
m_allCardIds
.
push
(
`card-bckground-
${
index
}
`
)
this
.
m_allCardIds
.
push
(
`card-bckground-
${
index
}
`
)
this
.
m_allCardContentIds
.
push
(
`card-content-
${
index
}
`
)
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`card-bckground-
${
index
}
`
,
"
bg_card
"
,
(
w
,
h
)
=>
{
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`card-bckground-
${
index
}
`
,
"
bg_card
"
,
(
w
,
h
)
=>
{
return
{
return
{
sx
:
230
*
this
.
g_mapScale
/
w
,
sx
:
230
*
this
.
g_mapScale
/
w
,
...
@@ -457,18 +460,39 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -457,18 +460,39 @@ export class PlayComponent implements OnInit, OnDestroy {
cardContent
.
handleClick
=
()
=>
{
cardContent
.
handleClick
=
()
=>
{
this
.
g_cartoon
.
playAudio
(
"
sm-click
"
)
this
.
g_cartoon
.
playAudio
(
"
sm-click
"
)
cardContent
.
canMove
=
true
;
cardContent
.
canMove
=
true
;
if
(
cardContent
.
parentID
){
if
(
cardContent
.
parentID
&&
cardContent
.
parentID
.
indexOf
(
"
pos_
"
)
==-
1
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
content
=
null
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
content
=
null
}
}
this
.
enableMoveAsstant
(
cardContent
)
this
.
enableMoveAsstant
(
cardContent
)
this
.
m_pickupCard
=
true
;
this
.
m_pickupCard
=
true
;
this
.
m_currentPickupCardID
=
`card-content-
${
index
}
`
this
.
m_currentPickupCardID
=
`card-content-
${
index
}
`
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
show
()
//
this.g_cartoon.getCartoonElement(`selected-card-hotzone`).show()
this
.
topOfRenderArray
(
cardContent
.
ref
)
this
.
topOfRenderArray
(
cardContent
.
ref
)
element
.
baseClick_x
=
this
.
g_clickX
element
.
baseClick_x
=
this
.
g_clickX
element
.
baseClick_y
=
this
.
g_clickY
element
.
baseClick_y
=
this
.
g_clickY
hilightBackground
.
ref
.
visible
=
true
;
hilightBackground
.
ref
.
visible
=
true
;
}
}
cardContent
.
handleMouseUp
=
(
isSaveCurrentPickupCardID
?)
=>
{
cardContent
.
clickTime
=
null
let
savedPickupCardID
=
this
.
m_currentPickupCardID
;
if
(
cardContent
.
canMove
){
setTimeout
(()
=>
{
cardContent
.
canMove
=
false
;
cardContent
.
backToParent
()
if
(
isSaveCurrentPickupCardID
){
this
.
m_currentPickupCardID
=
savedPickupCardID
this
.
m_pickupCard
=
false
;
}
// this.g_cartoon.getCartoonElement(`selected-card-hotzone`).hide()
},
100
)
}
if
(
!
isSaveCurrentPickupCardID
){
this
.
disableMoveAsstant
()
this
.
g_enableMapUp
=
true
;
}
}
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
if
(
this
.
m_endGame
){
if
(
this
.
m_endGame
){
if
(
cardContent
.
parentID
.
indexOf
(
"
hot
"
)
!=
-
1
){
if
(
cardContent
.
parentID
.
indexOf
(
"
hot
"
)
!=
-
1
){
...
@@ -495,45 +519,33 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -495,45 +519,33 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
}
}
if
(
cardContent
.
canMove
){
if
(
cardContent
.
canMove
){
cardContent
.
ref
.
x
=
this
.
g_clickX
if
(
cardContent
.
parentID
.
indexOf
(
"
pos_
"
)
==
-
1
||
this
.
m_renderArr
.
indexOf
(
cardContent
.
ref
)
==
this
.
m_renderArr
.
length
-
1
){
cardContent
.
ref
.
y
=
this
.
g_clickY
cardContent
.
ref
.
x
=
this
.
g_clickX
cardContent
.
ref
.
y
=
this
.
g_clickY
}
else
if
(
cardContent
.
parentID
.
indexOf
(
"
pos_
"
)
!=
-
1
){
cardContent
.
handleMouseUp
(
true
)
}
}
}
this
.
g_enableMapMove
=
true
;
this
.
g_enableMapMove
=
true
;
})
})
this
.
subscribeMapUpEvent
(
`card-content-
${
index
}
`
,
()
=>
{
this
.
subscribeMapUpEvent
(
`card-content-
${
index
}
`
,
()
=>
{
cardContent
.
clickTime
=
null
cardContent
.
handleMouseUp
()
if
(
cardContent
.
canMove
){
setTimeout
(()
=>
{
cardContent
.
canMove
=
false
;
cardContent
.
backToParent
()
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
hide
()
this
.
m_pickupCard
=
false
;
},
100
)
}
else
{
if
(
cardContent
.
parentID
&&
this
.
m_currentPickupCardID
){
let
pickupCard
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
if
(
cardContent
.
parentID
.
indexOf
(
"
card-bckground
"
)
!=
-
1
&&
pickupCard
.
parentID
.
indexOf
(
"
card-bckground
"
)
!=
-
1
){
}
else
{
let
temp
=
pickupCard
.
parentID
pickupCard
.
parentID
=
cardContent
.
parentID
cardContent
.
parentID
=
temp
cardContent
.
backToParent
()
}
}
}
this
.
disableMoveAsstant
()
this
.
g_enableMapUp
=
true
;
})
})
element
.
content
=
cardContent
element
.
content
=
cardContent
cardContent
.
backToParent
=
()
=>
{
cardContent
.
backToParent
=
()
=>
{
cardContent
.
canMove
=
false
;
cardContent
.
canMove
=
false
;
this
.
m_pickupCard
=
false
;
this
.
m_pickupCard
=
false
;
if
(
cardContent
.
parentID
){
if
(
cardContent
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
setContent
(
cardContent
)
if
(
cardContent
.
parentID
.
indexOf
(
"
pos_
"
)
==
-
1
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
setContent
(
cardContent
)
}
else
{
tweenChange
(
cardContent
.
ref
,
{
x
:
cardContent
.
parentID
.
split
(
"
_
"
)[
1
],
y
:
cardContent
.
parentID
.
split
(
"
_
"
)[
2
]},
0.1
)
}
}
}
hilightBackground
.
ref
.
visible
=
false
;
hilightBackground
.
ref
.
visible
=
false
;
this
.
m_currentPickupCardID
=
null
;
this
.
m_currentPickupCardID
=
null
;
}
}
...
@@ -559,8 +571,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -559,8 +571,7 @@ export class PlayComponent implements OnInit, OnDestroy {
imageContent
.
setScaleXY
(
Math
.
min
(
110
/
imageContent
.
width
,
110
/
imageContent
.
height
))
imageContent
.
setScaleXY
(
Math
.
min
(
110
/
imageContent
.
width
,
110
/
imageContent
.
height
))
cardContent
.
ref
.
addChild
(
imageContent
)
cardContent
.
ref
.
addChild
(
imageContent
)
}
}
element
.
moveLeft
=
(
distance
)
=>
{
element
.
moveLeft
=
(
distance
)
=>
{
element
.
ref
.
x
-=
distance
element
.
ref
.
x
-=
distance
if
(
element
.
content
){
if
(
element
.
content
){
...
@@ -589,7 +600,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -589,7 +600,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
element
.
content
){
if
(
!
element
.
content
){
if
(
this
.
m_currentPickupCardID
){
if
(
this
.
m_currentPickupCardID
){
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
if
(
card
.
parentID
){
if
(
card
.
parentID
&&
card
.
parentID
.
indexOf
(
"
pos_
"
).
index
==-
1
){
this
.
g_cartoon
.
getCartoonElement
(
card
.
parentID
).
content
=
null
;
this
.
g_cartoon
.
getCartoonElement
(
card
.
parentID
).
content
=
null
;
}
}
element
.
setContent
(
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
))
element
.
setContent
(
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
))
...
@@ -753,34 +764,50 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -753,34 +764,50 @@ export class PlayComponent implements OnInit, OnDestroy {
case
"
C
"
:
baseLine
=
165
*
this
.
g_mapScale
;
break
;
case
"
C
"
:
baseLine
=
165
*
this
.
g_mapScale
;
break
;
default
:
baseLine
=
165
*
this
.
g_mapScale
;
default
:
baseLine
=
165
*
this
.
g_mapScale
;
}
}
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`selected-card-hotzone`
,
"
bg_1280_
18
0
"
,
(
w
,
h
)
=>
{
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`selected-card-hotzone`
,
"
bg_1280_
25
0
"
,
(
w
,
h
)
=>
{
return
{
return
{
sx
:
1
,
//
this.g_canvasWidth/w,
sx
:
this
.
g_canvasWidth
/
w
,
sy
:
1
//(1
80*this.g_mapScale)/h
sy
:
(
2
80
*
this
.
g_mapScale
)
/
h
}
}
},
(
w
,
h
)
=>
{
},
(
w
,
h
)
=>
{
return
{
return
{
x
:
this
.
g_canvasWidth
/
2
,
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_ca
nvasHeight
/
2
+
baseLin
e
y
:
this
.
g_ca
rtoon
.
getOrigin
().
y
+
555
*
this
.
g_mapScal
e
}
}
})
})
element
.
ref
.
alpha
=
0
;
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
)
=>
{
this
.
subscribeMapUpEvent
(
`selected-card-hotzone`
,
()
=>
{
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
alpha
:
0.7
},
0.2
)
})
if
(
this
.
m_currentPickupCardID
){
}
let
card
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
element
.
hide
=
()
=>
{
if
(
card
.
parentID
&&
card
.
parentID
.
indexOf
(
"
pos_
"
)
==-
1
){
this
.
m_allSelectedHotZone
.
forEach
((
id
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
card
.
parentID
).
content
=
null
;
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
alpha
:
0
},
0.2
)
}
})
card
.
parentID
=
"
pos_
"
+
this
.
g_clickX
+
"
_
"
+
this
.
g_clickY
}
this
.
g_cartoon
.
getCartoonElement
(
"
start-button
"
).
showHideCheck
()
}
this
.
g_enableMapUp
=
true
;
})
// 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
)
this
.
render
(
element
.
ref
)
...
@@ -844,10 +871,17 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -844,10 +871,17 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
getAllCards
=
()
=>
{
element
.
getAllCards
=
()
=>
{
let
allSelectedCards
=
[]
let
allSelectedCards
=
[]
this
.
m_allSelectedHotZone
.
forEach
(
id
=>
{
// this.m_allSelectedHotZone.forEach(id=>{
let
content_id
=
this
.
g_cartoon
.
getCartoonElement
(
id
).
content
?
this
.
g_cartoon
.
getCartoonElement
(
id
).
content
.
id
:
null
// let content_id = this.g_cartoon.getCartoonElement(id).content?this.g_cartoon.getCartoonElement(id).content.id:null
if
(
content_id
){
// if(content_id){
allSelectedCards
.
push
(
content_id
)
// allSelectedCards.push(content_id)
// }
// })
this
.
m_allCardContentIds
.
forEach
(
id
=>
{
let
parentID
=
this
.
g_cartoon
.
getCartoonElement
(
id
).
parentID
?
this
.
g_cartoon
.
getCartoonElement
(
id
).
parentID
:
null
if
(
parentID
&&
parentID
.
indexOf
(
"
pos_
"
)
!=-
1
){
allSelectedCards
.
push
(
parentID
)
}
}
})
})
return
allSelectedCards
return
allSelectedCards
...
@@ -859,15 +893,15 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -859,15 +893,15 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
endGame
()
this
.
endGame
()
})
})
})
})
let
allIDs
=
element
.
getAllCards
()
//
let allIDs = element.getAllCards()
let
cardWidth
=
180
*
this
.
g_mapScale
//
let cardWidth = 180*this.g_mapScale
let
allWidth
=
allIDs
.
length
*
cardWidth
//
let allWidth = allIDs.length * cardWidth
let
base_x
=
(
this
.
g_canvasWidth
-
allWidth
+
cardWidth
)
/
2
//
let base_x = (this.g_canvasWidth - allWidth + cardWidth)/2
if
(
allIDs
.
length
>
0
){
//
if(allIDs.length>0){
allIDs
.
forEach
((
id
,
index
)
=>
{
//
allIDs.forEach((id,index) => {
tweenChange
(
this
.
g_cartoon
.
getCartoonElement
(
id
).
ref
,
{
x
:
base_x
+
index
*
cardWidth
},
0.2
)
//
tweenChange( this.g_cartoon.getCartoonElement(id).ref, {x:base_x+index*cardWidth}, 0.2)
});
//
});
}
//
}
element
.
ref
.
scaleX
=
0
;
element
.
ref
.
scaleX
=
0
;
element
.
ref
.
scaleY
=
0
;
element
.
ref
.
scaleY
=
0
;
element
.
ref
.
x
=
100000
;
element
.
ref
.
x
=
100000
;
...
...
src/app/play/resources.js
View file @
016ed50a
...
@@ -39,10 +39,10 @@ const localImages = {
...
@@ -39,10 +39,10 @@ const localImages = {
'
light-2
'
:
'
assets/play/light-2.png
'
,
'
light-2
'
:
'
assets/play/light-2.png
'
,
'
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
_1
.png
'
,
'
text_container
'
:
'
assets/play/text_container-1.png
'
,
'
text_container
'
:
'
assets/play/text_container-1.png
'
,
'
bg_selected_card
'
:
'
assets/play/bg_selected_card.png
'
,
'
bg_selected_card
'
:
'
assets/play/bg_selected_card.png
'
,
'
bg_1280_
180
'
:
'
assets/play/bg_1280_18
0_1.png
'
,
'
bg_1280_
250
'
:
'
assets/play/bg_1280_25
0_1.png
'
,
'
bee-demo
'
:
'
assets/play/bee-demo.jpg
'
,
'
bee-demo
'
:
'
assets/play/bee-demo.jpg
'
,
'
tablecloth
'
:
'
assets/play/tablecloth.png
'
'
tablecloth
'
:
'
assets/play/tablecloth.png
'
};
};
...
...
src/assets/play/bg_1280_250.png
0 → 100644
View file @
016ed50a
1.88 KB
src/assets/play/bg_1280_250_1.png
0 → 100644
View file @
016ed50a
1.88 KB
src/assets/play/bg_card_runway_1.png
0 → 100644
View file @
016ed50a
4.87 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