void OnGUI() { // Create a GUI button to switch to SpaceScene1 if (GUI.Button(new Rect(10, 10, 180, 25), "Switch to Scene 1 (F1)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } // Create a GUI button to switch to SpaceScene2 if (GUI.Button(new Rect(10, 40, 180, 25), "Switch to Scene 2 (F2)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } // Switch Camera Follow mode SU_CameraFollow _cameraFollow = Camera.main.GetComponent <SU_CameraFollow>(); if (GUI.Button(new Rect(10, 70, 180, 25), "Camera " + _cameraFollow.followMode.ToString())) { if (_cameraFollow.followMode == SU_CameraFollow.FollowMode.CHASE) { // Set following spectator mode _cameraFollow.followMode = SU_CameraFollow.FollowMode.SPECTATOR; } else { // Set chase view mode _cameraFollow.followMode = SU_CameraFollow.FollowMode.CHASE; } } // Handle Space Particles on/off _spaceParticles = GUI.Toggle(new Rect(10, 100, 180, 25), _spaceParticles, "Space Particles"); if (_oldSpaceParticles != _spaceParticles) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceParticles.gameObject, _spaceParticles); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceParticles = _spaceParticles; } // Handle Space Fog on/off _spaceFog = GUI.Toggle(new Rect(10, 130, 180, 25), _spaceFog, "Space Fog"); if (_oldSpaceFog != _spaceFog) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceFog.gameObject, _spaceFog); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceFog = _spaceFog; } // Handle Asteroids on/off - when the asteroid object is disabled, it will detect this and disable any active asteroids in the scene _spaceAsteroids = GUI.Toggle(new Rect(10, 160, 180, 25), _spaceAsteroids, "Space Asteroids"); if (_oldSpaceAsteroids != _spaceAsteroids) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceAsteroids.gameObject, _spaceAsteroids); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceAsteroids = _spaceAsteroids; } }
// Token: 0x060044BB RID: 17595 RVA: 0x0016FE5C File Offset: 0x0016E25C public static void Switch(string _sceneName) { for (int i = 0; i < SU_SpaceSceneSwitcher.staticSpaceScenes.Count; i++) { GameObject gameObject = SU_SpaceSceneSwitcher.staticSpaceScenes[i]; if (gameObject != null && gameObject.name == _sceneName) { if (SU_SpaceSceneSwitcher.staticMode != SU_SpaceSceneSwitcher.Mode.LOAD_ALL_AT_STARTUP) { UnityEngine.Object.Destroy(SU_SpaceSceneSwitcher.currentSpaceScene); SU_SpaceSceneSwitcher.currentSpaceScene = (GameObject)AssetManagement.Instantiate(gameObject, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f)); return; } if (SU_SpaceSceneSwitcher.hSpaceScenes[_sceneName] != null) { bool flag = false; IDictionaryEnumerator enumerator = SU_SpaceSceneSwitcher.hSpaceScenes.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; if (dictionaryEntry.Key.ToString() == _sceneName) { SU_SpaceSceneSwitcher.SetActive((GameObject)dictionaryEntry.Value, true); flag = true; } else { SU_SpaceSceneSwitcher.SetActive((GameObject)dictionaryEntry.Value, false); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } if (flag) { return; } } } } Debug.LogWarning("Tried to switch to a space scene named " + _sceneName + " but the scene was not found. Ensure that you configured the array on the SpaceSceneSwitcher prefab correctly and that you typed the name of the space scene prefab correctly (case sensitive) for the Switch function call"); }
// Token: 0x060044CF RID: 17615 RVA: 0x001704E4 File Offset: 0x0016E8E4 private void OnGUI() { if (GUI.Button(new Rect(10f, 10f, 180f, 25f), "Switch to Scene 1 (F1)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } if (GUI.Button(new Rect(10f, 40f, 180f, 25f), "Switch to Scene 2 (F2)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } SU_CameraFollow component = Camera.main.GetComponent <SU_CameraFollow>(); if (GUI.Button(new Rect(10f, 70f, 180f, 25f), "Camera " + component.followMode.ToString())) { if (component.followMode == SU_CameraFollow.FollowMode.CHASE) { component.followMode = SU_CameraFollow.FollowMode.SPECTATOR; } else { component.followMode = SU_CameraFollow.FollowMode.CHASE; } } this._spaceParticles = GUI.Toggle(new Rect(10f, 100f, 180f, 25f), this._spaceParticles, "Space Particles"); if (this._oldSpaceParticles != this._spaceParticles) { SU_SpaceSceneSwitcher.SetActive(this.spaceParticles.gameObject, this._spaceParticles); this._oldSpaceParticles = this._spaceParticles; } this._spaceFog = GUI.Toggle(new Rect(10f, 130f, 180f, 25f), this._spaceFog, "Space Fog"); if (this._oldSpaceFog != this._spaceFog) { SU_SpaceSceneSwitcher.SetActive(this.spaceFog.gameObject, this._spaceFog); this._oldSpaceFog = this._spaceFog; } this._spaceAsteroids = GUI.Toggle(new Rect(10f, 160f, 180f, 25f), this._spaceAsteroids, "Space Asteroids"); if (this._oldSpaceAsteroids != this._spaceAsteroids) { SU_SpaceSceneSwitcher.SetActive(this.spaceAsteroids.gameObject, this._spaceAsteroids); this._oldSpaceAsteroids = this._spaceAsteroids; } }
// Token: 0x060044B9 RID: 17593 RVA: 0x0016FD00 File Offset: 0x0016E100 private void Start() { SU_SpaceSceneSwitcher.staticMode = this.mode; if (this.spaceScenes.Length > 0) { if (SU_SpaceSceneSwitcher.staticSpaceScenes.Count == 0) { for (int i = 0; i < this.spaceScenes.Length; i++) { SU_SpaceSceneSwitcher.staticSpaceScenes.Add(this.spaceScenes[i]); } } } else { Debug.LogError("No Space Scene Prefabs configured for the Space Scene array. Populate array in the inspector with Space Scene prefabs from the Project window. Note! You have to create Prefabs(!) of the space scenes - you cannot assign Unity Scenes to the array."); } if (SU_SpaceSceneSwitcher.staticMode == SU_SpaceSceneSwitcher.Mode.LOAD_ALL_AT_STARTUP) { SU_SpaceSceneSwitcher.hSpaceScenes.Clear(); foreach (GameObject gameObject in this.spaceScenes) { GameObject gameObject2 = (GameObject)AssetManagement.Instantiate(gameObject, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f)); SU_SpaceSceneSwitcher.hSpaceScenes.Add(gameObject.name, gameObject2); SU_SpaceSceneSwitcher.SetActive(gameObject2, false); } } if (this.sceneIndexLoadFirst >= this.spaceScenes.Length) { Debug.LogWarning("Scene Index Load First value is greater than the number of Space Scene prefabs in the array. Loading scene with index 0 instead."); this.sceneIndexLoadFirst = 0; SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst); } else { SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst); } }