private bool CheckActionPriceResult() { _price = _actionPriceResult.Read(true); if (_price == null) { return(false); } // 检查是否收到了ActionPriceResult。 var price = _price.price; if (price != null) { CostTip.text = string.Format( "只需{0}{1},即可修改昵称", price.count, CurrencyType.LabelOf(price.type)); ConfirmBtn.interactable = true; } _actionPriceResult.ClearNotInvalidate(); return(true); }
private bool CheckActionPriceResult() { _price = _actionPriceResult.Read(true); if (_price == null) { return(false); } if (_price.action_code == ActionCode.ResetWinRate) { ConfirmBtn.interactable = true; var p = _price.price; var ct = p != null ? p.type : CurrencyType.YIN_PIAO; var count = p != null ? p.count : 0; CostTip.text = string.Format( "只需{0}{1},即可将胜率恢复成50%", count, CurrencyType.LabelOf(ct)); } else { var serviceQQ = _serviceQQ.Read(); ConfirmBtn.interactable = false; CostTip.text = string.Format( "数据错误,无法恢复胜率\n请联系客服:{0}", serviceQQ); } return(true); }
private void IncExchangeCount(long delta) { if (!SourceCount || _data == null) { return; } _exchangeCount += delta; if (_exchangeCount < 0) { // 如果小于0,则闪红一下。 _exchangeCount = 0; ShakeExchangeCount(); } var myUser = _myUser.Read(); var curAmount = myUser.MyCurrency(_data.source_type); if (_exchangeCount * _data.source_amount > curAmount) { // 如果超过了最大值,则返回0。 var currency = CurrencyType.LabelOf(_data.source_type); var target = CurrencyType.LabelOf(_data.target_type); _dialogManager.ShowToast(string.Format("您的{0}不足,无法兑换更多{1}", currency, target), 2, true); return; } UpdateSourceAndTargetValue(); }
public void OnValueChange() { if (_data == null) { return; } if (string.IsNullOrEmpty(CountEdt.text)) { return; } try { var count = int.Parse(CountEdt.text); var exchangeCount = (int)(count / _data.target_amount); Desc.text = string.Format( "<color=green>{0}{1}</color>兑换<color=green>{2}{3}</color>", _data.source_amount * exchangeCount, CurrencyType.LabelOf(_data.source_type), _data.target_amount * exchangeCount, CurrencyType.LabelOf(_data.target_type) ); } catch (Exception e) { } }
public void ApplyData(Exchange data, Action <long> confirmAction) { _data = data; if (data == null) { Reset(); return; } _confirmAction = confirmAction; Title.text = string.Format("请输入要兑换的<color=green>{0}</color>的数量:", CurrencyType.LabelOf(data.target_type)); Desc.text = string.Format( "<color=green>{0}{1}</color>可兑换<color=green>{2}{3}</color>", data.source_amount, CurrencyType.LabelOf(data.source_type), data.target_amount, CurrencyType.LabelOf(data.target_type)); var sprite = _spriteHolder.GetCurrency(data.target_type); if (sprite) { if (!CurrencyIcon.gameObject.activeSelf) { CurrencyIcon.gameObject.SetActive(true); } CurrencyIcon.sprite = sprite; } else { if (CurrencyIcon.gameObject.activeSelf) { CurrencyIcon.gameObject.SetActive(false); } } }
public void ApplyData(UserTaskState data, TaskItem item) { _data = data; _item = item; if (data == null) { return; } if (item == null) { return; } float progress = (float)data.current_progress / data.total_progress; GoToBtn.gameObject.SetActive(false); GetAwardBtn.gameObject.SetActive(false); HasGet.SetActive(false); if (progress >= 0 && progress < 1) { GoToBtn.gameObject.SetActive(true); } else { if (data.award_posted) { HasGet.SetActive(true); } else { GetAwardBtn.gameObject.SetActive(true); } } AwardIcon.SetTargetPic(data.pic, null, data.pic_url); AwardName.text = CurrencyType.LabelOf(data.display_currency_type); var currencyList = data.currency; if (currencyList == null || currencyList.Count <= 0) { AwardDescription.text = ""; return; } var awards = ""; for (int i = 0; i < currencyList.Count; i++) { awards = awards + CurrencyType.LabelOf(currencyList[i].type) + " x " + currencyList[i].count + " "; } AwardDescription.text = "领取后立即得到:" + awards; }
protected override void DoHandle(Punish msg) { var room = _room.Read(); var user = _user.Read(); GameUtil.SetMyCurrency(user, msg.currency_type, msg.current_count); _user.Invalidate(Time.time); _dialogManager.ShowConfirmBox( string.Format( "没打到目标就逃跑了\n蛋员外<color=#ff6600>扣你{0}{1}</color>哦", msg.money, CurrencyType.LabelOf(room.currency_type)) ); _analyticManager.Buy("leave_punish", 1, DataUtil.CalculateGeValue(msg.currency_type, msg.money)); }
protected override void DoHandle(BEscape msg) { var user = _user.Read(); GameUtil.SetMyCurrency(user, msg.currency_type, msg.current_count); _user.Invalidate(Time.time); var escapeUser = msg.player != null ? msg.player.nickname : "玩家"; _dialogManager.ShowConfirmBox( string.Format( "<color=green>{0}</color>没打到{1}就逃走了\n<color=#ff6600>补偿您{2}{3}</color>", escapeUser, Dmm.PokerLogic.PokerNumType.LabelOf(CurrentRoomTargetHost()), msg.compensation, CurrencyType.LabelOf(msg.currency_type) ) ); _analyticManager.Bonus(DataUtil.CalculateGeValue(msg.currency_type, msg.compensation), AwardType.Compensation); }
public void ApplyData(Room room, string exitBtnContent, ExitLogic exitLogic) { _data = room; if (room == null) { return; } if (exitLogic == null) { return; } if (ExitBtnTxt) { ExitBtnTxt.text = exitBtnContent; } _exitLogic = exitLogic; if (TipText) { TipText.text = string.Format( "本房间需<color=red>打到{0}</color>\n如果现在退出\n会被扣<color=green>{1}{2}</color>的哦", PokerLogicUtil.LabelOfSessionNumType(room.target_host), room.leave_punish_money, CurrencyType.LabelOf(room.currency_type) ); } var attrs = new Dictionary <string, string>(); attrs.Add("room_id", "" + room.room_id); var analyticManager = GetAnalyticManager(); analyticManager.Event("leave_room_punish_tip", attrs); }
public void OnSignupBtnClick() { if (_raceConfig == null) { _dialogManager.ShowToast("报名失败", 2, true); return; } var fee = _raceConfig.fee; if (fee != null) { _dialogManager.ShowConfirmBox(string.Format("是否花费<color=green>{0}{1}</color>报名比赛?", fee.count, CurrencyType.LabelOf(fee.type)), true, "确定", () => { _dialogManager.ShowWaitingDialog(true); _applyRaceResult.ClearAndInvalidate(0); _task.ExecuteTask(CheckApplyRaceResult, GetApplyRaceResultComplete, () => { _dialogManager.ShowWaitingDialog(false); }, 5); _remoteAPI.ApplyRace(_raceConfig.race_id); }, true, "取消", null, true, false, true); } }
public override void BindData(int currentIndex, Commodity data) { if (data == null) { return; } _data = data; if (SelectCover && !SelectCover.gameObject.activeSelf) { SelectCover.gameObject.SetActive(false); } var pic = data.pic; if (Image) { if (!string.IsNullOrEmpty(pic)) { Image.SetTargetPic(pic, ResourcePath.CommodityPath, data.pic_url, true); } else { Image.Reset(); } } if (BgImage) { var picBg = data.pic_bg; if (!string.IsNullOrEmpty(picBg)) { BgImage.SetTargetPic(picBg, ResourcePath.CommodityPath, data.pic_bg_url, true); } else { BgImage.Reset(); } } if (data.vip_level > 0) { if (!VIPTag.activeSelf) { VIPTag.SetActive(true); } } else { if (VIPTag.activeSelf) { VIPTag.SetActive(false); } } var bag = _bag.Read(); var user = _user.Read(); if (!GameUtil.HasCommodity(bag, data)) { if (UnlockTag && !UnlockTag.activeSelf) { UnlockTag.SetActive(true); } if (StateGroup && !StateGroup.activeSelf) { StateGroup.SetActive(true); } if (StateText) { StateText.text = "" + CommodityHelper.GetPrice(data) + CurrencyType.LabelOf(CommodityHelper.GetCurrencyType(data)); } } else { if (UnlockTag && UnlockTag.activeSelf) { UnlockTag.SetActive(false); } if (StateGroup && !StateGroup.activeSelf) { StateGroup.SetActive(true); } if (StateText) { StateText.text = GameUtil.IsCommodityEquiped(bag, user, data) ? "<color=#4ae91a>当前装饰</color>" : "<color=#f0aa4b>已购买</color>"; } } }
public override void BindData(int currentIndex, Exchange data) { _data = data; if (data == null) { Reset(currentIndex); return; } switch (data.target_type) { case CurrencyType.GOLDEN_EGG: TypeTag.sprite = TypeGeSprite; break; case CurrencyType.CARD_RECORDER: TypeTag.sprite = TypeCardRecorderSprite; break; case CurrencyType.RECHECKIN_CARD: TypeTag.sprite = TypeCheckinCardSprite; break; } UpdateSourceAndTargetValue(); ExchangeRate.text = string.Format( "{0}{1}可兑换{2}{3}", data.source_amount, CurrencyType.LabelOf(data.source_type), data.target_amount, CurrencyType.LabelOf(data.target_type) ); var myUser = _myUser.Read(); switch (data.target_type) { case CurrencyType.GOLDEN_EGG: CurrentCountText.text = string.Format( "您现有 <color=#F9CB51>{0}</color> 金蛋", myUser.MyCurrency(data.target_type) ); break; case CurrencyType.RECHECKIN_CARD: CurrentCountText.text = string.Format( "您现有补签卡 <color=#F9CB51>{0}</color> 张", myUser.MyCurrency(data.target_type) ); break; case CurrencyType.CARD_RECORDER: CurrentCountText.text = string.Format( "记牌器有效期 <color=#F9CB51>{0}</color> 天", myUser.CardRecorderLeftDays() ); break; default: CurrentCountText.text = string.Format( "您现有 <color=#F9CB51>{0}</color>", myUser.MyCurrency(data.target_type) ); break; } }
public void ApplyData( bool lianDa, bool win, string nickname, int vip, int exp, int currencyType, int money, int raceId, int totalScore, int fanbei) { if (WinIcon) { if (!WinIcon.gameObject.activeSelf) { WinIcon.gameObject.SetActive(true); } WinIcon.sprite = win ? _spriteHolder.WinIcon : _spriteHolder.LoseIcon; } if (Nickname) { Nickname.SetData(nickname, vip); } if (ExpTxt) { if (!_appController.IsSingleGameMode()) { ExpTxt.text = (exp > 0 ? "+" : "") + exp; } else { ExpTxt.text = "单机模式"; } } if (MoneyTxt) { if (!_appController.IsSingleGameMode()) { MoneyTxt.text = (money > 0 ? "+" : "") + money; } else { MoneyTxt.text = "单机模式"; } } if (fanbei > 1) { if (FanbeiTxt) { if (!FanbeiTxt.gameObject.activeSelf) { FanbeiTxt.gameObject.SetActive(true); } FanbeiTxt.text = "" + fanbei; } } else { if (FanbeiGroup && FanbeiGroup.gameObject.activeSelf) { FanbeiGroup.gameObject.SetActive(false); } } if (raceId > 0) { // 是比赛房 if (ExpLabel) { if (!ExpLabel.gameObject.activeSelf) { ExpLabel.gameObject.SetActive(true); } ExpLabel.text = "总分"; ExpTxt.text = "" + totalScore; } if (MoneyLabel) { if (!MoneyLabel.gameObject.activeSelf) { MoneyLabel.gameObject.SetActive(true); } MoneyLabel.text = "得分"; } } else { if (ExpLabel) { if (!ExpLabel.gameObject.activeSelf) { ExpLabel.gameObject.SetActive(true); } ExpLabel.text = "经验"; } if (MoneyLabel) { if (!MoneyLabel.gameObject.activeSelf) { MoneyLabel.gameObject.SetActive(true); } MoneyLabel.text = CurrencyType.LabelOf(currencyType); } } }