public void StartTouchEmpty(Vector2 posWorld, int fingerId) { MyTouchStartHook myTouchStartHook = new MyTouchStartHook(); myTouchStartHook = MyHookSystem.executeHook <MyTouchStartHook>(myTouchStartHook); if (myTouchStartHook.isCanceled()) { return; } Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene != Ref.SceneType.Game) { } } else { Build.main.OnTouchStart(fingerId, posWorld); } } }
public void DeleteSelectedQuicksave() { if (this.selectedSaveId == -1) { return; } Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { UnityEngine.Object.Destroy(this.saveFilesIcons[this.selectedSaveId].gameObject); this.saveFilesIcons.RemoveAt(this.selectedSaveId); GameSaving.Quicksaves.RemoveQuicksaveAt(this.selectedSaveId); this.iconsAnimation = this.MoveSaveFilesIcons(); base.StartCoroutine(this.iconsAnimation); } } else { UnityEngine.Object.Destroy(this.saveFilesIcons[this.selectedSaveId].gameObject); this.saveFilesIcons.RemoveAt(this.selectedSaveId); Build.BuildQuicksaves.RemoveQuicksaveAt(this.selectedSaveId); this.iconsAnimation = this.MoveSaveFilesIcons(); base.StartCoroutine(this.iconsAnimation); } this.selectedSaveId = -1; }
private void Start() { this.SetFps(); this.SetEnableMusic(); this.SetEnableSound(); Screen.sleepTimeout = -1; Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { Screen.orientation = ((!Saving.LoadSetting(Saving.SettingKey.disableAutoRotate)) ? ScreenOrientation.AutoRotation : ScreenOrientation.Portrait); if (Ref.lastScene == Ref.SceneType.Build) { this.instructionToggleThrottleHolder.SetActive(true); if (!Saving.LoadSetting(Saving.SettingKey.seenGameInstructions)) { this.instructionsPartsHolder.SetActive(true); this.instructionSlideThrottleHolder.SetActive(true); } } } } else { Screen.orientation = ScreenOrientation.Portrait; } } else { Screen.orientation = ScreenOrientation.Portrait; } }
public void StartSaveProcess() { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { if (Ref.mainVessel == null) { Ref.controller.ShowMsg("Cannot save while not controlling a rocket"); return; } Time.timeScale = 0f; if (Ref.inputController.menuHolder.activeSelf) { Ref.inputController.ToggleDropdownMenu(); } } } else if (!Build.main.buildGrid.HasAnyParts()) { return; } this.savingMenuHolder.SetActive(true); this.keyboardText.text = string.Empty; this.keyboardHolder.SetActive(true); this.keyboard = TouchScreenKeyboard.Open(string.Empty, TouchScreenKeyboardType.Default); this.keyboard.active = true; }
public void CompleteLoadProcess() { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { GameSaving.Quicksaves quicksaves = GameSaving.Quicksaves.LoadQuicksaves(); if (this.selectedSaveId != -1 && this.selectedSaveId < quicksaves.QuicksavesCount) { GameSaving.LoadGame(quicksaves.quicksaves[this.selectedSaveId]); MsgController.ShowMsg("Game Loaded"); this.CloseMenus(); } } } else { Build.BuildQuicksaves buildQuicksaves = Build.BuildQuicksaves.LoadBuildQuicksaves(); if (this.selectedSaveId != -1 && this.selectedSaveId < buildQuicksaves.QuicksavesCount) { Build.main.LoadSave(buildQuicksaves.buildSaves[this.selectedSaveId]); this.CloseMenus(); } } }
public static void LoadScene(Ref.SceneType sceneToLoad) { MySceneChangeHook mySceneChangeHook = MyHookSystem.executeHook <MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad)); bool flag = mySceneChangeHook.isCanceled(); if (!flag) { sceneToLoad = mySceneChangeHook.newScene; Ref.SceneType current = Ref.lastScene; Ref.lastScene = Ref.currentScene; SceneManager.LoadScene(sceneToLoad.ToString(), LoadSceneMode.Single); MyHookSystem.executeHook <MySceneChangedHook>(new MySceneChangedHook(current, sceneToLoad)); } }
public static void LoadScene(Ref.SceneType sceneToLoad) { MySceneChangeHook res = MyHookSystem.executeHook <MySceneChangeHook>(new MySceneChangeHook(Ref.lastScene, sceneToLoad)); if (res.isCanceled()) { return; } sceneToLoad = res.newScene; Ref.SceneType oldScene = Ref.lastScene; Ref.lastScene = Ref.currentScene; SceneManager.LoadScene(sceneToLoad.ToString(), LoadSceneMode.Single); MyHookSystem.executeHook <MySceneChangedHook>(new MySceneChangedHook(oldScene, sceneToLoad)); }
public void StartTouchEmpty(Vector2 posWorld, int fingerId) { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene != Ref.SceneType.Game) { } } else { Build.main.OnTouchStart(fingerId, posWorld); } } }
public void TouchStayEmpty(Vector2 posWorld, Vector2 deltaPixel, int fingerId) { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene != Ref.SceneType.Game) { } } else { Build.main.OnTouchStay(fingerId, posWorld, deltaPixel); } } }
public void StartSaveProcess() { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { if (Ref.mainVessel == null) { MsgController.ShowMsg("Cannot save while not controlling a rocket"); return; } } } else if (!Build.main.buildGrid.HasAnyParts()) { return; } this.onOpenSaveMenu.InvokeEvenets(); }
private void ClickEmpty(Vector2 clickPosWorld) { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { if (Ref.mapView) { Ref.map.OnClickEmpty(clickPosWorld); } else if (Ref.mainVessel != null) { this.PointCastParts(clickPosWorld); } } } } }
public void CloseMenus() { Time.timeScale = 1f; this.savingMenuHolder.SetActive(false); this.loadingMenuHolder.SetActive(false); while (this.saveFilesIcons.Count > 0) { UnityEngine.Object.Destroy(this.saveFilesIcons[0].gameObject); this.saveFilesIcons.RemoveAt(0); } Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { Ref.inputController.leftArrow.parent.gameObject.SetActive(true); Ref.controller.fuelIconsHolder.gameObject.SetActive(true); } } this.UpdateLoadButtonColor(); }
public void EndTouchEmpty(Vector2 posWorld, int fingerId, bool click) { Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.MainMenu) { if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { if (click) { this.ClickEmpty(posWorld); } } } else { Build.main.OnTouchEnd(fingerId, posWorld); } } }
public void CompleteSaveProcess() { string text = TouchKeyboard.main.GetText("Unnamed Save"); Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { GameSaving.Quicksaves.AddQuicksave(GameSaving.GetGameSaveData(text)); MsgController.ShowMsg("Game Saved"); } } else { Build.BuildQuicksaves.AddQuicksave(new Build.BuildSave(text, Camera.main.transform.position, Build.main.buildGrid.parts, 0)); MsgController.ShowMsg("Design Saved"); } this.onCloseSaveMenu.InvokeEvenets(); this.CloseMenus(); this.UpdateLoadButtonColor(); }
private void Awake() { r = this; Ref.cam = this.Camera; Ref.inputController = this.InputController; Ref.saving = this.Saving; Ref.warning = this.Warning; Ref.currentScene = this.CurrentScene; Ref.lastScene = this.LastScene; Ref.controller = this.Controller; Ref.planetManager = this.PlanetManager; Ref.map = this.Map; Ref.solarSystemRoot = this.SolarSystemRoot; Ref.partShader = this.PartShader; if (Ref.myModLoader == null) { Ref.myModLoader = new ModLoader(); Ref.myModLoader.startLoadProcedure(); } this.enabled = true; this.gameObject.SetActive(true); }
public void CloseMenus() { Time.timeScale = 1f; this.savingMenuHolder.SetActive(false); this.loadingMenuHolder.SetActive(false); while (this.saveFilesIcons.Count > 0) { UnityEngine.Object.Destroy(this.saveFilesIcons[0].gameObject); this.saveFilesIcons.RemoveAt(0); } if (this.keyboard != null) { this.keyboard.active = false; } this.keyboardHolder.SetActive(false); this.keyboard = null; Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { Ref.inputController.leftArrow.parent.gameObject.SetActive(true); foreach (EngineModule.FuelIcon current in Ref.controller.fuelIcons) { if (current.icon != null) { current.icon.gameObject.SetActive(true); } } } } else { Build.main.EnableDescription(); } this.UpdateLoadButtonColor(); }
public void CompleteSaveProcess() { string text = this.keyboardText.text.Replace("|", string.Empty); if (text == string.Empty) { text = "Unnamed Save"; } Ref.SceneType currentScene = Ref.currentScene; if (currentScene != Ref.SceneType.Build) { if (currentScene == Ref.SceneType.Game) { GameSaving.Quicksaves.AddQuicksave(GameSaving.GetGameSaveData(text)); Ref.controller.ShowMsg("Game Saved"); } } else { Build.BuildQuicksaves.AddQuicksave(new Build.BuildSave(text, Camera.main.transform.position, Build.main.buildGrid.parts)); } this.CloseMenus(); this.UpdateLoadButtonColor(); }
public MySceneChangedHook(Ref.SceneType current, Ref.SceneType target) { this.oldScene = current; this.newScene = target; }
public MyGeneralOnGuiHook(Ref.SceneType targetScene) { this.scene = targetScene; }
/// <summary> /// This hook is being executed on MyGameManager use ModLoader.manager as listener /// </summary> /// <param name="old"></param> /// <param name="tgt"></param> public MySceneChangedHook(Ref.SceneType old, Ref.SceneType tgt) { this.oldScene = old; this.targetScene = tgt; }
public MyOnGuiHook(Ref.SceneType scene) { this.currentScene = scene; }
public MySceneChangedHook(Ref.SceneType old, Ref.SceneType nw) { this.oldScene = old; this.newScene = nw; }