private void GameResultSave() { string path = $"{Application.persistentDataPath}\\saveData.json"; Data data = null; if (File.Exists(path)) { data = sal.LoadData(path); } if (!File.Exists(path) || data == null || data.Type == null || data.Amount == null) { data = new Data(); } if (GameManager.GameClear) { //記録 data.Time.Clear(); data.Name.Clear(); for (int i = 0; i < (score.Count < saveListAmount ? score.Count : saveListAmount); ++i) { data.Time.Add(score[i].time); data.Name.Add(score[i].name); } } //取得した魚の記録 if (!File.Exists(path) || data == null || data.Type == null || data.Amount == null) { List <int> newEatAmount = new List <int>(); for (int i = 0; i < GameManager.GetEatFishTypes.Count; ++i) { newEatAmount.Add(GameManager.GetEatFishes[GameManager.GetEatFishTypes[i]]); } data.Type.AddRange(GameManager.GetEatFishTypes.ToArray()); data.Amount.AddRange(newEatAmount.ToArray()); sal.SaveData(data, path); } else { for (int i = 0; i < GameManager.GetEatFishTypes.Count; ++i) { int num = data.Type.IndexOf(GameManager.GetEatFishTypes[i]); if (num != -1) { data.Amount[num] += GameManager.GetEatFishes[GameManager.GetEatFishTypes[i]]; } else { data.Type.Add(GameManager.GetEatFishTypes[i]); data.Amount.Add(GameManager.GetEatFishes[GameManager.GetEatFishTypes[i]]); } } sal.SaveData(data, path); } }
IEnumerator GameOverEnumerator(Vector2 cameraPos, float[] damageTaken, bool isQuit) { if (!isQuit) { Time.timeScale = 0.25f; for (float i = 0; i < (float)3 / 4; i += Time.deltaTime) { if (oneMoreChance) { break; } yield return(null); } } if (oneMoreChance) { oneMoreChance = false; } else { Time.timeScale = 1; cameraCont.GameOver(); starReward = (int)killSum / 5 + (int)currentGameTime / 6; gameOver = true; challengeCont.GameOver(isQuit); StartCoroutine(spawnCont.GameOver(isQuit)); healthAbilityOn = false; int recordValue = (data.highScoreTime < currentGameTime ? 1 : 0) + (data.highScoreKill < killSum ? 2 : 0); dataCont.SetData((int)currentGameTime, killSum, currentEnemiesKilled, damageTaken, recordValue); SaveCurrentGameData(damageTaken, isQuit); yield return(new WaitForSeconds(0.5f)); //TO avoid lag SaveAndLoad.SaveData(data); } }
/// <summary> /// Json設定情報を<see cref="_settingModel"/>に読み込みます。その後通知状態を変化させます。 /// </summary> public void Load() { Debug.WriteLine("Jsonロード(´・ω・`)"); try { var data = SaveAndLoad.LoadData(SaveFileName); Debug.WriteLine("InputJsonData = " + data); _settingModel = JsonConvert.DeserializeObject <SettingModel>(data); this.StartUp = _settingModel.StartUp; //this.FontSizeIndex = _intToSize.First(x => string.Equals(x.Value, _settingModel.Font, StringComparison.CurrentCultureIgnoreCase)).Key; } catch { Debug.WriteLine("Json作るよー(´・ω・`)"); var data = JsonConvert.SerializeObject(new SettingModel(false, "Medium")); SaveAndLoad.SaveData(SaveFileName, data); Load(); } // StartUpの値によって通知を変化 if (StartUp) { SettingOn(); } else { SettingOff(); } }
/// <summary> /// <see cref="_settingModel"/>の設定情報をJson変換し保存します。 /// </summary> public void Save() { var data = JsonConvert.SerializeObject(_settingModel); Debug.WriteLine("OutputJsonData = " + data); SaveAndLoad.SaveData(SaveFileName, data); }
// Use this for initialization public void saveButton() { playerDataType p = new playerDataType(); string _playerName = InputData.text; p.name = _playerName; SL.SaveData(p); }
public void Mute(bool isMusic) { audioCont.Mute(isMusic); if (isMusic) { data.isMusicMuted = !data.isMusicMuted; } else { data.isSoundMuted = !data.isSoundMuted; } SaveAndLoad.SaveData(data); }
public void SaveChallenges(Challenge[] challenges, int completedChallenge, List <int> easyChallenges, List <int> meduiumChallenges, List <int> hardChallenges, bool withAd) { if (completedChallenge != -1) { if (!withAd) { data.completedChallengesSum++; } data.challenges[completedChallenge] = challenges[completedChallenge]; SaveAndLoad.SaveData(data); } else { data.remainingEasyChallenges = easyChallenges; data.remainingMediumChallenges = meduiumChallenges; data.remainingHardChallenges = hardChallenges; waitingNewChallenges = challenges; } }
public void SaveStars(int stars) { if (stars > data.stars) { data.totalStars += stars - data.stars; } data.stars = stars; data.exp += waitingExp; if (data.exp > maxExp) { data.exp = maxExp; } if (waitingNewChallenges != null) { data.challenges = waitingNewChallenges; } SaveAndLoad.SaveData(data); waitingNewChallenges = null; waitingExp = 0; challengeCont.ChallengesSaved(); }
public void LoadAndSaveDis() { maxDistance md = new maxDistance(); md = (maxDistance)LoadDis(); if (LoginUI.setting_diffcult.Equals("easy")) { if (int.Parse(md.easyDis) < distance) { md.easyDis = distance.ToString(); } } else { if (int.Parse(md.hardDis) < distance) { md.hardDis = distance.ToString(); } } SL.SaveData(md); }
public void BuyAbility(int abilityIndex) { data.ownedAbilities[abilityIndex] = 2; SaveAndLoad.SaveData(data); }
public void SetAbility(int newAbility) { data.activeAbility = newAbility; abilityCont.SetActiveAbility(data.activeAbility); SaveAndLoad.SaveData(data); }
public void ClickSave() // 저장 { Debug.Log("저장"); theSaveAndLoad.SaveData(); }
public void ClickSave() { Debug.Log("세이브"); theSaveAndLoad.SaveData(); }
public void ClickSave() { Debug.Log("Save"); theSaveAndLoad.SaveData(); isHomeButton = true; }