Exemple #1
0
 protected void Awake()
 {
     Object.DontDestroyOnLoad(base.gameObject);
     base.gameObject.name = "Bootstrap";
     BloxGlobal.Create(this.bloxGlobalPrefab);
     PropertiesManager.OnBootstrapAwake();
     if (!Bootstrap.StartedViaUnityPlayButton)
     {
         if (this.startupScenes.Count > 0 && this.startupScenes[0] > 0 && this.startupScenes[0] < SceneManager.sceneCountInBuildSettings)
         {
             SceneManager.LoadScene(this.startupScenes[0], LoadSceneMode.Single);
         }
         else if (SceneManager.sceneCountInBuildSettings > 1)
         {
             SceneManager.LoadScene(1, LoadSceneMode.Single);
         }
         else
         {
             Debug.LogError("There are no scenes for the Bootstrap to load. You need to add at least one game scene to the Build Settings List or via the Blox Game Systems Window.");
         }
     }
     else
     {
         List <int> list = new List <int>();
         for (int i = 0; i < SceneManager.sceneCount; i++)
         {
             list.Add(SceneManager.GetSceneAt(i).buildIndex);
         }
         for (int j = 0; j < this.autoloadScenes.Count; j++)
         {
             int num = this.autoloadScenes[j];
             if (!list.Contains(num) && num > 0 && num < SceneManager.sceneCountInBuildSettings)
             {
                 list.Add(num);
                 SceneManager.LoadScene(num, LoadSceneMode.Additive);
             }
         }
     }
 }