Exemplo n.º 1
0
 public void StopSoundEffect(Int32 soundIndex)
 {
     SoundDatabase[] array = new SoundDatabase[]
     {
         this.gameSoundDatabase,
         this.sceneSoundDatabase,
         this.onTheFlySoundDatabase
     };
     SoundDatabase[] array2 = array;
     for (Int32 i = 0; i < (Int32)array2.Length; i++)
     {
         SoundDatabase soundDatabase = array2[i];
         foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll())
         {
             SoundProfile value = keyValuePair.Value;
             if (value.SoundIndex == soundIndex)
             {
                 Int32 soundID = value.SoundID;
                 if (this.playedEffectSet.Contains(soundID))
                 {
                     ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_Stop(soundID, 0);
                     this.playedEffectSet.Remove(soundID);
                     SoundLib.Log("Force stop success");
                 }
                 else
                 {
                     SoundLib.Log("soundID: " + soundID + " not found");
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public Boolean IsSoundEffectPlaying(Int32 soundIndex)
 {
     SoundDatabase[] array = new SoundDatabase[]
     {
         this.gameSoundDatabase,
         this.sceneSoundDatabase,
         this.onTheFlySoundDatabase
     };
     SoundDatabase[] array2 = array;
     for (Int32 i = 0; i < (Int32)array2.Length; i++)
     {
         SoundDatabase soundDatabase = array2[i];
         foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll())
         {
             SoundProfile value = keyValuePair.Value;
             if (value.SoundIndex == soundIndex)
             {
                 Int32 soundID = value.SoundID;
                 if (this.playedEffectSet.Contains(soundID))
                 {
                     return(true);
                 }
                 SoundLib.Log("soundID: " + soundID + " not found");
             }
         }
     }
     SoundLib.Log("soundIndex: " + soundIndex + " not found in DB");
     return(false);
 }
Exemplo n.º 3
0
 public void SetVolume(Single volume)
 {
     SoundDatabase[] array = new SoundDatabase[]
     {
         this.gameSoundDatabase,
         this.sceneSoundDatabase,
         this.onTheFlySoundDatabase
     };
     SoundDatabase[] array2 = array;
     for (Int32 i = 0; i < (Int32)array2.Length; i++)
     {
         SoundDatabase soundDatabase = array2[i];
         foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in soundDatabase.ReadAll())
         {
             SoundProfile value   = keyValuePair.Value;
             Int32        soundID = value.SoundID;
             if (this.playedEffectSet.Contains(soundID))
             {
                 ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_SetVolume(soundID, volume, 0);
                 SoundLib.Log("Set volume to soundID: " + soundID + " finished");
             }
             else
             {
                 SoundLib.Log("soundID: " + soundID + " not found");
             }
         }
     }
     this.playerVolume = volume;
 }
Exemplo n.º 4
0
    protected void UnloadResource(SoundDatabase soundDatabase)
    {
        Dictionary <Int32, SoundProfile> dictionary = soundDatabase.ReadAll();

        foreach (KeyValuePair <Int32, SoundProfile> keyValuePair in dictionary)
        {
            this.UnregisterBank(keyValuePair.Value);
        }
        soundDatabase.DeleteAll();
    }
Exemplo n.º 5
0
    private void UnloadAllSoundData(SoundDatabase soundDatabase)
    {
        Dictionary <Int32, SoundProfile> dictionary  = soundDatabase.ReadAll();
        Dictionary <Int32, SoundProfile> dictionary2 = new Dictionary <Int32, SoundProfile>();

        foreach (Int32 key in dictionary.Keys)
        {
            dictionary2.Add(key, dictionary[key]);
        }
        foreach (Int32 key2 in dictionary2.Keys)
        {
            SoundProfile soundProfile = dictionary2[key2];
            if (ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_IsExist(soundProfile.SoundID) == 0)
            {
                ISdLibAPIProxy.Instance.SdSoundSystem_SoundCtrl_Stop(soundProfile.SoundID, 0);
            }
            base.UnloadResource(soundProfile, soundDatabase);
        }
        if (soundDatabase.ReadAll().Count != 0)
        {
            SoundLib.LogError("soundDatabase: Count: " + soundDatabase.ReadAll().Count + " It should be 0");
        }
    }