Example #1
0
        public void Save()
        {
            _path = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.SAVE_FILE);
            List <string[]> saves;

            if (File.Exists(_path))
            {
                string result = File.ReadAllText(_path);
                saves = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string[]> >(result);
                LoadGameButton.interactable = saves.Count > 0;
            }
            else
            {
                saves = new List <string[]>();
            }

            if (AmbitionApp.Game.SaveSlotID >= 0)
            {
                AmbitionApp.OpenDialog(DialogConsts.SAVE_GAME);
            }
            else if (saves.Count < AmbitionApp.Game.MaxSaves)
            {
                AmbitionApp.CloseDialog(DialogConsts.GAME_MENU);
                AmbitionApp.OpenDialog(DialogConsts.SAVE_NEW);
                AmbitionApp.SendMessage(GameMessages.SAVE_GAME);
            }
            else
            {
                AmbitionApp.OpenDialog("game_menu.saves.modal.too_many_saves", null, null);
            }
        }
Example #2
0
        IEnumerator SaveGameDelay()
        {
            CancelBtn.interactable    = false;
            OverwriteBtn.interactable = false;
            CreateBtn.interactable    = false;
            StatusTxt.text            = AmbitionApp.Localize("game_menu.saving");
            StatusTxt.enabled         = true;
            AmbitionApp.SendMessage(GameMessages.SAVE_GAME);
            yield return(new WaitForSeconds(1f));

            Close();
            AmbitionApp.CloseDialog(DialogConsts.GAME_MENU);
        }
Example #3
0
 public override void OnEnterState()
 {
     UnityEngine.Debug.Log("Close Dialog State - Entered!");
     AmbitionApp.CloseDialog(_dialogID);
 }