示例#1
0
 public void Play()
 {
     this.Stop();
     if (this.LoopFlag)
     {
         MySound.EType type = MySound.EType.SE;
         if (!string.IsNullOrEmpty(this.CueName))
         {
             if (this.CueName.StartsWith("BGM_"))
             {
                 type = MySound.EType.BGM;
             }
             else if (this.CueName.StartsWith("JIN_"))
             {
                 type = MySound.EType.JINGLE;
             }
             else if (this.CueName.StartsWith("VO_"))
             {
                 type = MySound.EType.VOICE;
             }
         }
         this.mPlayHandle = MonoSingleton <MySound> .Instance.PlayLoop(this.CueSheet, this.CueName, type, 0.0f);
     }
     else
     {
         MonoSingleton <MySound> .Instance.PlayOneShot(this.CueSheet, this.CueName, MySound.EType.SE, 0.0f);
     }
 }
示例#2
0
 public void Stop()
 {
     if (this.mPlayHandle == null)
     {
         return;
     }
     this.mPlayHandle.Stop(this.StopSec);
     this.mPlayHandle = (MySound.PlayHandle)null;
 }
示例#3
0
 protected override void OnDestroy()
 {
     if (this.mPlayHandle != null)
     {
         this.mPlayHandle.Stop(this.FadeOutSec);
         this.mPlayHandle = (MySound.PlayHandle)null;
     }
     if (this.mHandle != null)
     {
         this.mHandle.StopDefaultAll(this.FadeOutSec);
         this.mHandle = (MySound.CueSheetHandle)null;
     }
     base.OnDestroy();
 }
示例#4
0
 private void OnDestroy()
 {
     if (this.mPlayHandle != null)
     {
         this.mPlayHandle.Stop(this.mFadeOutSec);
         this.mPlayHandle = (MySound.PlayHandle)null;
     }
     if (this.mHandle == null)
     {
         return;
     }
     this.mHandle.StopDefaultAll(this.mFadeOutSec);
     this.mHandle = (MySound.CueSheetHandle)null;
 }
示例#5
0
 public override void OnActivate(int pinID)
 {
     if (this.RepeatCount > 0 || (double)this.StopSec > 0.0)
     {
         GameObject gameObject = new GameObject("PlaySERepeat", new System.Type[1]
         {
             typeof(PlaySERepeat)
         });
         PlaySERepeat component = (PlaySERepeat)gameObject.GetComponent <PlaySERepeat>();
         if (Object.op_Equality((Object)component, (Object)null))
         {
             Object.Destroy((Object)gameObject);
         }
         else
         {
             component.Setup(this.mSheetName, this.cueID, this.Type, this.RepeatCount, this.RepeatWait, this.StopSec, this.FadeOutSec, this.UseCustomPlay, this.CustomLoopFlag, this.CustomDelaySec);
             if (this.FadeOutOnDestroy)
             {
                 gameObject.get_transform().set_parent(((Component)this).get_gameObject().get_transform());
             }
             else
             {
                 Object.DontDestroyOnLoad((Object)gameObject);
             }
         }
     }
     else if (!this.FadeOutOnDestroy)
     {
         MonoSingleton <MySound> .Instance.PlayOneShot(this.mSheetName, this.cueID, this.Type, 0.0f);
     }
     else
     {
         this.mHandle = MySound.CueSheetHandle.Create(this.mSheetName, this.Type, true, true, false);
         if (this.mHandle != null)
         {
             if (this.UseCustomPlay)
             {
                 this.mPlayHandle = this.mHandle.Play(this.cueID, this.CustomLoopFlag, true, this.CustomDelaySec);
             }
             else
             {
                 this.mHandle.CreateDefaultOneShotSource();
                 this.mHandle.PlayDefaultOneShot(this.cueID, false, 0.0f);
             }
         }
     }
     this.ActivateOutputLinks(1);
 }
示例#6
0
 private void Update()
 {
     if (this.mStop)
     {
         this.mStopSec -= Time.get_unscaledDeltaTime();
         if ((double)this.mStopSec <= 0.0)
         {
             if (this.mPlayHandle != null)
             {
                 this.mPlayHandle.Stop(this.mFadeOutSec);
                 this.mPlayHandle = (MySound.PlayHandle)null;
             }
             if (this.mHandle != null)
             {
                 this.mHandle.StopDefaultAll(this.mFadeOutSec);
                 this.mHandle = (MySound.CueSheetHandle)null;
             }
             Object.Destroy((Object)((Component)this).get_gameObject());
             return;
         }
     }
     if (this.mPlayCount <= 0)
     {
         return;
     }
     this.mRepeatWait -= Time.get_unscaledDeltaTime();
     if ((double)this.mRepeatWait > 0.0)
     {
         return;
     }
     if (this.mUseCustomPlay)
     {
         this.mPlayHandle = this.mHandle.Play(this.mCueID, this.mCustomLoopFlag, false, this.mCustomDelaySec);
     }
     else
     {
         this.mHandle.PlayDefaultOneShot(this.mCueID, false, 0.0f);
     }
     this.mRepeatWait = this.RepeatWait;
     --this.mPlayCount;
     if (this.mStop || this.mPlayCount > 0)
     {
         return;
     }
     Object.Destroy((Object)((Component)this).get_gameObject());
 }
示例#7
0
 public void Play()
 {
     this.Stop();
     if (this.type == CustomSound.EType.SE)
     {
         if (this.LoopFlag)
         {
             this.mPlayHandle = MonoSingleton <MySound> .Instance.PlaySELoop(this.cueID, 0.0f);
         }
         else
         {
             MonoSingleton <MySound> .Instance.PlaySEOneShot(this.cueID, 0.0f);
         }
     }
     else
     {
         if (this.type != CustomSound.EType.JINGLE)
         {
             return;
         }
         MonoSingleton <MySound> .Instance.PlayJingle(this.cueID, 0.0f, (string)null);
     }
 }