Esempio n. 1
0
    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);
            }
        }
    }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
     }
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 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();
         }
     }
 }
Esempio n. 6
0
    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));
        }
    }
Esempio n. 7
0
    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));
    }
Esempio n. 8
0
 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);
         }
     }
 }
Esempio n. 9
0
 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);
         }
     }
 }
Esempio n. 10
0
 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();
 }
Esempio n. 11
0
 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);
                 }
             }
         }
     }
 }
Esempio n. 12
0
 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();
 }
Esempio n. 13
0
 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);
         }
     }
 }
Esempio n. 14
0
    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();
    }
Esempio n. 15
0
 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);
 }
Esempio n. 16
0
 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();
 }
Esempio n. 17
0
    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;
 }
Esempio n. 19
0
 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;
 }
Esempio n. 21
0
 public MyOnGuiHook(Ref.SceneType scene)
 {
     this.currentScene = scene;
 }
Esempio n. 22
0
 public MySceneChangedHook(Ref.SceneType old, Ref.SceneType nw)
 {
     this.oldScene = old;
     this.newScene = nw;
 }