Пример #1
0
        /// <summary>
        /// 显示自己和全部下注数量
        /// </summary>
        /// <param name="data"></param>
        public void ShowRefreshNum(ISFSObject data)
        {
            var gold  = data.GetInt("gold");
            var p     = data.GetUtfString("p");
            var num   = GetChipNum(p);
            var gdata = App.GetGameData <GlobalData>();
            var seat  = data.GetInt("seat");

            if (seat == gdata.SelfSeat)
            {
                _meBet[num] += gold;
                UserPanel user = App.GameData.GetPlayer() as UserPanel;
                user.AllBet  += gold;
                user.OnceBet += gold;
                UILabel _myLabel = ChipCfg.DeskAreas[num].gameObject.GetComponent <BetAreaItem>().MyBet;
                _myLabel.text = YxUtiles.ReduceNumber(_meBet[num]);
                _myLabel.gameObject.SetActive(true);
                labelList.Add(_myLabel.gameObject);
            }
            _allBet[num] += gold;
            UILabel _allLabel = ChipCfg.DeskAreas[num].gameObject.GetComponent <BetAreaItem>().AllBet;

            _allLabel.text = YxUtiles.ReduceNumber(_allBet[num]);
            _allLabel.gameObject.SetActive(true);
            labelList.Add(_allLabel.gameObject);
        }
Пример #2
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            var       gdata = App.GetGameData <GlobalData>();
            UserPanel user  = App.GameData.GetPlayer() as UserPanel;

            switch (type)
            {
            case RequestType.Bet:
                YxDebug.Log("申请上庄");
                App.GetGameData <GlobalData>().BankerApplying = true;
                BankerManager.ChangeTheBt();
                break;

            case RequestType.XiaZhuang:
                YxDebug.Log("取消上庄");
                App.GetGameData <GlobalData>().BankerApplying = false;
                BankerManager.ChangeTheBt();
                break;

            case RequestType.XiaZhu:
                YxDebug.Log("下注");
                BetArea.Bet(response);
                BetArea.ShowRefreshNum(response);
                if (response.ContainsKey(RequestKey.KeySeat))
                {
                    var seat = response.GetInt(RequestKey.KeySeat);
                    if (seat == App.GameData.SelfSeat)
                    {
                        user.SetRoundBetShow();
                        gdata.GetPlayer().UpdateView();
                    }
                }
                break;

            case RequestType.RollResult:
                YxDebug.Log("骰子结果");
                int[] diceArray = response.GetIntArray("dices");
                TouziCtrl.PlaySaiZiAni(diceArray);
                break;

            case RequestType.GameResult:
                App.GetGameData <GlobalData>().ChangeGameState(GlobalData.GameState.Free);
                Clock.SetClockNum(response.GetInt("cd"));
                YxDebug.Log("结算");
                CanQuit = !BankerManager.IsBanker(App.GameData.SelfSeat);
                Result.UpdateView(response);
                if (!BankerManager.IsBanker(-1))
                {
                    BankerManager.Banker.WinTotalCoin += response.GetLong("bwin");
                    BankerManager.Banker.Coin          = response.GetLong("bankerGold");
                }
                App.GameData.GetPlayer().Coin = response.GetLong("total");
                user.InitOnce();
                Result.Show();
                break;

            case RequestType.Start:
                YxDebug.Log("开始下注");
                YxMessageTip.Show("开始下注");
                App.GetGameData <GlobalData>().ChangeGameState(GlobalData.GameState.XiaZhu);
                Clock.SetClockNum(response.GetInt("cd"));
                CanQuit = !BankerManager.IsBanker(App.GameData.SelfSeat);
                WaitWin.Hide();
                BetArea.Init();
                BetArea.CloseWinAnim();
                BetArea.ReSetRefreshNum();
                gdata.BeginBet = true;
                if (BankerManager.Banker != null)
                {
                    BankerManager.Banker.TotalCount++;
                    BankerManager.Banker.UpdateView();
                    //限制自己为庄家时下注
                    if (CanQuit)
                    {
                        BetArea.ShowChip();
                    }
                    else
                    {
                        App.GetGameData <GlobalData>().ChangeGameState(GlobalData.GameState.IsBanker);
                    }
                }
                else
                {
                    BetArea.ShowChip();
                }
                Result.gameObject.SetActive(false);
                break;

            case RequestType.Stop:
                YxDebug.Log("停止下注");
                gdata.BeginBet = false;
                App.GetGameData <GlobalData>().ChangeGameState(GlobalData.GameState.Result);
                BetArea.HideChip();
                WaitWin.Hide();
                break;

            case RequestType.ZhuangChange:
                YxDebug.Log("发送庄家列表");
                if (response.GetInt("banker") == -1)
                {
                    BankerManager.SetBankerInfo(null);
                }
                BankerManager.RefreshBankerList(response.GetSFSArray("bankers"), response.GetInt("banker"));
                BankerManager.RefreshPlayerList(response.GetSFSArray("bankers"), response.GetInt("banker"));
                CanQuit = response.GetInt("banker") != App.GameData.SelfSeat;
                break;

            default:
                YxDebug.Log("RequestType : " + type);
                break;
            }
        }