Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM5-9
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
YM5-9
Commits
eec9e5f9
Commit
eec9e5f9
authored
Feb 02, 2021
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sound
parent
cc76e42c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
10 deletions
+23
-10
play.component.ts
src/app/play/play.component.ts
+16
-10
resources.js
src/app/play/resources.js
+7
-0
click_btn.mp3
src/assets/play/sound/click_btn.mp3
+0
-0
dacx.mp3
src/assets/play/sound/dacx.mp3
+0
-0
open.mp3
src/assets/play/sound/open.mp3
+0
-0
show_btn.mp3
src/assets/play/sound/show_btn.mp3
+0
-0
wtcx.mp3
src/assets/play/sound/wtcx.mp3
+0
-0
No files found.
src/app/play/play.component.ts
View file @
eec9e5f9
...
@@ -203,6 +203,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -203,6 +203,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initTopMaskLine
();
this
.
initTopMaskLine
();
this
.
nextQuestion
()
this
.
nextQuestion
()
this
.
g_cartoon
.
playAudio
(
"
open
"
)
}
}
cleanGameVar
(){
cleanGameVar
(){
...
@@ -312,7 +313,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -312,7 +313,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
body
=
this
.
g_cartoon
.
getCartoonElement
(
"
slider-body
"
);
let
body
=
this
.
g_cartoon
.
getCartoonElement
(
"
slider-body
"
);
let
bottom
=
this
.
g_cartoon
.
getCartoonElement
(
"
slider-bottom
"
);
let
bottom
=
this
.
g_cartoon
.
getCartoonElement
(
"
slider-bottom
"
);
let
bb
=
body
.
ref
.
getBoundingBox
()
let
bb
=
body
.
ref
.
getBoundingBox
()
body
.
ref
.
y
=
-
282
+
empty
+
4
+
bb
.
height
/
2
;
body
.
ref
.
y
=
-
282
+
empty
+
4
+
bb
.
height
/
2
/
this
.
g_mapScale
;
top
.
update
();
top
.
update
();
bottom
.
update
();
bottom
.
update
();
...
@@ -322,8 +323,8 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -322,8 +323,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let
sliderBG
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-background
"
,
"
bgSlider
"
,
(
w
,
h
)
=>
{
let
sliderBG
=
this
.
g_cartoon
.
createCartoonElementImageFunc
(
"
slider-background
"
,
"
bgSlider
"
,
(
w
,
h
)
=>
{
return
{
return
{
sx
:
14
/
w
,
sx
:
14
*
this
.
g_mapScale
/
w
,
sy
:
552
/
h
,
sy
:
552
*
this
.
g_mapScale
/
h
,
}
}
},
(
w
,
h
)
=>
{
},
(
w
,
h
)
=>
{
return
{
return
{
...
@@ -348,6 +349,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -348,6 +349,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
totalHeight
=
546
;
let
totalHeight
=
546
;
let
pix
=
totalHeight
/
fullHeight
;
let
pix
=
totalHeight
/
fullHeight
;
let
fillHeight
=
windowHeight
*
pix
let
fillHeight
=
windowHeight
*
pix
updateSlider
(
fillHeight
)
updateSlider
(
fillHeight
)
setProgress
(
current
)
setProgress
(
current
)
}
}
...
@@ -378,7 +380,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -378,7 +380,7 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderTop
.
update
=
()
=>
{
sliderTop
.
update
=
()
=>
{
let
y
=
sliderBody
.
ref
.
y
let
y
=
sliderBody
.
ref
.
y
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
y
-=
box
.
height
/
2
+
2
;
y
-=
box
.
height
/
2
/
this
.
g_mapScale
+
2
;
if
(
y
<-
271
)
{
if
(
y
<-
271
)
{
// console.log("滑动已到最上", y)
// console.log("滑动已到最上", y)
return
false
;
return
false
;
...
@@ -408,13 +410,13 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -408,13 +410,13 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBody
.
toEnd
=
()
=>
{
sliderBody
.
toEnd
=
()
=>
{
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
sliderBottom
.
ref
.
y
=
271
sliderBottom
.
ref
.
y
=
271
sliderBody
.
ref
.
y
=
sliderBottom
.
ref
.
y
-
box
.
height
/
2
-
2
;
sliderBody
.
ref
.
y
=
sliderBottom
.
ref
.
y
-
box
.
height
/
2
/
this
.
g_mapScale
-
2
;
sliderTop
.
update
();
sliderTop
.
update
();
}
}
sliderBody
.
toTop
=
()
=>
{
sliderBody
.
toTop
=
()
=>
{
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
sliderTop
.
ref
.
y
=
-
271
sliderTop
.
ref
.
y
=
-
271
sliderBody
.
ref
.
y
=
sliderTop
.
ref
.
y
+
box
.
height
/
2
+
2
;
sliderBody
.
ref
.
y
=
sliderTop
.
ref
.
y
+
box
.
height
/
2
/
this
.
g_mapScale
+
2
;
sliderBottom
.
update
();
sliderBottom
.
update
();
}
}
...
@@ -432,7 +434,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -432,7 +434,7 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBottom
.
update
=
()
=>
{
sliderBottom
.
update
=
()
=>
{
let
y
=
sliderBody
.
ref
.
y
let
y
=
sliderBody
.
ref
.
y
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
let
box
=
sliderBody
.
ref
.
getBoundingBox
()
y
+=
box
.
height
/
2
+
2
;
y
+=
box
.
height
/
2
/
this
.
g_mapScale
+
2
;
if
(
y
>
271
)
{
if
(
y
>
271
)
{
// console.log("滑动已到最下", y)
// console.log("滑动已到最下", y)
...
@@ -491,6 +493,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -491,6 +493,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
nextQuestion
)
{
if
(
nextQuestion
)
{
pannel
.
currentQuestionIndex
++
;
pannel
.
currentQuestionIndex
++
;
}
}
this
.
g_cartoon
.
playAudio
(
"
wtcx
"
)
let
textString
=
""
let
textString
=
""
let
startX
=
42
*
this
.
g_mapScale
;
let
startX
=
42
*
this
.
g_mapScale
;
if
(
nextQuestion
)
{
if
(
nextQuestion
)
{
...
@@ -522,6 +525,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -522,6 +525,7 @@ export class PlayComponent implements OnInit, OnDestroy {
pannel
.
canScroll
=
false
;
pannel
.
canScroll
=
false
;
pannel
.
firstInstert
=
true
;
pannel
.
firstInstert
=
true
;
pannel
.
insertAnswer
=
(
text
)
=>
{
pannel
.
insertAnswer
=
(
text
)
=>
{
this
.
g_cartoon
.
playAudio
(
"
dacx
"
)
let
line
=
this
.
creatAnswerTextLine
(
pannel
.
currentQuestionIndex
,
text
,
42
*
this
.
g_mapScale
*
2
,
pannel
.
currentY
,
pannel
.
ref
)
let
line
=
this
.
creatAnswerTextLine
(
pannel
.
currentQuestionIndex
,
text
,
42
*
this
.
g_mapScale
*
2
,
pannel
.
currentY
,
pannel
.
ref
)
let
label
=
line
.
label
let
label
=
line
.
label
let
bb
=
label
.
ref
.
getBoundingBox
();
let
bb
=
label
.
ref
.
getBoundingBox
();
...
@@ -555,8 +559,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -555,8 +559,7 @@ export class PlayComponent implements OnInit, OnDestroy {
return
;
return
;
}
}
clickSY
=
this
.
g_clickY
;
clickSY
=
this
.
g_clickY
;
baseY
=
pannel
.
ref
.
y
baseY
=
pannel
.
ref
.
y
;
console
.
log
(
"
baseY
"
,
baseY
)
},
()
=>
{
},
()
=>
{
let
dis
=
clickSY
-
this
.
g_clickY
;
let
dis
=
clickSY
-
this
.
g_clickY
;
let
_t
=
pannel
.
topY
-
(
pannel
.
currentY
-
pannel
.
windowHeight
)
let
_t
=
pannel
.
topY
-
(
pannel
.
currentY
-
pannel
.
windowHeight
)
...
@@ -578,7 +581,6 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -578,7 +581,6 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
progress
>
1
)
{
if
(
progress
>
1
)
{
progress
=
1
progress
=
1
}
}
console
.
log
(
progress
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
progress
)
this
.
g_cartoon
.
getCartoonElement
(
"
slider-background
"
).
initSlider
(
pannel
.
windowHeight
,
pannel
.
currentY
,
progress
)
// let crTop = sliderTop.update()
// let crTop = sliderTop.update()
// let crBottom = sliderBottom.update()
// let crBottom = sliderBottom.update()
...
@@ -614,6 +616,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -614,6 +616,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
})
})
btnQuestion
.
show
=
(
callback
)
=>
{
btnQuestion
.
show
=
(
callback
)
=>
{
this
.
g_cartoon
.
playAudio
(
"
show_btn
"
)
btnQuestion
.
ref
.
scaleX
=
0
;
btnQuestion
.
ref
.
scaleX
=
0
;
btnQuestion
.
ref
.
scaleY
=
0
;
btnQuestion
.
ref
.
scaleY
=
0
;
tweenChange
(
btnQuestion
.
ref
,
{
scaleX
:
btnQuestion
.
initScaleX
,
scaleY
:
btnQuestion
.
initScaleY
},
0.2
,
()
=>
{
tweenChange
(
btnQuestion
.
ref
,
{
scaleX
:
btnQuestion
.
initScaleX
,
scaleY
:
btnQuestion
.
initScaleY
},
0.2
,
()
=>
{
...
@@ -642,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -642,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy {
btnAnswer
.
ref
.
scaleX
=
0
;
btnAnswer
.
ref
.
scaleX
=
0
;
btnAnswer
.
ref
.
scaleY
=
0
;
btnAnswer
.
ref
.
scaleY
=
0
;
btnAnswer
.
show
=
(
callback
)
=>
{
btnAnswer
.
show
=
(
callback
)
=>
{
this
.
g_cartoon
.
playAudio
(
"
show_btn
"
)
btnAnswer
.
ref
.
scaleX
=
0
;
btnAnswer
.
ref
.
scaleX
=
0
;
btnAnswer
.
ref
.
scaleY
=
0
;
btnAnswer
.
ref
.
scaleY
=
0
;
tweenChange
(
btnAnswer
.
ref
,
{
scaleX
:
btnAnswer
.
initScaleX
,
scaleY
:
btnAnswer
.
initScaleY
},
0.2
,
()
=>
{
tweenChange
(
btnAnswer
.
ref
,
{
scaleX
:
btnAnswer
.
initScaleX
,
scaleY
:
btnAnswer
.
initScaleY
},
0.2
,
()
=>
{
...
@@ -661,6 +665,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -661,6 +665,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
questionText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
questionText
:
""
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
questionText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
questionText
:
""
let
textArray
=
text
.
split
(
/
\n
/
)
let
textArray
=
text
.
split
(
/
\n
/
)
let
lastIndex
=
textArray
.
length
;
let
lastIndex
=
textArray
.
length
;
this
.
g_cartoon
.
playAudio
(
"
click_btn
"
)
jelly
(
btnQuestion
.
ref
)
jelly
(
btnQuestion
.
ref
)
textArray
.
forEach
((
item
,
index
)
=>
{
textArray
.
forEach
((
item
,
index
)
=>
{
if
(
index
==
0
)
{
if
(
index
==
0
)
{
...
@@ -697,6 +702,7 @@ export class PlayComponent implements OnInit, OnDestroy {
...
@@ -697,6 +702,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
:
""
let
text
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
?
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestionIndex
].
answerText
:
""
let
textArray
=
text
.
split
(
/
\n
/
)
let
textArray
=
text
.
split
(
/
\n
/
)
let
lastIndex
=
textArray
.
length
;
let
lastIndex
=
textArray
.
length
;
this
.
g_cartoon
.
playAudio
(
"
click_btn
"
)
jelly
(
btnAnswer
.
ref
);
jelly
(
btnAnswer
.
ref
);
textArray
.
forEach
((
item
,
index
)
=>
{
textArray
.
forEach
((
item
,
index
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
...
src/app/play/resources.js
View file @
eec9e5f9
...
@@ -65,6 +65,13 @@ const localAudios = {
...
@@ -65,6 +65,13 @@ const localAudios = {
'
sm-choice-timeup-3
'
:
'
assets/default/audio/sm-choice-timeup-3.mp3
'
,
'
sm-choice-timeup-3
'
:
'
assets/default/audio/sm-choice-timeup-3.mp3
'
,
'
sm-go
'
:
'
assets/default/audio/sm-go.mp3
'
,
'
sm-go
'
:
'
assets/default/audio/sm-go.mp3
'
,
'
sm-ready
'
:
'
assets/default/audio/sm-ready.mp3
'
,
'
sm-ready
'
:
'
assets/default/audio/sm-ready.mp3
'
,
'
click_btn
'
:
'
assets/play/sound/click_btn.mp3
'
,
'
dacx
'
:
'
assets/play/sound/dacx.mp3
'
,
'
open
'
:
'
assets/play/sound/open.mp3
'
,
'
show_btn
'
:
'
assets/play/sound/show_btn.mp3
'
,
'
wtcx
'
:
'
assets/play/sound/wtcx.mp3
'
,
};
};
const
multiSizeBackground
=
{
const
multiSizeBackground
=
{
...
...
src/assets/play/sound/click_btn.mp3
0 → 100644
View file @
eec9e5f9
File added
src/assets/play/sound/dacx.mp3
0 → 100644
View file @
eec9e5f9
File added
src/assets/play/sound/open.mp3
0 → 100644
View file @
eec9e5f9
File added
src/assets/play/sound/show_btn.mp3
0 → 100644
View file @
eec9e5f9
File added
src/assets/play/sound/wtcx.mp3
0 → 100644
View file @
eec9e5f9
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