示例#1
0
 static SoundPool()
 {
     SoundPool.playingAttached = new SoundPool.Root(SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.RESERVED);
     SoundPool.playingCamera = new SoundPool.Root(SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.DISPOSED);
     SoundPool.playing = new SoundPool.Root(SoundPool.RootID.PLAYING_ATTACHED | SoundPool.RootID.PLAYING_CAMERA | SoundPool.RootID.PLAYING | SoundPool.RootID.RESERVED | SoundPool.RootID.DISPOSED);
     SoundPool.reserved = new SoundPool.Root(SoundPool.RootID.RESERVED);
     SoundPool.firstLeak = false;
     SoundPool.goTypes = new Type[] { typeof(AudioSource) };
     SoundPool.Settings setting = new SoundPool.Settings()
     {
         volume = 1f,
         pitch = 1f,
         mode = AudioRolloffMode.Linear,
         min = 1f,
         max = 500f,
         panLevel = 1f,
         doppler = 1f,
         priority = 128,
         localRotation = Quaternion.identity
     };
     SoundPool.DEF = setting;
 }
示例#2
0
 public void Reserve()
 {
     switch (this.rootID)
     {
         case SoundPool.RootID.LIMBO:
         {
             break;
         }
         case SoundPool.RootID.RESERVED:
         case SoundPool.RootID.DISPOSED:
         {
             return;
         }
         default:
         {
             this.audio.Stop();
             this.audio.enabled = false;
             this.audio.clip = null;
             this.parent = null;
             if (this.way.next.has)
             {
                 this.way.next.node.way.prev = this.way.prev;
             }
             if (!this.way.prev.has)
             {
                 this.root.first = this.way.next;
             }
             else
             {
                 this.way.prev.node.way.next = this.way.next;
             }
             SoundPool.Root root = this.root;
             root.count = root.count - 1;
             this.way = new SoundPool.Way();
             break;
         }
     }
     this.root = SoundPool.reserved;
     this.rootID = SoundPool.RootID.RESERVED;
     this.way.next = SoundPool.reserved.first;
     if (this.way.next.has)
     {
         this.way.next.node.way.prev.has = true;
         this.way.next.node.way.prev.node = this;
     }
     SoundPool.reserved.first.has = true;
     SoundPool.reserved.first.node = this;
     SoundPool.Root root1 = SoundPool.reserved;
     root1.count = root1.count + 1;
 }
示例#3
0
 public void EnterLimbo()
 {
     switch (this.rootID)
     {
         case SoundPool.RootID.LIMBO:
         case SoundPool.RootID.DISPOSED:
         {
             return;
         }
         case SoundPool.RootID.RESERVED:
         {
             break;
         }
         default:
         {
             this.audio.Stop();
             this.audio.enabled = false;
             this.audio.clip = null;
             this.parent = null;
             break;
         }
     }
     if (!this.way.prev.has)
     {
         this.root.first = this.way.next;
     }
     else
     {
         this.way.prev.node.way.next = this.way.next;
     }
     if (this.way.next.has)
     {
         this.way.next.node.way.prev = this.way.prev;
     }
     SoundPool.Root root = this.root;
     root.count = root.count - 1;
     this.way = new SoundPool.Way();
     this.root = null;
     this.rootID = SoundPool.RootID.LIMBO;
 }