public void Stop() { if (this.PlayFunction == CustomSound3.EPlayFunction.PlayBGM || this.PlayFunction == CustomSound3.EPlayFunction.PlayBGMDelay) { MonoSingleton <MySound> .Instance.StopBGM(this.StopSec); } if (this.mHandles == null) { return; } using (List <CustomSound3.PlayHandles> .Enumerator enumerator = this.mHandles.GetEnumerator()) { while (enumerator.MoveNext()) { CustomSound3.PlayHandles current = enumerator.Current; if (current != null) { if (current.mPlayHandle != null) { current.mPlayHandle.Stop(this.StopSec); current.mPlayHandle = (MySound.PlayHandle)null; } if (current.mCueSheetHandle != null) { current.mCueSheetHandle.StopDefaultAll(this.StopSec); current.mCueSheetHandle = (MySound.CueSheetHandle)null; } if (current.mVoice != null) { current.mVoice.StopAll(this.StopSec); current.mVoice = (MySound.Voice)null; } } } } this.mHandles.Clear(); }
public void Play() { if (this.StopOnPlay) { this.Stop(); } if (this.mHandles == null) { return; } CustomSound3.PlayHandles playHandles = new CustomSound3.PlayHandles(); if (playHandles == null) { return; } if (this.PlayFunction == CustomSound3.EPlayFunction.PlayBGM) { MonoSingleton <MySound> .Instance.PlayBGM(this.cueID, this.sheetName); } else if (this.PlayFunction == CustomSound3.EPlayFunction.PlayBGMDelay) { MonoSingleton <MySound> .Instance.PlayBGM(this.cueID, this.DelayPlaySec, this.sheetName); } else if (this.PlayFunction == CustomSound3.EPlayFunction.PlayJingle) { MonoSingleton <MySound> .Instance.PlayJingle(this.cueID, this.DelayPlaySec, this.sheetName); } else if (this.PlayFunction == CustomSound3.EPlayFunction.VoicePlay) { playHandles.mVoice = new MySound.Voice(this.sheetName, (string)null, (string)null); if (playHandles.mVoice != null) { playHandles.mVoice.Play(this.cueID, this.DelayPlaySec); } } else if (this.PlayFunction == CustomSound3.EPlayFunction.PlaySEOneShot) { MonoSingleton <MySound> .Instance.PlaySEOneShot(this.cueID, this.DelayPlaySec); } else if (this.PlayFunction == CustomSound3.EPlayFunction.PlaySELoop) { playHandles.mPlayHandle = MonoSingleton <MySound> .Instance.PlaySELoop(this.cueID, this.DelayPlaySec); } else if (this.PlayFunction == CustomSound3.EPlayFunction.CueSheetHandlePlayOneShot) { MonoSingleton <MySound> .Instance.PlayOneShot(this.sheetName, this.cueID, this.CueSheetHandlePlayCategory, this.DelayPlaySec); } else if (this.PlayFunction == CustomSound3.EPlayFunction.CueSheetHandlePlayLoop) { playHandles.mPlayHandle = MonoSingleton <MySound> .Instance.PlayLoop(this.sheetName, this.cueID, this.CueSheetHandlePlayCategory, this.DelayPlaySec); } else if (this.PlayFunction == CustomSound3.EPlayFunction.CueSheetHandlePlay) { playHandles.mCueSheetHandle = MySound.CueSheetHandle.Create(this.sheetName, this.CueSheetHandlePlayCategory, true, true, false); if (playHandles.mCueSheetHandle != null) { playHandles.mPlayHandle = playHandles.mCueSheetHandle.Play(this.cueID, this.CueSheetHandlePlayLoopType, true, this.DelayPlaySec); } } if (!playHandles.IsValid) { return; } this.mHandles.Add(playHandles); }