protected void SetupRewardButton(ref UXButton btn, ref UXLabel btnLabel, LimitedTimeRewardVO vo) { if (this.HasRewardButton1BeenClaimed(vo)) { btnLabel.Text = this.lang.Get("hn_reward_been_claimed", new object[0]); btn.Enabled = false; } }
private void ClaimReward(string limitedTimeRewardUid, string contextUid) { if (!string.IsNullOrEmpty(contextUid)) { StaticDataController staticDataController = Service.StaticDataController; LimitedTimeRewardVO optional = staticDataController.GetOptional <LimitedTimeRewardVO>(limitedTimeRewardUid); if (optional == null) { Service.Logger.WarnFormat("No LimitedTimeReward data found for uid: {0}", new object[] { limitedTimeRewardUid }); return; } RewardVO optional2 = staticDataController.GetOptional <RewardVO>(optional.RewardUid); if (optional2 == null) { Service.Logger.WarnFormat("LimitedTimeReward {0} points to reward {1} but it was not found", new object[] { limitedTimeRewardUid, optional.RewardUid }); return; } HolonetClaimRewardRequest request = new HolonetClaimRewardRequest(limitedTimeRewardUid, contextUid); HolonetClaimRewardCommand command = new HolonetClaimRewardCommand(request); Service.ServerAPI.Sync(command); GameUtils.AddRewardToInventory(optional2); Service.CurrentPlayer.AddHolonetReward(limitedTimeRewardUid); Lang lang = Service.Lang; string text = lang.Get(optional.Title, new object[0]); AlertScreen.ShowModal(false, lang.Get("hn_reward_redeemed", new object[0]), lang.Get("hn_reward_claimed_desc", new object[] { text }), null, null); } }
protected bool HasRewardButton1BeenClaimed(LimitedTimeRewardVO vo) { CurrentPlayer currentPlayer = Service.CurrentPlayer; return(currentPlayer.HolonetRewards.Contains(vo.Uid)); }