コード例 #1
0
 public void OnClickConfirm()
 {
     UpdateValues();
     ConfigModule.Apply();
     ConfigState.Save();
     Modal.PushMessageModal("Applied settings changes!", "Changes Applied", null, OnConfirmed, true);
 }
コード例 #2
0
 public void OnClickConfirm()
 {
     UpdateValues();
     ConfigState.Save();
     ConfigModule.Apply();
     //MappedInput.SetMapper(ConfigState.Instance.InputMapper); //we need to do this manually unfortunately...
     Modal.PushMessageModal("Applied settings changes!", "Changes Applied", null, OnConfirmed, true);
 }
コード例 #3
0
        public void OnClickSave()
        {
            //Debug.Log("OnClickSave");

            //new save if saveName=null

            //otherwise save over old save

            if (!GameState.Instance.SaveLocked && !GameState.Instance.ManualSaveLocked)
            {
                string saveName = SaveNameField.text;
                string saveFileName;

                if (SelectedSaveName != null)
                {
                    //assume save name is already okay

                    saveName     = SelectedSaveName; //we know it already has a prefix
                    saveFileName = saveName + ".json";
                    string savePath = CoreParams.SavePath + Path.DirectorySeparatorChar + saveName + ".json";
                    if (File.Exists(savePath))
                    {
                        File.Delete(savePath); //this "works" but seems to be bugged- race condition?
                    }
                }
                else
                {
                    saveFileName = "m_" + SaveUtils.GetSafeName(saveName) + ".json";
                }

                if (!string.IsNullOrEmpty(saveName))
                {
                    try
                    {
                        SharedUtils.SaveGame(saveFileName, true, false);
                        Modal.PushMessageModal(Sub.Replace("SaveSuccessMessage", SubList), Sub.Replace("SaveSuccess", SubList), null, null);
                    }
                    catch (Exception e)
                    {
                        Debug.LogError($"Save failed! ({e.GetType().Name})");
                        Debug.LogException(e);
                        Modal.PushMessageModal(e.Message, Sub.Replace("SaveFail", SubList), null, null);
                    }
                    SignalPaint();
                }
                else
                {
                    Modal.PushMessageModal(Sub.Replace("SaveBadFilenameMessage", SubList), Sub.Replace("SaveFail", SubList), null, null);
                }
            }
            else
            {
                //can't save!

                Modal.PushMessageModal(Sub.Replace("SaveNotAllowedMessage", SubList), Sub.Replace("SaveNotAllowed", SubList), null, null);
            }
        }
コード例 #4
0
        public void OnClickContinue()
        {
            var save = SaveUtils.GetLastSave();

            if (save != null)
            {
                SharedUtils.LoadGame(save, false);
            }
            else
            {
                Modal.PushMessageModal(Sub.Replace("ContinueNoSaveMessage", "IGUI_SAVE"), Sub.Replace("ContinueNoSaveHeading", "IGUI_SAVE"), null, null);
            }
        }
コード例 #5
0
        public void OnClickSave()
        {
            Debug.Log("OnClickSave");

            //new save if saveName=null

            //otherwise save over old save

            if (!GameState.Instance.SaveLocked)
            {
                //TODO text entry modal
                string saveName = SaveNameField.text;
                string savePath;

                if (SelectedSave != null)
                {
                    saveName = SelectedSave; //TODO need to trim?
                    savePath = CoreParams.SavePath + @"\" + saveName + ".json";
                    if (File.Exists(savePath))
                    {
                        File.Delete(savePath);
                    }
                }
                else
                {
                    savePath = CoreParams.SavePath + @"\" + saveName + ".json";
                }

                if (!string.IsNullOrEmpty(saveName))
                {
                    BaseSceneController.Current.Commit();
                    GameState.SerializeToFile(savePath);
                    Modal.PushMessageModal("", "Saved Successfully", null, null);
                    SignalPaint();
                }
                else
                {
                    Modal.PushMessageModal("You need to enter a filename!", "Save Failed", null, null);
                }
            }
            else
            {
                //can't save!

                Modal.PushMessageModal("You cannot save here!", "Save Not Allowed", null, null);
            }
        }
コード例 #6
0
 public void OnClickSave()
 {
     if (!GameState.Instance.SaveLocked)
     {
         if (SavePanel.activeSelf)
         {
             HidePanels();
         }
         else
         {
             HidePanels();
             SavePanel.SetActive(true);
         }
     }
     else
     {
         Modal.PushMessageModal("You can't save here!", "Saving Disabled", null, null);
     }
 }
コード例 #7
0
        public void OnClickActualSave()
        {
            if (!GameState.Instance.SaveLocked)
            {
                if (!string.IsNullOrEmpty(SaveInputField.text))
                {
                    BaseSceneController.Current.Commit();
                    GameState.SerializeToFile(CoreParams.SavePath + @"\" + SaveInputField.text + ".json");
                    Modal.PushMessageModal("", "Saved Successfully", null, null);
                }
                else
                {
                    Modal.PushMessageModal("You need to enter a filename!", "Save Failed", null, null);
                }
            }
            else
            {
                //can't save!

                HidePanels();
            }
        }
コード例 #8
0
 static void TestMessageModal(string text, string heading, string tag)
 {
     Modal.PushMessageModal(text, heading, tag, TestMessageModalCallback);
 }