private void CheckNewDay() { int currDay = DateUtil.ConvertToDay(DateTime.Today); if (dataManager.date != currDay) { dataManager.NewDay(currDay); interactiveCountManager.SetInteractive(InteractiveType.ScreenOn, 0); PushNewDayState(); } interactiveCountManager.AddInteractive(InteractiveType.ScreenOn, 1); }
public void LoadPlayerDatas() { int savedDailyGoal = getObject <int>("DailyGoal"); if (savedDailyGoal != 0) { dailyGoal = savedDailyGoal; } Debug.Log("<><PlayerData>Read_DailyGoal:" + dailyGoal.ToString()); playerData.starID = getObject <int>("StarID", PlayerData.defaultStar); this.missionConfig.SetStarID(playerData.starID); Debug.Log("<><PlayerData>Read_starID:" + playerData.starID.ToString()); playerData.sceneIndex = getObject <int>("SceneIndex", 1); Debug.Log("<><PlayerData>Read_sceneIndex:" + playerData.sceneIndex.ToString()); playerData.playerLevel = getObject <int>("PlayerLevel", 1); Debug.Log("<><PlayerData>Read_playerLevel:" + playerData.playerLevel.ToString()); playerData.playerExp = getObject <int>("PlayerExp"); Debug.Log("<><PlayerData>Read_playerExp:" + playerData.playerExp.ToString()); //读取所有星球饮水百分比 Dictionary <string, float> missionPercent = this.mJsonUtils.String2Json <Dictionary <string, float> >(getObject <string>("MissionPercent4DicNew")); if (missionPercent == null) {//先按照新的Key值读取不到数据,则需要做首次处理 this.missionPercent = 0; this.SaveMissionPercent(); } else {//否则,仅将数据记录到内存 playerData.playerMissionPercent = missionPercent; } Debug.Log("<><PlayerData>Read_playerMissionPercent:" + this.missionPercent); //读取所有星球关卡ID Dictionary <int, int> missionId = this.mJsonUtils.String2Json <Dictionary <int, int> >(getObject <string>("MissionId4Dic")); if (missionId == null) {//先按照新的Key值读取不到数据,则需要做首次处理 int oldValue = getObject <int>("MissionId", PlayerData.startMission); missionId = new Dictionary <int, int>(); missionId.Add(this.missionConfig.GetStarIDByMissionID(oldValue), oldValue); playerData.playerMissionId = missionId; this.SaveMissionId(); } else {//否则,仅将数据记录到内存 playerData.playerMissionId = missionId; } Debug.Log("<><PlayerData>Read_playerMissionId:" + (playerData.playerMissionId.ContainsKey(this.playerData.starID) ? playerData.playerMissionId[this.playerData.starID].ToString() : "None")); playerData.playerCrownCount = getObject <int>("CrownCount"); Debug.Log("<><PlayerData>Read_playerCrownCount:" + playerData.playerCrownCount.ToString()); _voicePercent = getObject <int>("SoundPercent", 67); playerTodayData.todayDrinkTimes = getObject <int>("DrinkTimes"); Debug.Log("<><PlayerData>Read_todayDrinkTimes:" + playerTodayData.todayDrinkTimes.ToString()); playerTodayData.todayDate = getObject <int>("Date"); Debug.Log("<><PlayerData>Read_todayDate:" + playerTodayData.todayDate.ToString()); int currDay = DateUtil.ConvertToDay(DateTime.Today); if (playerTodayData.todayDate == 0 || playerTodayData.todayDate != currDay) { NewDay(currDay); } else { currIntake = getObject <int>("Intake"); Debug.Log("<><PlayerData>Read_todayIntake:" + playerTodayData.todayIntake.ToString()); playerTodayData.todayCrownGotCount = getObject <int>("crownTodayGotCount"); Debug.Log("<><PlayerData>Read_todayCrownGotCount:" + playerTodayData.todayCrownGotCount.ToString()); } }