Advertisement
Pro_Unit

InitPersistantManager

Feb 11th, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3.  
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class InitPersistantManager : MonoBehaviour
  8. {
  9.  
  10.     public Slider LoadSlider;
  11.     public Text ErrorText;
  12.  
  13.     [SerializeField] int currentVersion = 1;
  14.     [SerializeField] GameObject repaetButton;
  15.  
  16.     public void Start ()
  17.     {
  18.          repaetButton.SetActive (false);
  19.         RemoteResouceManager.OnProgressNormalizedChange += (val) =>
  20.         {
  21.             LoadSlider.normalizedValue = val;
  22.         };
  23.  
  24.         RemoteResouceManager.LoadAll (() =>
  25.         {
  26.             Hide();
  27.         },
  28.             (error) =>
  29.             {
  30.                 ErrorText.text = error;
  31.                 bool ChacheIsLoaded = RemoteResouceManager.LoadInChache (currentVersion);
  32.                 if (ChacheIsLoaded)
  33.                 {
  34.                     Hide();
  35.                 }
  36.                 else
  37.                 {
  38.                     repaetButton.SetActive (true);
  39.                 }
  40.             });
  41.  
  42.         //PersistantManager.LoadVideoList(() =>
  43.         //{
  44.         //    PersistantManager.LoadAll();
  45.         //    gameObject.SetActive(false);
  46.         //});
  47.     }
  48.  
  49.     private void Hide()
  50.     {
  51.         gameObject.SetActive(false);
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement