public void TryAndGrantReward(RewardVO vo, RewardManager.SuccessCallback onSuccess, object cookie, bool checkCurrencyCapacity) { RewardabilityResult rewardabilityResult = RewardUtils.CanPlayerHandleReward(this.cp, vo, checkCurrencyCapacity); int num = ++this.callbackCounter; RewardTag rewardTag = new RewardTag(); rewardTag.Vo = vo; rewardTag.GlobalSuccess = onSuccess; rewardTag.Cookie = cookie; this.rewardTags.Add(num, rewardTag); if (rewardabilityResult.CanAward) { this.GrantReward(num); } else { string message = Service.Lang.Get(rewardabilityResult.Reason, new object[0]); string title = Service.Lang.Get("INVENTORY_NO_ROOM_TITLE", new object[0]); if (rewardabilityResult.Reason == "INVENTORY_NO_ROOM") { YesNoScreen.ShowModal(title, message, false, new OnScreenModalResult(this.ForceCurrencyRewardUsage), rewardTag); } else { AlertScreen.ShowModal(false, null, message, null, null); } } }
private void ForceCurrencyRewardUsage(object result, object cookie) { if (result == null) { return; } RewardTag rewardTag = cookie as RewardTag; this.TryAndGrantReward(rewardTag.Vo.Uid, rewardTag.GlobalSuccess, rewardTag.Cookie); }
private void GrantReward(int identifier) { RewardTag rewardTag = this.rewardTags[identifier]; RewardUtils.GrantReward(this.cp, rewardTag.Vo); this.rewardTags.Remove(identifier); if (rewardTag.GlobalSuccess != null) { rewardTag.GlobalSuccess(rewardTag.Cookie); } }