private void OnFinishLoading()
 {
     if (bytes != null)
     {
         if (audioSource == null)
         {
             audioSource = base.gameObject.AddComponent <AudioSource>();
         }
         if (audioController == null)
         {
             audioController = AudioController.Instance;
         }
         vorbisReader = new VorbisReader(new MemoryStream(bytes), closeStreamOnDispose: true);
         if (audioClip == null)
         {
             audioClip = AudioClip.Create("Audio Clip", 1000, vorbisReader.Channels, vorbisReader.SampleRate, _3D: false, stream: true);
         }
         audioSource.clip     = audioClip;
         audioSource.loop     = isLoop;
         audioSource.priority = audioController.GetPriorityByType(audioType);
         volume = audioController.GetVolumeByType(audioType) * subVolume;
         audioSource.Play();
         isLoop  = audioSource.loop;
         pages   = vorbisReader.Stats[0].TotalPages;
         isReady = true;
         if (onFinishLoad != null)
         {
             onFinishLoad();
         }
         onFinishLoad = null;
     }
 }
Exemple #2
0
 public void OnLoadCallback(OnFinishLoad callback)
 {
     if (isReady)
     {
         callback();
     }
     else
     {
         onFinishLoad = (OnFinishLoad)Delegate.Combine(onFinishLoad, callback);
     }
 }
Exemple #3
0
    public void ShowLoadScreen(float time, OnFinishLoad onFinish = null)
    {
        loadingUI.SetActive(true);

        LeanTween.delayedCall(time, () =>
        {
            loadingUI.SetActive(false);

            if (onFinish != null)
            {
                onFinish();
            }
        });
    }
Exemple #4
0
 private void OnFinishLoading()
 {
     if (audioSource == null)
     {
         audioSource = base.gameObject.AddComponent <AudioSource>();
     }
     if (audioController == null)
     {
         audioController = AudioController.Instance;
     }
     audioSource.clip     = audioClip;
     audioSource.loop     = isLoop;
     audioSource.priority = audioController.GetPriorityByType(audioType);
     volume = audioController.GetVolumeByType(audioType) * subVolume;
     audioSource.Play();
     isReady = true;
     if (onFinishLoad != null)
     {
         onFinishLoad();
     }
     onFinishLoad = null;
 }
 public MealDBRecipeSystem(MonoBehaviour host, Dictionary <string, Ingredient> ings, OnFinishLoad on) : base(host, ings)
 {
     onLoadFinished += on;
 }