Commit 1913c256 authored by liujiangnan's avatar liujiangnan

fix: 音频不播放的问题

parent a2dff6e1
......@@ -678,6 +678,13 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_frontCurtainArr.push(E.ref)
}
userTriggerAudio(key){
if(key){
this.g_cartoon.playAudio(key)
this.g_cartoon.pauseAudio(key)
}
}
curtainContral(status, callback?){
let all = ["Curtain-A", "Curtain-B", "Curtain-C", "Curtain-D"]
let _this = this
......@@ -708,6 +715,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
initStartButton(){
let element = this.g_cartoon.createCartoonElementImageFunc("start-button", "btn_start", (w ,h)=>{
return {
......@@ -723,6 +732,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_frontCurtainArr.push(element.ref)
this.subscribeMapDownEvent(element.id, ()=>{
this.userTriggerAudio("gusheng_kaitou");
this.g_cartoon.playAudio("dianji")
this.showJellyAnimation(element.id, ()=>{
tweenChange(element.ref, {x: this.g_canvasWidth + 331 * this.g_mapScale}, 0.5)
......@@ -767,10 +779,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.showJellyAnimation(element.id, ()=>{
element.out()
})
this.g_cartoon.playAudio("jiazigu_changgusheng")
this.m_setTimeoutIDs.push(setTimeout(() => {
this.g_cartoon.playAudio("guzhang")
}, 1000))
this.m_restartGameFlag = true;
this.curtainContral(false, ()=>{
this.g_cartoon.getCartoonElement("boy").reset()
......@@ -926,6 +934,10 @@ export class PlayComponent implements OnInit, OnDestroy {
element.isOpen = false;
this.subscribeMapDownEvent(element.id, ()=>{
this.userTriggerAudio(`gusheng_${index+1}`);
this.userTriggerAudio(element.audio_url);
if(!this.m_startGame || element.isOpen){
if(element.isOpen){
this.g_cartoon.stopAllAudio();
......@@ -1036,59 +1048,6 @@ export class PlayComponent implements OnInit, OnDestroy {
}
// --------------------------------------------------
// -------------- Template function ---------------
// --------------------------------------------------
......
......@@ -5,7 +5,7 @@ export default {
{
type: "Text",
text: "Apple",
audio_url: "",
audio_url: "assets/play/sound/dianji.mp3",
image_url: ""
}
],
......
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