Beispiel #1
0
 private void CheckAndroidBackKey()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (_quitSingleDialog == null)
         {
             _quitSingleDialog = _dialogManager.ShowConfirmBox("是否退出游戏?",
                                                               true, "退出", () => { Application.Quit(); },
                                                               true, "继续", null, true, true, true);
         }
     }
 }
Beispiel #2
0
        private void RefreshContent()
        {
            if (_raceData == null || _raceData.data == null)
            {
                return;
            }

            var current = _raceData.data.current;

            if (current == null)
            {
                MyRankTxt.text  = "暂无排行";
                MyScoreTxt.text = "暂无积分";
            }
            else
            {
                if (current.rank == -1)
                {
                    MyRankTxt.text = "暂无排行";
                }
                else
                {
                    MyRankTxt.text = current.rank < 0 ? "暂无排行" : current.rank.ToString();
                }
                MyScoreTxt.text = current.score.ToString();
            }

            var raceData = _raceData.data.race;

            if (raceData == null)
            {
                _dialogManager.ShowConfirmBox("获取数据失败");
                return;
            }
            RaceIntroduceTxt.text = raceData.fullDescription;
            RaceAwardsTxt.text    = raceData.fullAwardDescription;
            ButtonGroup.SetActive(true);
        }
Beispiel #3
0
        public void ShowDetail()
        {
            if (_data == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(_data.note))
            {
                return;
            }

            _dialogManager.ShowConfirmBox(_data.note);

            _analyticManager.Event("yuanbao_record_show_detail");
        }
        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);
        }
        /// <summary>
        /// 注册成功
        /// </summary>
        private void RegisterOk()
        {
            _registerFinished = true;

            _dialogManager.ShowWaitingDialog(false);

            _dialogManager.HideDialog(DialogName.RegisterDialog);
            _dialogManager.ShowConfirmBox(
                "恭喜您注册成功!",
                true, "马上登陆", () =>
            {
                LoginRecord.LastUsername  = _registerUsername;
                LoginRecord.LastPassword  = _registerPassword;
                LoginRecord.LastLoginType = LoginRecord.NormalUser;
                LoginRecord.SaveAll();

                _appController.ClearAppStateData();
                _network.InitLogin();
            },
                false, null, null,
                true, false, true);
            _remoteAPI.RequestUserInfo();
        }
Beispiel #7
0
        public void OnSignUpBtnClicked()
        {
            if (_data == null)
            {
                return;
            }

            var fee = _data.fee;

            if (fee != null)
            {
                _dialogManager.ShowConfirmBox(string.Format("是否花费<color=green>{0}{1}</color>报名比赛?",
                                                            fee.count, CurrencyType.LabelOf(fee.type)), true, "确定", () =>
                {
                    _dialogManager.ShowWaitingDialog(true);
                    _applyRaceResult.ClearNotInvalidate();
                    _task.ExecuteTask(CheckApplyRaceResult, GetApplyRaceResultComplete,
                                      () => { _dialogManager.ShowWaitingDialog(false); }, 5);

                    _remoteAPI.ApplyRace(_data.race_id);
                }, true, "取消",
                                              null, true, false, true);
            }
        }
        private bool CheckBuyCommodityResult()
        {
            var res = _buyCommodityResult.Read();

            if (res == null)
            {
                return(false);
            }

            _dialogManager.ShowWaitingDialog(false);

            if (res.result == ResultCode.OK)
            {
                // 购买成功。
                AddCommodity(res.name);

                // 更新玩家的钱。
                var user = _user.Read();
                GameUtil.SetMyCurrency(user, CurrencyType.GOLDEN_EGG, res.current_money);
                GameUtil.SetMyCurrency(user, CurrencyType.YIN_PIAO, res.current_second_money);
                _user.Invalidate(Time.time);

                // 播放用钱的声音。
                _soundController.PlayUseGoldSound();
                _dialogManager.ShowConfirmBox(
                    "恭喜您,成功购买商品^_^",
                    true, "立即使用", () => UseCommodity(res.name, true),
                    false, null, null,
                    true, true, true);

                // 统计
                var commodityList = _commodityList.Read();
                var commodity     = GameUtil.GetCommodity(commodityList, res.name);
                if (commodity != null)
                {
                    var type  = CommodityHelper.GetCurrencyType(commodity);
                    var price = CommodityHelper.GetPrice(commodity);
                    var count = DataUtil.CalculateGeValue(type, price);
                    _analyticManager.Buy(res.name, 1, count);
                }
            }
            else
            {
                // 购买失败,显示错误信息。
                switch (res.result)
                {
                case ResultCode.COMMODITY_NOT_FOUND:
                    _dialogManager.ShowToast("购买失败,商品不存在!", 2, true);
                    break;

                case ResultCode.COMMODITY_BUY_LEVEL_LIMIT:
                    _dialogManager.ShowToast("购买失败,您的等级不够!", 2, true);
                    break;

                case ResultCode.COMMODITY_BUY_VIP_LIMIT:
                    _dialogManager.ShowToast("购买失败,您的VIP等级不够!", 2, true);
                    break;

                case ResultCode.COMMODITY_BUY_MONEY_LIMIT:
                    _dialogManager.ShowToast("购买失败,您的钱不够!", 2, true);
                    break;

                case ResultCode.CURRENCY_NOT_SUPPORTED:
                    _dialogManager.ShowToast("购买失败,商品数据错误!", 2, true);
                    break;

                    // 默认情况下等待服务器端发送的Toast。
                }
            }

            // 读取过结果之后,就可以清空这个结果了。
            _buyCommodityResult.ClearAndInvalidate(Time.time);
            return(true);
        }
 public void Logout()
 {
     _dialogManager.ShowConfirmBox("是否退出当前登陆的账号?", true, "确定", () => { _networkManager.Logout(); },
                                   true, "取消",
                                   null, true, false, false);
 }
Beispiel #10
0
        public void ForgetPassword()
        {
            var serviceQQ = _serviceQQ.Read();

            _dialogManager.ShowConfirmBox(string.Format("请联系官方客服:{0}", serviceQQ));
        }