Commit c863b38e authored by 李维's avatar 李维

dev commit

parent 2996131e
...@@ -71,7 +71,7 @@ export class Cartoon { ...@@ -71,7 +71,7 @@ export class Cartoon {
// 播放音乐 // 播放音乐
_playingNow = [] _playingNow = []
audioCallback = {} audioCallback = {}
playAudio = function( key, now = false, callback = null, onplayingCallback?, loop?) { playAudio = function( key, now = false, callback = null, loop?, onplayingCallback?) {
const audio = this.audio.get(key); const audio = this.audio.get(key);
if (audio) { if (audio) {
if (now) { if (now) {
...@@ -93,10 +93,10 @@ export class Cartoon { ...@@ -93,10 +93,10 @@ export class Cartoon {
} }
if(onplayingCallback){ if(onplayingCallback){
this.audioCallback[key]["onplaying"] = ()=>{ this.audioCallback[key]["onplaying"] = ()=>{
onplayingCallback && onplayingCallback() onplayingCallback && onplayingCallback(audio)
} }
audio.onplaying = ()=>{ audio.onplaying = ()=>{
onplayingCallback && onplayingCallback() onplayingCallback && onplayingCallback(audio)
} }
} }
audio.play(); audio.play();
......
...@@ -224,6 +224,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -224,6 +224,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_enableAutoRunFocus = true; this.m_enableAutoRunFocus = true;
this.autoRunFocus() this.autoRunFocus()
this.initShowCard(); this.initShowCard();
this.g_cartoon.playAudio("sm-run", false ,null, true, (audio)=>{
audio.volume = 0.3
})
} }
cleanGameVar(){ cleanGameVar(){
...@@ -298,6 +301,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -298,6 +301,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.subscribeMapDownEvent(element.id, ()=>{ this.subscribeMapDownEvent(element.id, ()=>{
if(this.m_enableCamera){ if(this.m_enableCamera){
this.m_enableCamera = false; this.m_enableCamera = false;
this.g_cartoon.stopAudio("sm-run")
clearTimeout(this.m_autoFocusID) clearTimeout(this.m_autoFocusID)
this.g_cartoon.playAudio("sm-camera") this.g_cartoon.playAudio("sm-camera")
this.g_cartoon.getCartoonElement(`card-show`).show(()=>{ this.g_cartoon.getCartoonElement(`card-show`).show(()=>{
...@@ -598,6 +602,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -598,6 +602,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if(imageIndex!=-1){ if(imageIndex!=-1){
element.ref.children.splice(imageIndex,1) element.ref.children.splice(imageIndex,1)
} }
this.g_cartoon.playAudio("sm-run", false, null, true, (audio)=>{
audio.volume = 0.3
})
callback && callback() callback && callback()
}) })
......
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