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
216ff7e4
Commit
216ff7e4
authored
May 22, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev commit
parent
6cce8f37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
39 deletions
+61
-39
play.component.ts
src/app/play/play.component.ts
+60
-39
resources.js
src/app/play/resources.js
+1
-0
bg_music.mp3
src/assets/audio/bg_music.mp3
+0
-0
No files found.
src/app/play/play.component.ts
View file @
216ff7e4
...
...
@@ -149,6 +149,7 @@ export class PlayComponent implements OnInit, OnDestroy {
{
x
:
450
}
]
m_currentQuestion
=
0
;
m_bgMusic
=
null
// ------------------------------------
...
...
@@ -235,6 +236,10 @@ export class PlayComponent implements OnInit, OnDestroy {
startGame
(){
this
.
loadQuestion
()
this
.
g_cartoon
.
playAudio
(
"
bg_music
"
,
false
,
null
,
true
,
(
audio
)
=>
{
this
.
m_bgMusic
=
audio
audio
.
volume
=
0.05
})
this
.
g_cartoon
.
getCartoonElement
(
`question-index-board`
).
resetIndex
()
this
.
g_cartoon
.
getCartoonElement
(
"
play-audio
"
).
in
()
this
.
g_cartoon
.
getCartoonElement
(
"
skier
"
).
ready
(()
=>
{
...
...
@@ -249,7 +254,10 @@ export class PlayComponent implements OnInit, OnDestroy {
endGame
(){
this
.
showEndPatal
()
this
.
g_cartoon
.
playAudio
(
"
win
"
)
this
.
muteBgMusic
(
true
)
this
.
g_cartoon
.
playAudio
(
"
win
"
,
false
,
()
=>
{
this
.
muteBgMusic
(
false
)
})
this
.
m_setTimeoutIDs
.
push
(
setTimeout
(()
=>
{
this
.
stopEndPatal
()
},
3000
))
...
...
@@ -265,6 +273,14 @@ export class PlayComponent implements OnInit, OnDestroy {
})
}
muteBgMusic
(
status
){
if
(
status
){
this
.
m_bgMusic
.
volume
=
0
}
else
{
this
.
m_bgMusic
.
volume
=
0.05
}
}
initBackground
(){
let
element
=
this
.
g_cartoon
.
createCartoonElementImage
(
"
background-main
"
,
"
background
"
,
this
.
g_canvasWidth
,
this
.
g_canvasHeight
,
this
.
g_canvasWidth
/
2
,
this
.
g_canvasHeight
/
2
)
...
...
@@ -489,8 +505,13 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
!
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
audio_url
){
return
}
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
++
){
...
...
@@ -758,32 +779,40 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
firstClick
=
true
element
.
cruise
=
(
callback
?)
=>
{
header
.
ref
.
visible
=
true
;
tweenChange
(
header
.
ref
,
{
x
:
header
.
initX
,
y
:
header
.
initY
,
scaleX
:
header
.
initScaleX
,
scaleY
:
header
.
initScaleY
},
0.8
,
()
=>
{
if
(
element
.
firstClick
){
element
.
cruiseSetTimeoutID
=
setTimeout
(()
=>
{
let
dir
=
false
;
let
step
=
10
*
this
.
g_mapScale
element
.
cruiseIntervalID
=
setInterval
(()
=>
{
if
(
dir
){
element
.
ref
.
x
+=
step
}
else
{
element
.
ref
.
x
-=
step
}
if
(
element
.
ref
.
x
>
this
.
g_canvasWidth
-
300
*
this
.
g_mapScale
||
element
.
ref
.
x
<
300
*
this
.
g_mapScale
){
dir
=
!
dir
}
},
30
)
this
.
m_setIntervalIDs
.
push
(
element
.
cruiseIntervalID
)
callback
&&
callback
()
},
500
)
this
.
m_setTimeoutIDs
.
push
(
element
.
cruiseSetTimeoutID
)
}
})
if
(
element
.
firstClick
){
element
.
cruiseSetTimeoutID
=
setTimeout
(()
=>
{
let
dir
=
false
;
let
step
=
10
*
this
.
g_mapScale
element
.
cruiseIntervalID
=
setInterval
(()
=>
{
if
(
dir
){
element
.
ref
.
x
+=
step
}
else
{
element
.
ref
.
x
-=
step
}
if
(
element
.
ref
.
x
>
this
.
g_canvasWidth
-
300
*
this
.
g_mapScale
||
element
.
ref
.
x
<
300
*
this
.
g_mapScale
){
dir
=
!
dir
}
},
30
)
this
.
m_setIntervalIDs
.
push
(
element
.
cruiseIntervalID
)
callback
&&
callback
()
},
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
=
()
=>
{
...
...
@@ -848,6 +877,7 @@ export class PlayComponent implements OnInit, OnDestroy {
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
.
muteBgMusic
(
true
)
this
.
enableMoveAsstant
(()
=>
{
element
.
ref
.
x
=
this
.
g_clickX
+
disX
;
element
.
ref
.
y
=
this
.
g_clickY
+
disY
;
...
...
@@ -861,15 +891,14 @@ export class PlayComponent implements OnInit, OnDestroy {
element
.
enableDrag
=
false
;
element
.
targetRunWay
=
this
.
calcRunWayIndex
(
element
.
ref
.
x
,
element
.
ref
.
y
)
this
.
g_cartoon
.
stopAudio
(
"
skier
"
)
this
.
muteBgMusic
(
false
)
element
.
go
(
element
.
targetRunWay
,
()
=>
{
if
(
this
.
gameControl
(
element
.
targetRunWay
)){
this
.
g_cartoon
.
playAudio
(
"
sm-choice-correct
"
)
element
.
goAhead
(()
=>
{
this
.
nextQuestion
(()
=>
{
this
.
loadQuestion
()
element
.
ready
(()
=>
{
// this.g_cartoon.getCartoonElement("play-audio").play()
})
element
.
ready
()
})
})
}
else
{
...
...
@@ -950,18 +979,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
endGame
()
}
else
{
this
.
m_currentQuestion
++
// this.g_cartoon.getCartoonElement("mask-layer").in(()=>{
// this.showMMilestoneBoardTotal(this.m_currentQuestion, ()=>{
// this.g_cartoon.getCartoonElement("mask-layer").out(()=>{
// callback && callback()
// })
// })
// })
for
(
let
index
=
0
;
index
<
4
;
index
++
){
this
.
g_cartoon
.
getCartoonElement
(
`question-card-
${
index
}
`
).
ref
.
visible
=
false
;
}
this
.
showEndPatal
()
// this.g_cartoon.playAudio("win")
this
.
m_setTimeoutIDs
.
push
(
setTimeout
(()
=>
{
this
.
stopEndPatal
()
callback
&&
callback
()
...
...
src/app/play/resources.js
View file @
216ff7e4
...
...
@@ -70,6 +70,7 @@ 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
"
};
...
...
src/assets/audio/bg_music.mp3
0 → 100644
View file @
216ff7e4
File added
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