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
f4f1e030
Commit
f4f1e030
authored
Apr 12, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
56d69ff6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
39 deletions
+114
-39
play.component.ts
src/app/play/play.component.ts
+108
-37
resources.js
src/app/play/resources.js
+6
-2
FC-Sonw.mp3
src/assets/audio/FC-Sonw.mp3
+0
-0
Ropewalking, Jump on the Jewel.mp3
src/assets/audio/Ropewalking, Jump on the Jewel.mp3
+0
-0
apple-demo.mp3
src/assets/audio/apple-demo.mp3
+0
-0
bee-demo.mp3
src/assets/audio/bee-demo.mp3
+0
-0
bee-demo.jpg
src/assets/play/bee-demo.jpg
+0
-0
No files found.
src/app/play/play.component.ts
View file @
f4f1e030
...
...
@@ -38,7 +38,21 @@ import * as _ from "lodash";
import
TWEEN
from
"
@tweenjs/tween.js
"
;
const
defauleFormData
=
{
sex
:
"
male
"
bgMusic
:
"
FC-Sonw
"
,
dataArray
:[
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
},
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
},
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
},
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
},
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
},
{
type
:
"
Image
"
,
image_url
:
"
bee-demo
"
,
audio_url
:
"
bee-demo
"
},
{
type
:
"
Text
"
,
text
:
"
Apple
"
,
audio_url
:
"
apple-demo
"
}
]
}
const
zIndexMap
=
{
...
...
@@ -114,7 +128,8 @@ export class PlayComponent implements OnInit, OnDestroy {
m_enableRunway
=
false
;
m_pickupCard
=
false
;
m_currentPickupCardID
=
null
;
m_allSelectedHotZone
=
[]
m_allSelectedHotZone
=
[];
m_moveAsstantIntervalId
=
null
// ------------------------------------
...
...
@@ -180,6 +195,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
cardRunControl
(
true
)
this
.
initSelectedCardArea
()
this
.
initStartButton
()
this
.
initBackgroundMusic
()
}
cleanGameVar
(){
...
...
@@ -198,12 +214,22 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_pickupCard
=
false
;
this
.
m_currentPickupCardID
=
null
;
this
.
m_allSelectedHotZone
=
[]
this
.
disableMoveAsstant
()
}
endGame
(){
}
// 播放背景音乐
initBackgroundMusic
(){
let
play
=
()
=>
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
bgMusic
,
false
,
()
=>
{
play
()
})
}
play
()
}
// 背景
initBackground
(){
...
...
@@ -299,8 +325,9 @@ 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
<
10
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
);
let
cardDetailArray
=
this
.
g_formData
.
dataArray
for
(
let
index
=
0
;
index
<
cardDetailArray
.
length
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
,
cardDetailArray
[
index
]);
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
newCard
.
waiting
=
true
;
...
...
@@ -313,7 +340,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
createCard
(
index
,
x
,
y
){
createCard
(
index
,
x
,
y
,
data
){
this
.
m_allCardIds
.
push
(
`card-bckground-
${
index
}
`
)
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`card-bckground-
${
index
}
`
,
"
bg_card
"
,
(
w
,
h
)
=>
{
return
{
...
...
@@ -342,49 +369,73 @@ export class PlayComponent implements OnInit, OnDestroy {
})
cardContent
.
parentID
=
`card-bckground-
${
index
}
`
cardContent
.
canMove
=
false
;
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
cardContent
.
clickTime
=
null
cardContent
.
handleClick
=
()
=>
{
this
.
g_cartoon
.
playAudio
(
"
sm-click
"
)
cardContent
.
canMove
=
true
;
if
(
cardContent
.
parentID
){
this
.
g_cartoon
.
getCartoonElement
(
cardContent
.
parentID
).
content
=
null
}
this
.
enableMoveAsstant
(
cardContent
)
this
.
m_pickupCard
=
true
;
this
.
m_currentPickupCardID
=
`card-content-
${
index
}
`
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
show
()
this
.
topOfRenderArray
(
cardContent
.
ref
)
element
.
baseClick_x
=
this
.
g_clickX
element
.
baseClick_y
=
this
.
g_clickY
}
this
.
subscribeMapDownEvent
(
`card-content-
${
index
}
`
,
()
=>
{
if
(
cardContent
.
parentID
.
indexOf
(
"
hot
"
)
!=
-
1
){
this
.
g_cartoon
.
playAudio
(
data
.
audio_url
)
cardContent
.
clickTime
=
new
Date
().
getTime
()
}
else
{
cardContent
.
handleClick
()
}
this
.
g_enableMapDown
=
true
;
})
this
.
subscribeMapMoveEvent
(
`card-content-
${
index
}
`
,
()
=>
{
if
(
cardContent
.
canMove
){
if
(
cardContent
.
clickTime
){
let
a
=
cardContent
.
clickTime
-
new
Date
().
getTime
()
if
(
Math
.
abs
(
a
)
>
50
){
cardContent
.
handleClick
()
cardContent
.
clickTime
=
null
}
}
if
(
cardContent
.
canMove
){
cardContent
.
ref
.
x
=
this
.
g_clickX
cardContent
.
ref
.
y
=
this
.
g_clickY
}
// else{
// if(dis>(50*this.g_mapScale)){
// cardContent.canMove = true;
// }
// }
this
.
g_enableMapMove
=
true
;
})
this
.
subscribeMapUpEvent
(
`card-content-
${
index
}
`
,
()
=>
{
cardContent
.
clickTime
=
null
if
(
cardContent
.
canMove
){
setTimeout
(()
=>
{
cardContent
.
canMove
=
false
;
cardContent
.
backToParent
()
this
.
g_cartoon
.
getCartoonElement
(
`selected-card-hotzone`
).
hide
()
this
.
m_pickupCard
=
false
;
},
100
)
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
(
"
hotzone
"
)
!=
-
1
&&
pickupCard
.
parentID
.
indexOf
(
"
hotzone
"
)
!=
-
1
){
let
temp
=
pickupCard
.
parentID
pickupCard
.
parentID
=
cardContent
.
parentID
cardContent
.
parentID
=
temp
cardContent
.
backToParent
()
}
if
(
cardContent
.
parentID
&&
this
.
m_currentPickupCardID
){
let
pickupCard
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_currentPickupCardID
)
if
(
cardContent
.
parentID
.
indexOf
(
"
hotzone
"
)
!=
-
1
&&
pickupCard
.
parentID
.
indexOf
(
"
hotzone
"
)
!=
-
1
){
let
temp
=
pickupCard
.
parentID
pickupCard
.
parentID
=
cardContent
.
parentID
cardContent
.
parentID
=
temp
cardContent
.
backToParent
()
}
}
}
this
.
disableMoveAsstant
()
this
.
g_enableMapUp
=
true
;
})
element
.
content
=
cardContent
...
...
@@ -400,19 +451,26 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
cardContent
.
ref
,
999
)
//
let
textContainer
=
new
MySprite
()
textContainer
.
init
(
this
.
g_cartoon
.
images
.
get
(
"
text_container
"
))
textContainer
.
setScaleXY
(
150
/
textContainer
.
width
)
let
textContent
=
new
Label
()
textContent
.
text
=
"
T:
"
+
index
textContent
.
fontColor
=
"
#e05e14
"
;
textContent
.
fontName
=
"
BerlinSansFBDemi-Bold
"
;
textContent
.
maxSingalLineWidth
=
170
*
this
.
g_mapScale
textContent
.
x
=
textContent
.
width
/
2
textContent
.
fontSize
=
50
textContainer
.
addChild
(
textContent
)
textContainer
.
x
=
-
textContainer
.
width
/
4
cardContent
.
ref
.
addChild
(
textContainer
)
if
(
data
.
type
==
"
Text
"
){
let
textContent
=
new
Label
()
textContent
.
text
=
data
.
text
?
data
.
text
:
"
Demo
"
textContent
.
fontColor
=
"
#e05e14
"
;
textContent
.
fontName
=
"
BerlinSansFBDemi-Bold
"
;
textContent
.
textAlign
=
"
center
"
;
textContent
.
x
=
textContent
.
width
/
2
let
textSize
=
180
*
this
.
g_mapScale
/
textContent
.
text
.
length
if
(
textSize
>
50
){
textSize
=
50
}
textContent
.
fontSize
=
textSize
cardContent
.
ref
.
addChild
(
textContent
)
}
else
{
let
imageContent
=
new
MySprite
()
imageContent
.
init
(
this
.
g_cartoon
.
images
.
get
(
data
.
image_url
?
data
.
image_url
:
"
apple-demp
"
))
imageContent
.
setScaleXY
(
Math
.
min
(
120
/
imageContent
.
width
,
120
/
imageContent
.
height
))
cardContent
.
ref
.
addChild
(
imageContent
)
}
element
.
moveLeft
=
(
distance
)
=>
{
element
.
ref
.
x
-=
distance
...
...
@@ -687,6 +745,19 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
)
}
enableMoveAsstant
(
element
){
if
(
this
.
m_moveAsstantIntervalId
){
clearInterval
(
this
.
m_moveAsstantIntervalId
)
}
this
.
m_moveAsstantIntervalId
=
setInterval
(()
=>
{
element
.
ref
.
x
=
this
.
g_clickX
;
element
.
ref
.
y
=
this
.
g_clickY
;
},
50
)
}
disableMoveAsstant
(){
clearInterval
(
this
.
m_moveAsstantIntervalId
)
}
...
...
src/app/play/resources.js
View file @
f4f1e030
...
...
@@ -39,9 +39,10 @@ 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
-1
.png
'
,
'
bg_selected_card
'
:
'
assets/play/bg_selected_card.png
'
,
'
bg_1280_180
'
:
'
assets/play/bg_1280_180_1.png
'
'
bg_1280_180
'
:
'
assets/play/bg_1280_180_1.png
'
,
'
bee-demo
'
:
'
assets/play/bee-demo.jpg
'
};
...
...
@@ -68,6 +69,9 @@ const localAudios = {
'
change
'
:
'
assets/audio/change.mp3
'
,
'
selected
'
:
'
assets/audio/selected.mp3
'
,
'
FC-Sonw
'
:
'
assets/audio/FC-Sonw.mp3
'
,
'
apple-demo
'
:
'
assets/audio/apple-demo.mp3
'
,
'
bee-demo
'
:
'
assets/audio/bee-demo.mp3
'
};
export
{
localImages
,
localAudios
};
src/assets/audio/FC-Sonw.mp3
0 → 100644
View file @
f4f1e030
File added
src/assets/audio/Ropewalking, Jump on the Jewel.mp3
0 → 100644
View file @
f4f1e030
File added
src/assets/audio/apple-demo.mp3
0 → 100644
View file @
f4f1e030
File added
src/assets/audio/bee-demo.mp3
0 → 100644
View file @
f4f1e030
File added
src/assets/play/bee-demo.jpg
0 → 100644
View file @
f4f1e030
13 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