protected override void ProcessMsg(int key, QMsg msg) { switch (msg.EventID) { case (int)AudioEvent.SoundSwitch: var soundSwitchMsg = msg as AudioMsgWithBool; AudioKit.Settings.IsSoundOn.Value = soundSwitchMsg.on; break; case (int)AudioEvent.MusicSwitch: var musicSwitchMsg = msg as AudioMsgWithBool; AudioKit.Settings.IsMusicOn.Value = musicSwitchMsg.on; if (!AudioKit.Settings.IsMusicOn.Value) { AudioKit.StopMusic(); } break; case (int)AudioEvent.PlayMusic: Log.I("play music msg: {0}, is musicOn: {1}", AudioEvent.PlayMusic.ToString(), AudioKit.Settings.IsMusicOn.Value); var musicMsg = msg as AudioMusicMsg; AudioKit.PlayMusic(musicMsg.MusicName, musicMsg.Loop, musicMsg.onMusicBeganCallback, musicMsg.onMusicEndedCallback, musicMsg.allowMusicOff); break; case (int)AudioEvent.StopMusic: AudioKit.StopMusic(); break; case (int)AudioEvent.PlaySound: AudioSoundMsg audioSoundMsg = msg as AudioSoundMsg; PlaySound(audioSoundMsg); break; case (int)AudioEvent.PlayVoice: var voiceMsg = msg as AudioVoiceMsg; AudioKit.PlayVoice(voiceMsg.voiceName, voiceMsg.loop, voiceMsg.onVoiceBeganCallback, voiceMsg.onVoiceEndedCallback); break; case (int)AudioEvent.StopVoice: AudioKit.StopVoice(); break; case (int)AudioEvent.PlayNode: var msgPlayNode = (msg as AudioMsgWithNode).Node; StartCoroutine(msgPlayNode.Execute()); break; case (int)AudioEvent.AddRetainAudio: AddRetainAudioMsg addRetainAudioMsg = msg as AddRetainAudioMsg; AddRetainAudio(addRetainAudioMsg.AudioName); break; case (int)AudioEvent.RemoveRetainAudioAudio: RemoveRetainAudioMsg removeRetainAudioMsg = msg as RemoveRetainAudioMsg; RemoveRetainAudio(removeRetainAudioMsg.AudioName); break; case (int)AudioEvent.PauseMusic: AudioKit.PauseMusic(); break; case (int)AudioEvent.ResumeMusic: AudioKit.ResumeMusic(); break; } }
public static void StopVoice() { AudioKit.StopVoice(); }