Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
East_L230
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_L230
Commits
0b6b99d2
Commit
0b6b99d2
authored
May 23, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
216ff7e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
96 deletions
+85
-96
play.component.ts
src/app/play/play.component.ts
+83
-94
resources.js
src/app/play/resources.js
+2
-2
move.mp3
src/assets/audio/move.mp3
+0
-0
skier.png
src/assets/play/skier.png
+0
-0
No files found.
src/app/play/play.component.ts
View file @
0b6b99d2
...
...
@@ -227,6 +227,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initQuestionCards
()
this
.
initSpeaker
()
this
.
initQuestionIndexBoard
();
this
.
initHeader
()
}
cleanGameVar
(){
...
...
@@ -236,9 +237,10 @@ export class PlayComponent implements OnInit, OnDestroy {
startGame
(){
this
.
loadQuestion
()
this
.
g_cartoon
.
playAudio
(
"
bg_music
"
,
false
,
null
,
true
,
(
audio
)
=>
{
this
.
playTips
()
this
.
g_cartoon
.
playAudio
(
"
skier
"
,
false
,
null
,
true
,
(
audio
)
=>
{
this
.
m_bgMusic
=
audio
audio
.
volume
=
0.
0
5
audio
.
volume
=
0.5
})
this
.
g_cartoon
.
getCartoonElement
(
`question-index-board`
).
resetIndex
()
this
.
g_cartoon
.
getCartoonElement
(
"
play-audio
"
).
in
()
...
...
@@ -275,9 +277,12 @@ export class PlayComponent implements OnInit, OnDestroy {
muteBgMusic
(
status
){
if
(
status
){
this
.
m_bgMusic
.
volume
=
0
this
.
g_cartoon
.
stopAudio
(
"
skier
"
)
}
else
{
this
.
m_bgMusic
.
volume
=
0.05
this
.
g_cartoon
.
playAudio
(
"
skier
"
,
false
,
null
,
true
,
(
audio
)
=>
{
this
.
m_bgMusic
=
audio
audio
.
volume
=
0.5
})
}
}
...
...
@@ -360,6 +365,51 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
render
(
element
.
ref
,
999
)
}
// 小手
initHeader
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`header`
,
"
header
"
,
(
w
,
h
)
=>
{
return
{
sx
:
98
*
this
.
g_mapScale
/
w
,
sy
:
97
*
this
.
g_mapScale
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_canvasHeight
/
2
}
})
element
.
ref
.
visible
=
false
;;
this
.
render
(
element
.
ref
,
999
)
}
playTips
(){
let
header
=
this
.
g_cartoon
.
getCartoonElement
(
`header`
)
let
audio
=
this
.
g_cartoon
.
getCartoonElement
(
`play-audio`
)
let
skier
=
this
.
g_cartoon
.
getCartoonElement
(
`skier`
)
setTimeout
(()
=>
{
header
.
ref
.
visible
=
true
;
header
.
ref
.
scaleX
=
header
.
ref
.
scaleX
*
1.3
header
.
ref
.
scaleY
=
header
.
ref
.
scaleY
*
1.3
header
.
ref
.
x
=
audio
.
ref
.
x
+
this
.
g_canvasWidth
header
.
ref
.
y
=
audio
.
ref
.
y
+
this
.
g_canvasHeight
setTimeout
(()
=>
{
tweenChange
(
header
.
ref
,
{
x
:
audio
.
ref
.
x
+
50
*
this
.
g_mapScale
,
y
:
audio
.
ref
.
y
+
50
*
this
.
g_mapScale
,
scaleX
:
header
.
initScaleX
,
scaleY
:
header
.
initScaleY
},
0.5
,
()
=>
{
setTimeout
(()
=>
{
tweenChange
(
header
.
ref
,
{
scaleX
:
header
.
ref
.
scaleX
*
1.2
,
scaleY
:
header
.
ref
.
scaleY
*
1.2
},
0.2
)
setTimeout
(()
=>
{
tweenChange
(
header
.
ref
,
{
scaleX
:
header
.
initScaleX
,
scaleY
:
header
.
initScaleY
},
0.2
)
},
300
);
tweenChange
(
header
.
ref
,
{
x
:
skier
.
ref
.
x
+
50
*
this
.
g_mapScale
,
y
:
skier
.
ref
.
y
-
50
*
this
.
g_mapScale
},
0.5
,
()
=>
{
header
.
ref
.
visible
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
"
skier
"
).
cruise
()
})
},
1000
);
})
},
1000
);
},
500
)
}
initBaseLine
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
base-line
"
,
"
base_line
"
,
this
.
g_canvasWidth
,
5
*
this
.
g_mapScale
,
this
.
g_canvasWidth
/
2
,
this
.
g_canvasHeight
*
0.8
)
element
.
ref
.
visible
=
false
;
...
...
@@ -507,11 +557,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
this
.
g_cartoon
.
stopAllAudio
()
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
audio_url
,
false
,
()
=>
{
element
.
stop
();
this
.
muteBgMusic
(
false
)
this
.
g_cartoon
.
playAudio
(
"
bg_music
"
,
false
,
null
,
true
,
(
audio
)
=>
{
this
.
m_bgMusic
=
audio
audio
.
volume
=
0.05
})
})
element
.
playIntervalID
=
setInterval
(()
=>
{
for
(
let
i
=
0
;
i
<
3
;
i
++
){
...
...
@@ -756,31 +803,24 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
ref
.
scaleX
=
element
.
initScaleX
*
1.2
element
.
ref
.
scaleY
=
element
.
initScaleY
*
1.2
let
header
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`header`
,
"
header
"
,
(
w
,
h
)
=>
{
let
header
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`header
-inside
`
,
"
header
"
,
(
w
,
h
)
=>
{
return
{
sx
:
98
/
w
,
sy
:
97
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
0
,
y
:
50
x
:
5
0
,
y
:
-
50
}
})
header
.
ref
.
x
=
header
.
ref
.
x
+
500
header
.
ref
.
y
=
header
.
ref
.
y
+
500
header
.
ref
.
scaleX
=
header
.
ref
.
scaleX
*
1.5
header
.
ref
.
scaleY
=
header
.
ref
.
scaleY
*
1.5
header
.
ref
.
visible
=
false
;
element
.
ref
.
addChild
(
header
.
ref
)
element
.
cruiseIntervalID
=
null
;
element
.
cruiseSetTimeoutID
=
null
element
.
firstClick
=
true
element
.
firstClick
=
true
;
element
.
cruise
=
(
callback
?)
=>
{
header
.
ref
.
visible
=
true
;
if
(
element
.
firstClick
){
let
time
=
0
;
header
.
ref
.
visible
=
true
;
element
.
cruiseSetTimeoutID
=
setTimeout
(()
=>
{
let
dir
=
false
;
let
step
=
10
*
this
.
g_mapScale
...
...
@@ -792,6 +832,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
if
(
element
.
ref
.
x
>
this
.
g_canvasWidth
-
300
*
this
.
g_mapScale
||
element
.
ref
.
x
<
300
*
this
.
g_mapScale
){
dir
=
!
dir
time
++
}
if
(
time
>=
2
&&
(
element
.
ref
.
x
<=
(
this
.
g_canvasWidth
/
2
+
20
*
this
.
g_mapScale
)
&&
element
.
ref
.
x
>=
(
this
.
g_canvasWidth
/
2
-
20
*
this
.
g_mapScale
)
)
){
element
.
stopCruise
()
element
.
ref
.
x
=
element
.
ref
.
initX
}
},
30
)
this
.
m_setIntervalIDs
.
push
(
element
.
cruiseIntervalID
)
...
...
@@ -799,24 +844,11 @@ export class PlayComponent implements OnInit, OnDestroy {
},
500
)
this
.
m_setTimeoutIDs
.
push
(
element
.
cruiseSetTimeoutID
)
}
this
.
m_setTimeoutIDs
.
push
(
setTimeout
(()
=>
{
tweenChange
(
header
.
ref
,
{
x
:
header
.
initX
,
y
:
header
.
initY
,
scaleX
:
header
.
initScaleX
,
scaleY
:
header
.
initScaleY
},
0.8
,
()
=>
{
this
.
m_setTimeoutIDs
.
push
(
setTimeout
(()
=>
{
header
.
ref
.
visible
=
false
},
4000
))
})
},
500
))
}
element
.
stopCruise
=
()
=>
{
header
.
ref
.
visible
=
false
;
this
.
g_cartoon
.
getCartoonElement
(
`header`
).
ref
.
visible
=
false
;
if
(
element
.
cruiseIntervalID
){
clearInterval
(
element
.
cruiseIntervalID
)
}
...
...
@@ -842,14 +874,14 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
ready
=
(
callback
?)
=>
{
tweenChange
(
element
.
ref
,
{
x
:
element
.
initX
,
y
:
element
.
initY
,
scaleX
:
element
.
initScaleX
,
scaleY
:
element
.
initScaleY
},
0.2
,
()
=>
{
this
.
g_enableMapDown
=
true
if
(
element
.
firstReady
){
element
.
firstReady
=
false
;
element
.
cruise
(()
=>
{
callback
&&
callback
()
})
}
else
{
callback
&&
callback
()
}
//
if(element.firstReady){
//
element.firstReady = false;
//
element.cruise(()=>{
//
callback && callback()
//
})
//
}else{
//
callback && callback()
//
}
})
}
...
...
@@ -876,7 +908,7 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
stopCruise
()
let
disX
=
element
.
ref
.
x
-
this
.
g_clickX
let
disY
=
element
.
ref
.
y
-
this
.
g_clickY
this
.
g_cartoon
.
playAudio
(
"
skier
"
,
false
,
null
,
true
)
this
.
g_cartoon
.
playAudio
(
"
move
"
)
this
.
muteBgMusic
(
true
)
this
.
enableMoveAsstant
(()
=>
{
element
.
ref
.
x
=
this
.
g_clickX
+
disX
;
...
...
@@ -890,11 +922,13 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
element
.
enableDrag
){
element
.
enableDrag
=
false
;
element
.
targetRunWay
=
this
.
calcRunWayIndex
(
element
.
ref
.
x
,
element
.
ref
.
y
)
this
.
g_cartoon
.
stopAudio
(
"
skier
"
)
// this.g_cartoon.playAudio("move
")
this
.
muteBgMusic
(
false
)
element
.
go
(
element
.
targetRunWay
,
()
=>
{
if
(
this
.
gameControl
(
element
.
targetRunWay
)){
this
.
g_cartoon
.
playAudio
(
"
sm-choice-correct
"
)
this
.
g_cartoon
.
playAudio
(
"
sm-choice-correct
"
,
false
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
"
win
"
)
})
element
.
goAhead
(()
=>
{
this
.
nextQuestion
(()
=>
{
this
.
loadQuestion
()
...
...
@@ -902,7 +936,9 @@ export class PlayComponent implements OnInit, OnDestroy {
})
})
}
else
{
this
.
g_cartoon
.
playAudio
(
"
sm-choice-error
"
)
this
.
g_cartoon
.
playAudio
(
"
sm-choice-error
"
,
false
,()
=>
{
this
.
g_cartoon
.
playAudio
(
"
move
"
)
})
this
.
g_cartoon
.
getCartoonElement
(
`question-card-
${
element
.
targetRunWay
}
`
).
shake
(()
=>
{
element
.
ready
()
})
...
...
@@ -993,53 +1029,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// 小手
initHeader
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
`header`
,
"
header
"
,
(
w
,
h
)
=>
{
return
{
sx
:
98
*
this
.
g_mapScale
/
w
,
sy
:
97
*
this
.
g_mapScale
/
h
}
},
(
w
,
h
)
=>
{
return
{
x
:
this
.
g_canvasWidth
/
2
,
y
:
this
.
g_canvasHeight
/
2
}
})
element
.
ref
.
visible
=
false
;;
element
.
move
=
()
=>
{
let
y
=
this
.
g_cartoon
.
getCartoonElement
(
"
skier
"
).
ref
.
y
+
50
*
this
.
g_mapScale
tweenChange
(
element
.
ref
,
{
x
:
fakePoint
[
currentIndex
],
y
:
y
},
0.5
)
currentIndex
++
;
if
(
currentIndex
==
9
){
currentIndex
=
0
;
}
}
element
.
in
=
(
callback
?)
=>
{
element
.
ref
.
x
=
this
.
g_canvasWidth
+
100
*
this
.
g_mapScale
element
.
ref
.
y
=
this
.
g_canvasHeight
+
100
*
this
.
g_mapScale
let
dis
=
{
x
:
this
.
g_cartoon
.
getCartoonElement
(
"
camera
"
).
ref
.
x
+
55
*
this
.
g_mapScale
,
y
:
this
.
g_cartoon
.
getCartoonElement
(
"
camera
"
).
ref
.
y
+
55
*
this
.
g_mapScale
}
tweenChange
(
element
.
ref
,
dis
,
0.5
,
()
=>
{
callback
&&
callback
()
})
element
.
ref
.
visible
=
true
;
}
element
.
out
=
()
=>
{
element
.
ref
.
visible
=
false
;
}
let
currentIndex
=
0
;
let
fakePoint
=
[
735
,
1040
,
468
,
1288
,
196
,
1040
,
1288
,
735
,
196
]
this
.
render
(
element
.
ref
)
}
...
...
src/app/play/resources.js
View file @
0b6b99d2
...
...
@@ -70,8 +70,8 @@ const localAudios = {
'
sm-choice-error
'
:
'
assets/default/audio/sm-choice-error.mp3
'
,
'
skier
'
:
'
assets/audio/skier.mp3
'
,
'
win
'
:
'
assets/audio/win.mp3
'
,
"
bg_music
"
:
"
assets/audio/bg_music.mp3
"
"
bg_music
"
:
"
assets/audio/bg_music.mp3
"
,
"
move
"
:
"
assets/audio/move.mp3
"
};
export
{
localImages
,
localAudios
};
src/assets/audio/move.mp3
0 → 100644
View file @
0b6b99d2
File added
src/assets/play/skier.png
View replaced file @
216ff7e4
View file @
0b6b99d2
49.2 KB
|
W:
|
H:
81 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