// private void autoSaveNurture() { Nurture.Calendar calendar = NurtureMode.Calendar; CustomPlayerPrefs.SetInt(PlayerPrefsKey.YEAR, calendar.Year); CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONTH, calendar.Month); Nurture.Character nurtureCharacter = NurtureMode.Character; int condition = (int)nurtureCharacter.Condition; CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONDITION, condition); int actionCount = Manager.Instance.DT.Action.Count; for (int id = 0; id < actionCount; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ACTION_COUNT, id); CustomPlayerPrefs.SetInt(key, nurtureCharacter.GetActionCount(id)); } CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONEY, nurtureCharacter.Money); CustomPlayerPrefs.SetInt(PlayerPrefsKey.STRESS, nurtureCharacter.Stress); CustomPlayerPrefs.SetInt(PlayerPrefsKey.STAMINA, nurtureCharacter.Stamina); CustomPlayerPrefs.SetInt(PlayerPrefsKey.INTELLECT, nurtureCharacter.Intellect); CustomPlayerPrefs.SetInt(PlayerPrefsKey.GRACE, nurtureCharacter.Grace); CustomPlayerPrefs.SetInt(PlayerPrefsKey.CHARM, nurtureCharacter.Charm); CustomPlayerPrefs.SetInt(PlayerPrefsKey.ATTACK, nurtureCharacter.Attack); CustomPlayerPrefs.SetInt(PlayerPrefsKey.DEFENSE, nurtureCharacter.Defense); CustomPlayerPrefs.SetInt(PlayerPrefsKey.LEADERSHIP, nurtureCharacter.Leadership); CustomPlayerPrefs.SetInt(PlayerPrefsKey.TACTIC, nurtureCharacter.Tactic); CustomPlayerPrefs.SetInt(PlayerPrefsKey.MORALITY, nurtureCharacter.Morality); CustomPlayerPrefs.SetInt(PlayerPrefsKey.GOODNESS, nurtureCharacter.Goodness); CustomPlayerPrefs.SetInt(PlayerPrefsKey.SENSIBILITY, nurtureCharacter.Sensibility); CustomPlayerPrefs.SetInt(PlayerPrefsKey.ARTS, nurtureCharacter.Arts); }
private int initPicture() { int createdButtonCount = 0; PictureObject pictureTable = LobbyManager.Instance.DT.Picture; int count = pictureTable.Count; for (int id = 0; id < count; ++id) { if (AlbumId != pictureTable[id].albumId) { continue; } string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_PICTURE, id); int value = CustomPlayerPrefs.GetInt(key, PlayerPrefsKey.TRUE_INTEGER); bool isLocked = PlayerPrefsKey.GetIntToBool(value); CGThumbnailButton btn = create(); btn.Set(pictureTable[id].sprite, AlbumType, isLocked); ++createdButtonCount; } return(createdButtonCount); }
public override bool Play() { Log.Debug(ToString()); Mode.CmdPictureEvent.Invoke(Id); string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_PICTURE, Id); int value = PlayerPrefsKey.GetBoolToInt(false); CustomPlayerPrefs.SetInt(key, value); return(false); // no more child to play }
protected override void first() { string prefixKey = null; if (_mode.Character.IsChildHood()) prefixKey = PlayerPrefsKey.ISLOCKED_VACATION_CHILD; else prefixKey = PlayerPrefsKey.ISLOCKED_VACATION_ADULT; string key = PlayerPrefsKey.GetKey(prefixKey, _seasonId); int value = PlayerPrefsKey.GetBoolToInt(false); CustomPlayerPrefs.SetInt(key, value); _mode.Schedule.ActionFirstEvent.Invoke(); }
private void onNurtureEndingScenarioEnd() { Log.Debug("onNurtureEndingScenarioEnd"); StoryMode.ScenarioEndEvent.Detach(onNurtureEndingScenarioEnd); string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_NURTURE_ENDING, _nurtureEndingId); int value = PlayerPrefsKey.GetBoolToInt(false); CustomPlayerPrefs.SetInt(key, value); if (Def.NURTURE_BAD_ENDING_ID == _nurtureEndingId) { Manager.Instance.End(); return; } _nurtureEndingId = -1; EndNurtureEvent.Invoke(); }
private int initNurtureEnding() { int createdButtonCount = 0; NurtureEndingObject nurtureEndingTable = LobbyManager.Instance.DT.NurtureEnding; int count = nurtureEndingTable.Count; for (int id = 0; id < count; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_NURTURE_ENDING, id); int value = CustomPlayerPrefs.GetInt(key, PlayerPrefsKey.TRUE_INTEGER); bool isLocked = PlayerPrefsKey.GetIntToBool(value); CGThumbnailButton btn = create(); btn.Set(nurtureEndingTable[id].image, AlbumType, isLocked); ++createdButtonCount; } return(createdButtonCount); }
private int initVacation() { int createdButtonCount = 0; VacationObject vacationTable = LobbyManager.Instance.DT.Vacation; int count = vacationTable.Count; // child for (int id = 0; id < count; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_VACATION_CHILD, id); int value = CustomPlayerPrefs.GetInt(key, PlayerPrefsKey.TRUE_INTEGER); bool isLocked = PlayerPrefsKey.GetIntToBool(value); CGThumbnailButton btn = create(); btn.Set(vacationTable[id].childHood, AlbumType, isLocked); ++createdButtonCount; } // adult for (int id = 0; id < count; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_VACATION_ADULT, id); int value = CustomPlayerPrefs.GetInt(key, PlayerPrefsKey.TRUE_INTEGER); bool isLocked = PlayerPrefsKey.GetIntToBool(value); CGThumbnailButton btn = create(); btn.Set(vacationTable[id].adultHood, AlbumType, isLocked); ++createdButtonCount; } return(createdButtonCount); }
private void initialize() { SetContinueData(PlayerInitProperty.Name); int constitutionId = (int)PlayerInitProperty.Constitution; int zodiacId = (int)PlayerInitProperty.Zodiac; int condition = (int)Nurture.ECondition.Healthy; CustomPlayerPrefs.SetInt(PlayerPrefsKey.YEAR, Def.INIT_YEAR); CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONTH, Def.INIT_MONTH); CustomPlayerPrefs.SetInt(PlayerPrefsKey.ZODIAC, zodiacId); CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONDITION, condition); int actionCount = DT.Action.Count; for (int id = 0; id < actionCount; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ACTION_COUNT, id); CustomPlayerPrefs.SetInt(key, 0); } CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONEY, Def.INIT_MONEY); CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONSTITUTION, constitutionId); CustomPlayerPrefs.SetInt(PlayerPrefsKey.WEARING_COSTUME, Def.DEFAULT_COSTUME_ID); int costumeCount = DT.MainCharacterCostume.Count; for (int id = 0; id < costumeCount; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISBUY_COSTUME, id); bool isBuy = false; if (Def.DEFAULT_COSTUME_ID == id) { isBuy = true; } int isBuyInteger = PlayerPrefsKey.GetBoolToInt(isBuy); CustomPlayerPrefs.SetInt(key, isBuyInteger); } CustomPlayerPrefs.SetInt(PlayerPrefsKey.STRESS, Def.MIN_STAT); Zodiac zodiac = DT.Zodiac[zodiacId]; CustomPlayerPrefs.SetInt(PlayerPrefsKey.STAMINA, zodiac.stamina); CustomPlayerPrefs.SetInt(PlayerPrefsKey.INTELLECT, zodiac.intellect); CustomPlayerPrefs.SetInt(PlayerPrefsKey.GRACE, zodiac.grace); CustomPlayerPrefs.SetInt(PlayerPrefsKey.CHARM, zodiac.charm); CustomPlayerPrefs.SetInt(PlayerPrefsKey.ATTACK, zodiac.attack); CustomPlayerPrefs.SetInt(PlayerPrefsKey.DEFENSE, zodiac.defense); CustomPlayerPrefs.SetInt(PlayerPrefsKey.LEADERSHIP, zodiac.leadership); CustomPlayerPrefs.SetInt(PlayerPrefsKey.TACTIC, zodiac.tactic); CustomPlayerPrefs.SetInt(PlayerPrefsKey.MORALITY, zodiac.morality); CustomPlayerPrefs.SetInt(PlayerPrefsKey.GOODNESS, zodiac.goodness); CustomPlayerPrefs.SetInt(PlayerPrefsKey.SENSIBILITY, zodiac.sensibility); CustomPlayerPrefs.SetInt(PlayerPrefsKey.ARTS, zodiac.arts); CustomPlayerPrefs.SetInt(PlayerPrefsKey.TARGET, -1); CustomPlayerPrefs.SetInt(PlayerPrefsKey.FEELING, Def.MIN_FEELING); CustomPlayerPrefs.SetInt(PlayerPrefsKey.LAST_OPENED_SCENARIO_NO, Def.MIN_SCENARIO - 1); }
private MainCharacter loadMainCharacter(Nurture.Calendar calendar) { if (null == calendar) { Log.Error("not found calendar"); return(null); } string name = CustomPlayerPrefs.GetString(PlayerPrefsKey.NAME, null); if (null == name) { Log.Error(string.Format("not found Player's '{0}'", PlayerPrefsKey.NAME)); return(null); } int zodiac = CustomPlayerPrefs.GetInt(PlayerPrefsKey.ZODIAC, -1); if (false == Enum.IsDefined(typeof(EZodiac), zodiac)) { Log.Error(string.Format("not found '{0}'", PlayerPrefsKey.ZODIAC)); return(null); } int age = Def.INIT_AGE + (calendar.Year - Def.INIT_YEAR); int condition = CustomPlayerPrefs.GetInt(PlayerPrefsKey.CONDITION, -1); if (false == Enum.IsDefined(typeof(Nurture.ECondition), condition)) { Log.Error(string.Format("not found '{0}'", PlayerPrefsKey.CONDITION)); return(null); } int[] actionCount = new int[Manager.Instance.DT.Action.Count]; int numAction = actionCount.Length; for (int id = 0; id < numAction; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ACTION_COUNT, id); int value = CustomPlayerPrefs.GetInt(key, -1); if (value < 0) { Log.Error(string.Format("not found '{0}'", key)); return(null); } actionCount[id] = value; } int constitution = CustomPlayerPrefs.GetInt(PlayerPrefsKey.CONSTITUTION, -1); if (false == Enum.IsDefined(typeof(EConstitution), constitution)) { Log.Error(string.Format("not found '{0}'", PlayerPrefsKey.CONSTITUTION)); return(null); } int money = CustomPlayerPrefs.GetInt(PlayerPrefsKey.MONEY, -1); if (money < Def.MIN_MONEY) { Log.Error(string.Format("not found '{0}'", PlayerPrefsKey.MONEY)); return(null); } int wearingCostumeId = CustomPlayerPrefs.GetInt(PlayerPrefsKey.WEARING_COSTUME, -1); if (false == ExtMainCharacterCostume.IsValid(wearingCostumeId)) { Log.Error(string.Format("not found '{0}'", PlayerPrefsKey.WEARING_COSTUME)); return(null); } Wardrobe wardrobe = new Wardrobe(); int costumeCount = Manager.Instance.DT.MainCharacterCostume.Count; for (int id = 0; id < costumeCount; ++id) { string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISBUY_COSTUME, id); int value = CustomPlayerPrefs.GetInt(key, -1); if (-1 == value) { Log.Error(string.Format("not found '{0}'", key)); return(null); } bool isBuy = PlayerPrefsKey.GetIntToBool(value); CostumeController costume = new CostumeController(id, isBuy); wardrobe.CostumeList.Add(costume); } EZodiac z = (EZodiac)zodiac; Nurture.ECondition c = (Nurture.ECondition)condition; EConstitution cs = (EConstitution)constitution; MainCharacter mc = new MainCharacter(name, z, age, c, actionCount, cs, money, wardrobe, wearingCostumeId); return(mc); }