Пример #1
0
    protected void LoadResource(String metaData, SoundDatabase soundDatabase, SoundPlayer.LoadResourceCallback callback)
    {
        if (this.resourceLoadingCounter > 0)
        {
            callback((SoundDatabase)null, true);
            return;
        }
        this.resourceLoadingCounter = 0;
        this.activeCallback         = callback;
        JSONNode  jsonnode = JSONNode.Parse(metaData);
        JSONArray asArray  = jsonnode["data"].AsArray;

        this.resourceLoadingCounter = asArray.Count;
        for (Int32 i = 0; i < asArray.Count; i++)
        {
            JSONClass        asObject = asArray[i].AsObject;
            String           text     = asObject["name"];
            Int32            asInt    = asObject["soundIndex"].AsInt;
            String           strA     = asObject["type"];
            SoundProfileType soundProfileType;
            if (String.Compare(strA, "SoundEffect") == 0)
            {
                soundProfileType = SoundProfileType.SoundEffect;
            }
            else if (String.Compare(strA, "Music") == 0)
            {
                soundProfileType = SoundProfileType.Music;
            }
            else if (String.Compare(strA, "MovieAudio") == 0)
            {
                soundProfileType = SoundProfileType.MovieAudio;
            }
            else if (String.Compare(strA, "Song") == 0)
            {
                soundProfileType = SoundProfileType.Song;
            }
            else
            {
                soundProfileType = SoundProfileType.Default;
            }
            SoundProfile soundProfile = new SoundProfile();
            soundProfile.Code             = asInt.ToString();
            soundProfile.Name             = text;
            soundProfile.SoundIndex       = asInt;
            soundProfile.ResourceID       = text;
            soundProfile.SoundProfileType = soundProfileType;
            SoundLoaderProxy.Instance.Load(soundProfile, new ISoundLoader.ResultCallback(this.RegisterBankAsCallback), soundDatabase);
        }
    }
Пример #2
0
 protected void LoadResource(SoundProfile soundProfile, SoundDatabase soundDatabase, SoundPlayer.LoadResourceCallback callback)
 {
     if (this.resourceLoadingCounter > 0)
     {
         callback((SoundDatabase)null, true);
         return;
     }
     this.resourceLoadingCounter = 1;
     this.activeCallback         = callback;
     SoundLoaderProxy.Instance.Load(soundProfile, new ISoundLoader.ResultCallback(this.RegisterBankAsCallback), soundDatabase);
 }