Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
East_L228
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_L228
Commits
2fe3df96
Commit
2fe3df96
authored
May 14, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uat feedback
parent
645d4bd7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
61 deletions
+41
-61
play.component.ts
src/app/play/play.component.ts
+41
-61
highlight.png
src/assets/play/highlight.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
2fe3df96
...
...
@@ -146,10 +146,10 @@ export class PlayComponent implements OnInit, OnDestroy {
m_requestAfterCard
=
false
;
m_requestID
=
null
;
m_enableRunway
=
false
;
m_currentFocusCard
=
-
1
;
m_enableAutoRunFocus
=
false
;
m_currentFocusCard
=
0
;
m_autoFocusID
=
null
;
m_enableCamera
=
true
;
m_nextCardLock
=
false
;
// ------------------------------------
...
...
@@ -223,12 +223,11 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initBillboard
();
this
.
initCamera
();
this
.
initCards
();
this
.
m_enableAutoRunFocus
=
true
;
this
.
autoRunFocus
()
this
.
initShowCard
();
this
.
g_cartoon
.
playAudio
(
"
sm-run
"
,
false
,
null
,
true
,
(
audio
)
=>
{
audio
.
volume
=
0.3
})
this
.
autoRollRun
()
}
cleanGameVar
(){
...
...
@@ -243,9 +242,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
m_requestAfterCard
=
false
;
this
.
m_requestID
=
null
;
this
.
m_enableRunway
=
false
;
this
.
m_currentFocusCard
=
-
1
;
this
.
m_enableAutoRunFocus
=
false
;
this
.
m_currentFocusCard
=
0
;
this
.
m_autoFocusID
=
null
this
.
m_nextCardLock
=
false
;
}
endGame
(){
...
...
@@ -303,6 +302,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
subscribeMapDownEvent
(
element
.
id
,
()
=>
{
if
(
this
.
m_enableCamera
){
this
.
m_enableCamera
=
false
;
this
.
m_enableRunway
=
false
;
this
.
g_cartoon
.
stopAudio
(
"
sm-run
"
)
clearTimeout
(
this
.
m_autoFocusID
)
this
.
g_cartoon
.
playAudio
(
"
sm-camera
"
)
...
...
@@ -318,12 +318,13 @@ export class PlayComponent implements OnInit, OnDestroy {
// 选择卡片
initCards
(){
let
repeatNum
=
Math
.
floor
(
this
.
g_canvasWidth
/
(
249
*
this
.
g_mapScale
))
+
2
let
boundingBox
=
this
.
g_cartoon
.
getCartoonElement
(
'
Camera-Roll
'
).
ref
.
getBoundingBox
()
let
cardWidth
=
265
*
this
.
g_mapScale
let
cardNumber
=
Math
.
ceil
(
this
.
g_canvasWidth
/
cardWidth
);
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
]);
for
(
let
index
=
0
;
index
<
(
cardDetailArray
.
length
)
*
repeatNum
;
index
++
){
let
newCard
=
this
.
createCard
(
index
,
index
*
cardWidth
,
boundingBox
.
y
,
cardDetailArray
[
index
%
cardDetailArray
.
length
]);
if
(
index
>=
cardNumber
){
newCard
.
ref
.
x
=
-
999
newCard
.
waiting
=
true
;
...
...
@@ -403,7 +404,13 @@ export class PlayComponent implements OnInit, OnDestroy {
// 高亮
let
cardContentHighlight
=
this
.
g_cartoon
.
createCartoonElementImage
(
`card-content-highlight-
${
index
}
`
,
"
card-hightlight
"
,
256
,
285
,
5
,
-
4
)
if
(
index
==
0
){
cardContentHighlight
.
ref
.
alpha
=
1
;
cardContentHighlight
.
ref
.
visible
=
true
;
}
else
{
cardContentHighlight
.
ref
.
alpha
=
0
;
cardContentHighlight
.
ref
.
visible
=
false
;
}
element
.
ref
.
addChild
(
cardContentHighlight
.
ref
)
element
.
moveLeft
=
(
distance
)
=>
{
...
...
@@ -411,6 +418,12 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
element
.
content
){
element
.
content
.
ref
.
x
-=
distance
;
}
if
(
cardContentHighlight
.
ref
.
visible
){
if
(
!
this
.
m_nextCardLock
&&
element
.
ref
.
x
<=
0
){
this
.
nextFocus
()
}
}
}
element
.
readyGoOut
=
(
x
)
=>
{
...
...
@@ -436,19 +449,17 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// 跑道启停控制
cardRunControl
(
distance
,
callback
?
){
autoRollRun
(
){
if
(
!
this
.
m_enableRunway
){
return
;
}
let
step
=
Math
.
floor
(
10
*
this
.
g_mapScale
*
10000
)
/
20000
;
let
step
=
Math
.
floor
(
3
*
this
.
g_mapScale
*
10000
)
/
20000
;
let
cardElement
=
null
;
this
.
m_runIntervalId
=
setInterval
(()
=>
{
distance
-=
step
;
if
(
distance
<=
0
){
clearInterval
(
this
.
m_runIntervalId
);
callback
&&
callback
()
}
this
.
m_allCardIds
.
forEach
((
id
)
=>
{
if
(
!
this
.
m_enableRunway
){
return
;
}
cardElement
=
this
.
g_cartoon
.
getCartoonElement
(
id
)
cardElement
.
moveLeft
(
step
)
this
.
cardRecyclingAndPreparation
(
id
)
...
...
@@ -485,6 +496,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
nextFocus
(
callback
?){
this
.
m_nextCardLock
=
true
;
let
all
=
this
.
m_allCardIds
.
length
let
current
=
this
.
m_currentFocusCard
let
next
=
-
1
...
...
@@ -494,45 +506,15 @@ export class PlayComponent implements OnInit, OnDestroy {
next
=
current
+
1
}
if
(
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
next
]).
ref
.
x
>=
this
.
g_canvasWidth
-
300
*
this
.
g_mapScale
){
this
.
m_enableCamera
=
false
;
this
.
g_enableMapDown
=
false
;
let
distance
=
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
current
]).
ref
.
x
/
2
this
.
cardRunControl
(
distance
,
()
=>
{
if
(
current
!=
-
1
){
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
current
]).
hideHighlight
()
}
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
next
]).
showHighlight
(()
=>
{
this
.
m_enableCamera
=
true
;
this
.
g_enableMapDown
=
true
;
callback
&&
callback
()
})
this
.
m_currentFocusCard
=
next
;
})
}
else
{
if
(
current
!=
-
1
){
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
current
]).
hideHighlight
()
}
this
.
g_cartoon
.
getCartoonElement
(
this
.
m_allCardIds
[
next
]).
showHighlight
(()
=>
{
this
.
m_nextCardLock
=
false
;
callback
&&
callback
()
})
this
.
m_currentFocusCard
=
next
;
}
}
autoRunFocus
(){
if
(
this
.
m_enableAutoRunFocus
){
this
.
nextFocus
(()
=>
{
if
(
this
.
m_enableAutoRunFocus
){
this
.
m_autoFocusID
=
setTimeout
(()
=>
{
if
(
this
.
m_enableAutoRunFocus
){
this
.
autoRunFocus
()
}
},
3000
)
}
})
}
}
initShowCard
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`card-show`
,
"
Image-05
"
,
(
w
,
h
)
=>
{
...
...
@@ -552,7 +534,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
closeBntton
=
this
.
g_cartoon
.
createCartoonElementImage
(
`card-show-close`
,
"
close
"
,
50
,
50
,
100
,
-
100
)
element
.
ref
.
addChild
(
closeBntton
.
ref
)
let
cardHighlight
=
this
.
g_cartoon
.
createCartoonElementImage
(
`card-highlight`
,
"
highlight
"
,
439
*
0.7
,
408
*
0.7
,
0
,
0
)
let
cardHighlight
=
this
.
g_cartoon
.
createCartoonElementImage
(
`card-highlight`
,
"
highlight
"
,
677
*
0.6
,
660
*
0.6
,
0
,
0
)
element
.
ref
.
children
.
unshift
(
cardHighlight
.
ref
)
let
clickTarget
=
this
.
g_cartoon
.
createCartoonElementImage
(
`card-click-target`
,
"
Image-05
"
,
170
,
170
,
0
,
0
)
...
...
@@ -625,9 +607,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
element
.
show
=
(
callback
?)
=>
{
element
.
setContent
(
this
.
g_formData
.
dataArray
[
this
.
m_currentFocusCard
])
element
.
setContent
(
this
.
g_formData
.
dataArray
[
this
.
m_currentFocusCard
%
this
.
g_formData
.
dataArray
.
length
])
element
.
ref
.
visible
=
true
;
this
.
m_enableAutoRunFocus
=
false
tweenChange
(
element
.
ref
,
{
scaleX
:
element
.
ref
.
initScaleX
,
scaleY
:
element
.
ref
.
initScaleY
},
0.3
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
element
.
audio_url
)
callback
&&
callback
()
...
...
@@ -635,10 +616,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
element
.
hide
=
(
callback
?)
=>
{
this
.
m_enableAutoRunFocus
=
true
;
element
.
audio_url
=
null
;
this
.
g_cartoon
.
stopAudio
(
element
.
audio_url
)
this
.
autoRunFocus
()
tweenChange
(
element
.
ref
,
{
scaleX
:
0
,
scaleY
:
0
},
0.3
,
()
=>
{
element
.
ref
.
visible
=
false
;
let
textIndex
=
element
.
ref
.
children
.
indexOf
(
element
.
textContent
)
...
...
@@ -667,6 +646,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
g_cartoon
.
stopAudio
(
element
.
audio_url
)
this
.
m_enableCamera
=
true
;
element
.
hide
(()
=>
{
this
.
m_enableRunway
=
true
;
this
.
g_enableMapDown
=
true
})
})
...
...
@@ -676,7 +656,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 灯光
initLights
(){
let
totalLightCount
=
Math
.
ceil
(
this
.
g_canvasWidth
/
(
82
*
this
.
g_mapScale
))
let
totalLightCount
=
Math
.
ceil
(
this
.
g_canvasWidth
/
(
38
*
this
.
g_mapScale
))
let
baseY
=
this
.
g_cartoon
.
getCartoonElement
(
'
Camera-Roll
'
).
ref
.
y
let
height
=
this
.
g_cartoon
.
getCartoonElement
(
'
Camera-Roll
'
).
ref
.
height
*
this
.
g_mapScale
let
pos_y
=
[
...
...
@@ -699,11 +679,11 @@ initLights(){
createLights
(
line
,
row
,
base_x
,
pos_y
,
stuats
){
if
(
stuats
){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-on`
,
"
light-on
"
,
38
*
this
.
g_mapScale
,
35
*
this
.
g_mapScale
,
base_x
+
row
*
82
*
this
.
g_mapScale
,
pos_y
[
line
])
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-on`
,
"
light-on
"
,
38
*
this
.
g_mapScale
,
35
*
this
.
g_mapScale
,
base_x
+
row
*
38
*
this
.
g_mapScale
,
pos_y
[
line
])
element
.
ref
.
visible
=
false
;
return
element
;
}
else
{
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-off`
,
"
light-off
"
,
16
*
this
.
g_mapScale
,
18
*
this
.
g_mapScale
,
base_x
+
row
*
82
*
this
.
g_mapScale
,
pos_y
[
line
])
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
`water-light-
${
line
}
-
${
row
}
-off`
,
"
light-off
"
,
16
*
this
.
g_mapScale
,
18
*
this
.
g_mapScale
,
base_x
+
row
*
38
*
this
.
g_mapScale
,
pos_y
[
line
])
return
element
;
}
}
...
...
src/assets/play/highlight.png
View replaced file @
645d4bd7
View file @
2fe3df96
267 KB
|
W:
|
H:
353 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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