Exemplo n.º 1
0
 /// <summary>
 /// 返回大厅的功能。
 /// </summary>
 public void BackToHall()
 {
     _dialogManager.ShowConfirmBox(
         "真的要离开牌局吗?",
         true, "退出", () =>
     {
         if (!_appController.IsSingleGameMode())
         {
             var room            = _room.Read();
             var currentRoomType = room == null ? RoomType.Match : room.type;
             if (currentRoomType == RoomType.Normal)
             {
                 // 选桌房,离桌。
                 _remoteAPI.LeaveTable(false);
             }
             else
             {
                 // 其他房间直接离开房间。
                 _remoteAPI.LeaveRoom(false);
             }
         }
         else
         {
             _appController.ExitSingleGame();
         }
     },
         true, "继续游戏", null,
         true, true, true);
 }
Exemplo n.º 2
0
        public void ShowBtnGroup()
        {
            var singleGame = _appController.IsSingleGameMode();

            if (singleGame)
            {
                return;
            }

            EnableBtnGroup(true);
        }
Exemplo n.º 3
0
        protected override void DoHandle(com.morln.game.gd.command.RoundEnd msg)
        {
            var msgPlayingData = msg.playing_data;

            if (msgPlayingData != null)
            {
                _playingData.Write(msgPlayingData, Time.time);
            }

            _raceRoundEnd.Write(msg, Time.time);

            var table     = _table.Read();
            var myUser    = _user.Read();
            var tableUser = _tableUser.Read();

            // 更新一下桌子的数据。
            if (DataUtil.UpdateTable(msg.table, table))
            {
                _table.Invalidate(Time.time);
            }

            if (msg.host_info != null)
            {
                _hostInfo.Write(msg.host_info, Time.time);
            }

            // 更新玩家自己的数据。
            var user = DataUtil.GetUser(msg.table, tableUser.MySeat);

            if (DataUtil.UpdateUserPublic(user, myUser))
            {
                _user.Invalidate(Time.time);
            }

            // 重置玩家的状态。
            ResetAllUserState();

            if (!_appController.IsSingleGameMode())
            {
                // 非单机模式下,进行统计。
                if (msg.total_multiple > 1)
                {
                    _analyticManager.EventValue("round_end_fanbei", null, msg.total_multiple);
                }
            }
        }
Exemplo n.º 4
0
        public void RefreshContent()
        {
            if (RefreshTime >= _pokerRecorder.Timestamp)
            {
                return;
            }

            RefreshTime = _pokerRecorder.Timestamp;

            var data = _pokerRecorder.Read();

            if (data == null)
            {
                Reset();
                return;
            }

            if (Days)
            {
                var user = _myUser.Read();
                if (user == null)
                {
                    return;
                }

                if (_appController.IsSingleGameMode())
                {
                    Days.text = "单机";
                }
                else if (user.vip > 0)
                {
                    Days.text = "VIP";
                }
                else if (user.CardRecorderLeftDays() > 0)
                {
                    Days.text = string.Format("{0}天", user.CardRecorderLeftDays());
                }
            }

            SetPokerCount(data);
        }
Exemplo n.º 5
0
        protected override void DoHandle(BRoundEnd msg)
        {
            var msgPlayingData = msg.playing_data;

            if (msgPlayingData != null)
            {
                _playingData.Write(msgPlayingData, Time.time);
            }

            _bRoundEnd.Write(msg, Time.time);

            var tableUser = _tableUserData.Read();
            var table     = _table.Read();
            var myUser    = _user.Read();
            var room      = _roomData.Read();

            // 更新一下桌子的数据。
            if (DataUtil.UpdateTable(msg.table, table))
            {
                _table.Invalidate(Time.time);
            }

            // 更新玩家自己的数据。
            var user = DataUtil.GetUser(msg.table, tableUser.MySeat);

            if (DataUtil.UpdateUserPublic(user, myUser))
            {
                _user.Invalidate(Time.time);
            }

            // 重置玩家的状态。
            ResetAllUserState();

            if (_appController.IsSingleGameMode())
            {
                return;
            }

            // 非单机模式下,进行统计。
            if (msg.total_multiple > 1)
            {
                _analyticManager.EventValue("round_end_fanbei", null, msg.total_multiple);
            }

            var type  = room == null ? CurrencyType.GOLDEN_EGG : room.currency_type;
            var count = 0;

            var userName = user == null ? null : user.username;

            if (StringUtil.AreEqual(msg.username1, userName))
            {
                count = msg.final_money1;
            }
            else if (StringUtil.AreEqual(msg.username2, userName))
            {
                count = msg.final_money2;
            }
            else if (StringUtil.AreEqual(msg.username3, userName))
            {
                count = msg.final_money3;
            }
            else if (StringUtil.AreEqual(msg.username4, userName))
            {
                count = msg.final_money4;
            }

            var currentRoomTaxRate = room == null ? 0 : room.tax_rate;
            var currentRoomId      = room == null ? -1 : room.room_id;

            if (count > 0)
            {
                _analyticManager.Bonus(
                    DataUtil.CalculateGeValue(type, count * (100 - currentRoomTaxRate) / 100),
                    AwardType.RoundEndWin);
            }
            else if (count < 0)
            {
                var geVal = (int)DataUtil.CalculateGeValue(type, Math.Abs(count));
                _analyticManager.Buy("round_end_lose", 1, geVal);

                // 统计结算带来的负金蛋流量。
                var attrs = new Dictionary <string, string>();
                attrs.Add("base_money", "" + currentRoomTaxRate);
                _analyticManager.EventValue("round_end_ge" + currentRoomId, attrs,
                                            geVal * currentRoomTaxRate / 100);
            }
        }
        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);
                }
            }
        }
Exemplo n.º 7
0
        public void Show(
            int leftTime,
            SeatPosition seat0,
            SeatPosition seat1 = SeatPosition.Null)
        {
            if (Content && !Content.gameObject.activeSelf)
            {
                Content.gameObject.SetActive(true);
            }

            _endTime = Time.time + leftTime;

            if (seat0 != SeatPosition.Null)
            {
                _pos = seat0;
                float angle = SeatAngle(seat0);
                if (Arrow)
                {
                    if (!Arrow.gameObject.activeSelf)
                    {
                        Arrow.gameObject.SetActive(true);
                    }

                    Arrow.rotation = Quaternion.Euler(0, 0, angle);
                }
            }
            else
            {
                if (Arrow && Arrow.gameObject.activeSelf)
                {
                    Arrow.gameObject.SetActive(false);
                }

                _pos = SeatPosition.Null;
            }

            if (seat1 != SeatPosition.Null)
            {
                _pos1 = seat1;
                float angle = SeatAngle(seat1);
                if (Arrow1)
                {
                    if (!Arrow1.gameObject.activeSelf)
                    {
                        Arrow1.gameObject.SetActive(true);
                    }

                    Arrow1.rotation = Quaternion.Euler(0, 0, angle);
                }
            }
            else
            {
                if (Arrow1 && Arrow1.gameObject.activeSelf)
                {
                    Arrow1.gameObject.SetActive(false);
                }

                _pos1 = SeatPosition.Null;
            }

            // 单机模式下不显示时间计数。
            if (TimeCounter &&
                TimeCounter.gameObject.activeSelf == _appController.IsSingleGameMode())
            {
                TimeCounter.gameObject.SetActive(!_appController.IsSingleGameMode());
            }
        }