void fixTili() { float curTili = PlayerPrefs.GetFloat(UserData.KEY_TILI_NUM, 0.0f); if (curTili >= _maxTiliNum) { return; } int lastLeaveYear = PlayerPrefs.GetInt(UserData.KEY_LEAVE_YEAR); int lastLeaveDayInYear = PlayerPrefs.GetInt(UserData.KEY_LEAVE_DAYINYEAR); int lastLeaveSecInDay = PlayerPrefs.GetInt(UserData.KEY_LEAVE_SECINDAY); DateTime cur = _timeMgr.getOnlineTime(); int curYear = cur.Year; int curDayInYear = cur.DayOfYear; int curSenInDay = cur.Hour * 3600 + cur.Minute * 60 + cur.Second; if (lastLeaveYear != curYear) { PlayerPrefs.SetFloat(UserData.KEY_TILI_NUM, _maxTiliNum); } else if (curDayInYear - lastLeaveDayInYear > 1) { PlayerPrefs.SetFloat(UserData.KEY_TILI_NUM, _maxTiliNum); } else { int passsec = 0; if (curDayInYear - lastLeaveDayInYear == 1) { passsec = curSenInDay + 24 * 60 * 60 - lastLeaveSecInDay; } else { passsec = curSenInDay - lastLeaveSecInDay; } if (passsec <= 0) { passsec = 0; } curTili += (float)passsec * _recoverRate * _invokeRepeatDeltaTime; if (curTili >= _maxTiliNum) { curTili = _maxTiliNum; } PlayerPrefs.SetFloat(UserData.KEY_TILI_NUM, curTili); } }