private bool CheckExchangeVipResult() { var res = _requestExchangeVipResult.Read(true); if (res == null) { return(false); } Waiting(false); if (res.result.code == ResultCode.OK) { // 提示玩家成功购买VIP。 string content; if (_lastVipExchangeRequest != null) { content = string.Format("恭喜您,成功{0}VIP!", VipExchangeType.LabelOf(_lastVipExchangeRequest.type)); } else { content = "恭喜您,成功购买VIP!"; } _dialogManager.ShowConfirmBox(content); // 重新请求一遍Vip列表。 RequestVipExchangeList(); // 这里重新请求玩家数据,会比较保险。 // 重新请求一下用户数据。 RequestUserInfo(); // 播放一下使用金蛋的声音。 _soundController.PlayUseGoldSound(); var count = 0L; if (_lastVipExchangeRequest != null) { var price = _lastVipExchangeRequest.price; if (price != null) { count = DataUtil.CalculateGeValue(price.type, price.count); } } _analyticManager.Buy("vip", 1, count); _analyticManager.Event("exchange_vip_ok"); } else { if (!string.IsNullOrEmpty(res.result.msg)) { Toast(res.result.msg, true); } _analyticManager.Event("exchange_vip_fail"); } _lastVipExchangeRequest = null; return(true); }
public void RequestExchangeVip(VipExchange data) { if (data == null) { return; } Waiting(true); _lastVipExchangeRequest = data; _requestExchangeVipResult.ClearNotInvalidate(); _taskManager.ExecuteTask(CheckExchangeVipResult, () => Waiting(false)); var msg = CmdUtil.HU.RequestExchangeVip(data.name); _msgRepo.SendMsg(msg); _analyticManager.Event("exchange_vip"); }