public void IncreaseBattleGoodFeel(int avatarId, int amount) { GalTouchInfoItem item = null; int num = 0; int count = this._galTouchInfoItems.Count; while (num < count) { if (this._galTouchInfoItems[num].avatarId == avatarId) { item = this._galTouchInfoItems[num]; break; } num++; } if (item != null) { amount = Mathf.Clamp(amount, -item.battleGoodFeel, this.GetTodayRemainGoodFeel()); int b = GalTouchData.QueryLevelUpFeelNeedBattle(item.heartLevel); int num4 = Mathf.Min(item.battleGoodFeel + amount, b); amount = num4 - item.battleGoodFeel; Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(item.avatarId, amount, 2); item.todayAddedFeel += amount; item.battleGoodFeel = num4; } }
private void TotalToHeartLevelAndGoodFeelBattle(int total, int level, out int feel) { total = (total >= 0) ? total : 0; for (int i = 1; i < level; i++) { total -= GalTouchData.QueryLevelUpFeelNeedBattle(i); } feel = (total >= 0) ? total : 0; }
private void HeartLevelAndGoodFeelToTotalBattle(int feel, int level, out int total) { int num = 0; level = Mathf.Clamp(level, 1, 5); for (int i = 2; i <= level; i++) { num += GalTouchData.QueryLevelUpFeelNeedBattle(i - 1); } if (level != 5) { num += feel; } total = num; }
public void IncreaseTouchGoodFeel(int amount) { if ((this._currentGalTouchInfo != null) && !this._waitingForResponse) { GoodFeelLimitType none = GoodFeelLimitType.None; bool flag = amount <= 0; amount = Mathf.Clamp(amount, -this._currentGalTouchInfo.touchGoodFeel, this.GetTodayRemainGoodFeel()); if (this._currentGalTouchInfo.heartLevel > 4) { if (this.GalTouchInfoChanged != null) { this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, GoodFeelLimitType.ReachMax); } } else { int num = GalTouchData.QueryLevelUpFeelNeedTouch(this._currentGalTouchInfo.heartLevel); int num2 = GalTouchData.QueryLevelUpFeelNeedBattle(this._currentGalTouchInfo.heartLevel); if ((this._currentGalTouchInfo.battleGoodFeel >= num2) && !this.IsLimitedByMission(this._currentGalTouchInfo)) { int total = 0; int feel = 0; int level = 1; this.HeartLevelAndGoodFeelToTotal(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, out total); int num6 = total + amount; this.TotalToHeartLevelAndGoodFeel(num6, out feel, out level); if (this._currentGalTouchInfo.heartLevel != level) { num6 = Mathf.Min(num6, this.GetLevelTotalTouchLimit(this._currentGalTouchInfo.heartLevel + 1)); this.TotalToHeartLevelAndGoodFeel(num6, out feel, out level); } this.HeartLevelAndGoodFeelToTotal(feel, level, out num6); this._currentGalTouchInfo.todayAddedFeel += num6 - total; if ((amount == 0) && (this.GetTodayRemainGoodFeel() == 0)) { none = GoodFeelLimitType.DialyGoodFeel; } if (this.GalTouchInfoChanged != null) { this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, feel, level, none); } if (level != this._currentGalTouchInfo.heartLevel) { this._currentGalTouchInfo.battleGoodFeel = 0; } this._currentGalTouchInfo.touchGoodFeel = feel - this._currentGalTouchInfo.battleGoodFeel; this._currentGalTouchInfo.heartLevel = level; Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(this._currentGalTouchInfo.avatarId, num6 - total, 1); this._waitingForResponse = true; } else { int num7 = Mathf.Clamp(this._currentGalTouchInfo.touchGoodFeel + amount, 0, num - 1); amount = num7 - this._currentGalTouchInfo.touchGoodFeel; if ((amount == 0) && !flag) { if (this.GetTodayRemainGoodFeel() == 0) { none = GoodFeelLimitType.DialyGoodFeel; } else if (this._currentGalTouchInfo.battleGoodFeel < num2) { none = GoodFeelLimitType.Battle; } else if (this.IsLimitedByMission(this._currentGalTouchInfo)) { none = GoodFeelLimitType.Mission; } } else { none = GoodFeelLimitType.None; } if (this.GalTouchInfoChanged != null) { this.GalTouchInfoChanged(this._currentGalTouchInfo.touchGoodFeel + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, num7 + this._currentGalTouchInfo.battleGoodFeel, this._currentGalTouchInfo.heartLevel, none); } Singleton <NetworkManager> .Instance.RequestGalAddGoodFeel(this._currentGalTouchInfo.avatarId, amount, 1); this._currentGalTouchInfo.todayAddedFeel += amount; this._waitingForResponse = true; this._currentGalTouchInfo.touchGoodFeel = num7; } } } }