コード例 #1
0
        public SaveDataJson GetLastSave()
        {
            SaveDataJson saveData = null;

            if (PlayerPrefs.HasKey(GlobalModule.GameData.PPKEY_SAVE))
            {
                string json = PlayerPrefs.GetString(GlobalModule.GameData.PPKEY_SAVE);
                saveData = JsonUtility.FromJson <SaveDataJson>(json);
            }
            return(saveData);
        }
コード例 #2
0
 public void StartGame()
 {
     sunController = Instantiate(Resources.Load <SunController>(SunModule.GameData.SUN_PREFAB_PATH));
     Debug.Log(GameData.LOAD_GAME);
     if (GameData.LOAD_GAME)
     {
         saveData = saveController.GetLastSave();
         CreateBots(true, 1);
         CreateMainPlanet(true);
         CreateBots(true, saveData.Bots.Length - 1);
         CreateGameUI(true);
     }
     else
     {
         CreateBots(false, 1);
         CreateMainPlanet(false);
         CreateBots(false, UnityEngine.Random.Range(GameData.MIN_BOTS, GameData.MAX_BOTS));
         CreateGameUI(false);
     }
     //CreateGameUI();
 }
コード例 #3
0
        public void SaveGame(SaveDataJson saveData)
        {
            string json = JsonUtility.ToJson(saveData);

            PlayerPrefs.SetString(GlobalModule.GameData.PPKEY_SAVE, json);
        }