Commit eec9e5f9 authored by 李维's avatar 李维

Add sound

parent cc76e42c
......@@ -203,6 +203,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initTopMaskLine();
this.nextQuestion()
this.g_cartoon.playAudio("open")
}
cleanGameVar(){
......@@ -312,7 +313,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let body = this.g_cartoon.getCartoonElement("slider-body");
let bottom = this.g_cartoon.getCartoonElement("slider-bottom");
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();
bottom.update();
......@@ -322,8 +323,8 @@ export class PlayComponent implements OnInit, OnDestroy {
let sliderBG = this.g_cartoon.createCartoonElementImageFunc("slider-background", "bgSlider", (w, h)=>{
return {
sx: 14 / w,
sy: 552 / h,
sx: 14 * this.g_mapScale / w,
sy: 552 * this.g_mapScale / h,
}
}, (w, h)=>{
return {
......@@ -348,6 +349,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let totalHeight = 546;
let pix = totalHeight / fullHeight;
let fillHeight = windowHeight * pix
updateSlider(fillHeight)
setProgress(current)
}
......@@ -378,7 +380,7 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderTop.update = () => {
let y = sliderBody.ref.y
let box = sliderBody.ref.getBoundingBox()
y -= box.height / 2 + 2;
y -= box.height / 2 / this.g_mapScale + 2;
if(y<-271) {
// console.log("滑动已到最上", y)
return false;
......@@ -408,13 +410,13 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBody.toEnd = () => {
let box = sliderBody.ref.getBoundingBox()
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();
}
sliderBody.toTop = () => {
let box = sliderBody.ref.getBoundingBox()
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();
}
......@@ -432,7 +434,7 @@ export class PlayComponent implements OnInit, OnDestroy {
sliderBottom.update = () => {
let y = sliderBody.ref.y
let box = sliderBody.ref.getBoundingBox()
y += box.height / 2 + 2;
y += box.height / 2 / this.g_mapScale + 2;
if(y>271) {
// console.log("滑动已到最下", y)
......@@ -491,6 +493,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(nextQuestion) {
pannel.currentQuestionIndex++;
}
this.g_cartoon.playAudio("wtcx")
let textString = ""
let startX = 42 * this.g_mapScale;
if(nextQuestion) {
......@@ -522,6 +525,7 @@ export class PlayComponent implements OnInit, OnDestroy {
pannel.canScroll = false;
pannel.firstInstert = true;
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 label = line.label
let bb = label.ref.getBoundingBox();
......@@ -555,8 +559,7 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
clickSY = this.g_clickY;
baseY = pannel.ref.y
console.log("baseY", baseY)
baseY = pannel.ref.y;
}, ()=>{
let dis = clickSY - this.g_clickY;
let _t = pannel.topY - (pannel.currentY - pannel.windowHeight)
......@@ -578,7 +581,6 @@ export class PlayComponent implements OnInit, OnDestroy {
if(progress>1) {
progress = 1
}
console.log(progress)
this.g_cartoon.getCartoonElement("slider-background").initSlider(pannel.windowHeight, pannel.currentY, progress)
// let crTop = sliderTop.update()
// let crBottom = sliderBottom.update()
......@@ -614,6 +616,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
btnQuestion.show = (callback) => {
this.g_cartoon.playAudio("show_btn")
btnQuestion.ref.scaleX = 0;
btnQuestion.ref.scaleY = 0;
tweenChange(btnQuestion.ref, {scaleX: btnQuestion.initScaleX, scaleY: btnQuestion.initScaleY}, 0.2, ()=>{
......@@ -642,6 +645,7 @@ export class PlayComponent implements OnInit, OnDestroy {
btnAnswer.ref.scaleX = 0;
btnAnswer.ref.scaleY = 0;
btnAnswer.show = (callback) => {
this.g_cartoon.playAudio("show_btn")
btnAnswer.ref.scaleX = 0;
btnAnswer.ref.scaleY = 0;
tweenChange(btnAnswer.ref, {scaleX: btnAnswer.initScaleX, scaleY: btnAnswer.initScaleY}, 0.2, ()=>{
......@@ -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 textArray = text.split(/\n/)
let lastIndex = textArray.length;
this.g_cartoon.playAudio("click_btn")
jelly(btnQuestion.ref)
textArray.forEach((item, index) => {
if(index==0) {
......@@ -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 textArray = text.split(/\n/)
let lastIndex = textArray.length;
this.g_cartoon.playAudio("click_btn")
jelly(btnAnswer.ref);
textArray.forEach((item, index) => {
setTimeout(() => {
......
......@@ -65,6 +65,13 @@ const localAudios = {
'sm-choice-timeup-3': 'assets/default/audio/sm-choice-timeup-3.mp3',
'sm-go': 'assets/default/audio/sm-go.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 = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment