예제 #1
0
        /// <summary>
        /// 重置
        /// </summary>
        public void Reset()
        {
            if (PublicPokers.Count > 0)
            {
                foreach (PokerCard publicPoker in PublicPokers)
                {
                    if (publicPoker != null && publicPoker.gameObject != null)
                    {
                        Destroy(publicPoker.gameObject);
                    }
                }
            }

            YxClockManager.StopWaitPlayer();
            PublicPokers.Clear();
            SpeakMgr.Reset();
            DealerMgr.Rest();

            var playerList = App.GetGameData <GangwuGameData>().PlayerList;

            foreach (var yxBaseGamePlayer in playerList)
            {
                var player = (PlayerPanel)yxBaseGamePlayer;
                player.Reset();
            }
            StopAllCoroutines();
        }
예제 #2
0
        /// <summary>
        /// 重置
        /// </summary>
        public void Reset()
        {
            YxClockManager.StopWaitPlayer();
            foreach (PokerCard publicPoker in PublicPokers)
            {
                DestroyImmediate(publicPoker.gameObject);
            }
            var gdata = App.GetGameData <TexasGameData>();

            gdata.GStatus = YxEGameStatus.Normal;
            PublicPokers.Clear();
            ResultData.Clear();
            SpeakMagr.Reset();
            DealerMagr.Reset();
            SmallBanker = -1;
            BigBanker   = -1;

            var playerList  = gdata.PlayerList;
            var playerCount = playerList.Length;

            for (var i = 0; i < playerCount; i++)
            {
                var player = gdata.GetPlayer <PlayerPanel>(i);
                player.Reset();
            }

            foreach (var pokerPos in PublicPokerPos)
            {
                pokerPos.transform.DestroyChildren();
            }
            StopAllCoroutines();
        }
예제 #3
0
        /// <summary>
        /// 重置
        /// </summary>
        public void Reset(bool isLanDi = false)
        {
            LaddyMgr.Rest(isLanDi);
            GuoBet = -1;

            foreach (PokerCard publicPoker in PublicPokers)
            {
                Destroy(publicPoker.gameObject);
            }

            PublicPokers = new List <PokerCard>();

            SpeakMgr.Reset();
            DealerMgr.Reset();
            AnimationMgr.Reset();
            SummaryMgr.Reset();

            var gdata = App.GetGameData <FillpitGameData>();

            //开放模式自动准备
            GetPlayerPanel().SetReadyBtnActive(!gdata.IsRoomGame);

            gdata.LastBetValue = 0;
            var players = gdata.PlayerList;

            BetMgr.BetParent.DestroyChildren();
            YxClockManager.StopWaitPlayer();

            foreach (var player in players)
            {
                var panel = (PlayerPanel)player;
                panel.Reset();
            }
        }
예제 #4
0
        public void OnOutCard(ISFSObject data)
        {
            var seat        = data.GetInt(RequestKey.KeySeat);
            var card        = data.GetInt(JlGameRequestConstKey.KeyCard);
            var foldNum     = data.ContainsKey(JlGameRequestConstKey.KeyFoldNum) ? data.GetInt(JlGameRequestConstKey.KeyFoldNum) : -1;
            var handNum     = data.ContainsKey(JlGameRequestConstKey.KeyHandNum) ? data.GetInt(JlGameRequestConstKey.KeyHandNum) : -1;
            var activeCards = data.ContainsKey(JlGameRequestConstKey.KeyActiveCards) ? data.GetIntArray(JlGameRequestConstKey.KeyActiveCards) : null; //
            var killDragon  = data.ContainsKey(JlGameRequestConstKey.KeyKillDragon) ? data.GetBoolArray(JlGameRequestConstKey.KeyKillDragon) : null;
            var isDragon    = data.ContainsKey(JlGameRequestConstKey.KeyIsDragon) ? data.GetBoolArray(JlGameRequestConstKey.KeyIsDragon) : null;

            var sendObj = SFSObject.NewInstance();

            sendObj.PutInt("card", card);
            sendObj.PutInt("seat", seat);
            sendObj.PutBoolArray("killDragon", killDragon);
            sendObj.PutBoolArray("isDragon", isDragon);


            EventObj.SendEvent("SoundEvent", "CardSound", new JlGameSound.SoundData(JlGameSound.EnAudio.None, GetPlayerInfo <JlGameUserInfo>(seat, true).SexI, card));
            EventObj.SendEvent("TableViewEvent", "OutCard", sendObj);

//            YxDebug.LogArray(activeCards);
            if (activeCards != null && activeCards.Length != 0)
            {
                GetPlayer <JlGameSelfPlayer>(SelfSeat, true).FreshHandCard(activeCards, false);
            }
            GetPlayer <JlGamePlayer>(seat, true).FreshFoldCardShow(foldNum, handNum);

            GetPlayer <JlGamePlayer>(seat, true).HideCountDown();
            YxClockManager.StopWaitPlayer();
        }
예제 #5
0
 /// <summary>
 /// 当游戏结束时,运行处理数据
 /// </summary>
 /// <param name="data"></param>
 void OnGameOver(ISFSObject data)
 {
     if (data.ContainsKey("users"))
     {
         App.GetGameManager <FillpitGameManager>().SummaryMgr.OnGameOver(data);
     }
     YxClockManager.StopWaitPlayer();
 }
예제 #6
0
        /// <summary>
        /// 结算结束
        /// </summary>
        public void ResultDone()
        {
            PokerResultInit();

            CancelInvoke("ResultSomeone");
            //结算完成重置数据
            Reset();
            BetMagr.Reset();
            IsResultDone = false;
            YxClockManager.StopWaitPlayer();
        }
예제 #7
0
        public override int OnChangeRoom()
        {
            base.OnChangeRoom();
            YxClockManager.StopWaitPlayer();
            var panelList = App.GameData.PlayerList;

            foreach (var panel in panelList)
            {
                panel.Info = null;
                panel.gameObject.SetActive(false);
            }
            return(base.OnChangeRoom());
        }
예제 #8
0
        public void OnFoldCard(ISFSObject data)
        {
            var seat    = data.GetInt(RequestKey.KeySeat);
            var foldNum = data.GetInt(JlGameRequestConstKey.KeyFoldNum);
            var handNum = data.GetInt(JlGameRequestConstKey.KeyHandNum);

            var card      = data.ContainsKey(JlGameRequestConstKey.KeyCard) ? data.GetInt(JlGameRequestConstKey.KeyCard) : -1;
            var foldScore = data.ContainsKey(JlGameRequestConstKey.KeyFoldScore) ? data.GetInt(JlGameRequestConstKey.KeyFoldScore) : -1;

            GetPlayer <JlGamePlayer>(seat, true).FreshFoldCardShow(foldNum, handNum, foldScore);

            if (seat == SelfSeat)
            {
                GetPlayer <JlGameSelfPlayer>(seat, true).FoldCard(card);
            }
            EventObj.SendEvent("SoundEvent", "RemindSound", new JlGameSound.SoundData(JlGameSound.EnAudio.HasFoldCard, GetPlayerInfo <JlGameUserInfo>(seat, true).SexI));

            GetPlayer <JlGamePlayer>(seat, true).HideCountDown();
            YxClockManager.StopWaitPlayer();
        }
예제 #9
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            var gdata = App.GetGameData <GangwuGameData>();

            if (!gdata.IsGameInfo)
            {
                YxDebug.LogError("GameInfo还没有初始化!!");
                return;
            }

            switch ((GameRequestType)type)
            {
            case GameRequestType.Bet:

                if (response.ContainsKey("seat"))
                {
                    int         bseat    = response.GetInt("seat");
                    int         bgold    = response.GetInt("gold");
                    PlayerPanel onePanel = gdata.GetPlayer <PlayerPanel>(bseat, true);
                    if (bgold > 0)
                    {
                        if (bgold + onePanel.BetMoney == SpeakMgr.MaxBetNum)
                        {
                            onePanel.ShowGameType("call");
                        }
                        else if (onePanel.Info != null && bgold == onePanel.Coin)
                        {
                            onePanel.CurGameType = PlayerGameType.AllIn;
                            onePanel.ShowGameType("allIn");
                        }
                        else
                        {
                            onePanel.ShowGameType("");
                        }
                    }
                    else
                    {
                        onePanel.ShowGameType("seePoker");
                    }
                    onePanel.PlayerBet(bgold);

                    if (onePanel.CurGameType != PlayerGameType.AllIn &&
                        onePanel.BetMoney > SpeakMgr.MaxBetNum)
                    {
                        Facade.Instance <MusicManager>().Play("addBet");
                        onePanel.ShowGameType(string.Empty);
                    }
                    else if (onePanel.CurGameType != PlayerGameType.AllIn &&
                             onePanel.BetMoney == SpeakMgr.MaxBetNum)
                    {
                        Facade.Instance <MusicManager>().Play(bgold > 0
                                ? "call"
                                : "seePoker");
                    }

                    //设置最大下注
                    SpeakMgr.MaxBetNum = onePanel.BetMoney >
                                         SpeakMgr.MaxBetNum
                            ? onePanel.BetMoney
                            : SpeakMgr.MaxBetNum;


                    if (bseat == gdata.SelfSeat)
                    {
                        SpeakMgr.ShowAuto();
                        SpeakMgr.AddBetSum = 0;
                    }
                }
                //包含users说明游戏开始
                else if (response.ContainsKey("users"))
                {
                    ++gdata.CurRound;
                    int[] beginSeats   = response.GetIntArray("users");
                    int   beginBetGold = response.GetInt("guoBet");
                    gdata.Ante        = response.GetInt("curante");
                    gdata.IsGameStart = true;
                    gdata.IsPlayed    = true;
                    foreach (int seat in beginSeats)
                    {
                        PlayerPanel panel = gdata.GetPlayer <PlayerPanel>(seat, true);
                        if (panel.Info != null)
                        {
                            panel.SetPlayerReadyState(true);
                            panel.PlayerBet(beginBetGold);
                        }
                    }
                    HistoryResultMgr.CreateHistoryItem(beginSeats);
                    //隐藏准备按钮
                    gdata.GetPlayer <SelfPlayerPanel>().OnGameStart();
                }
                break;



            case GameRequestType.Fold:
                int         fseat     = response.GetInt("seat");
                PlayerPanel foldPanel = gdata.GetPlayer <PlayerPanel>(fseat, true);
                foldPanel.CurGameType = PlayerGameType.Fold;
                foldPanel.Mask.SetActive(true);
                foldPanel.BetLabel.gameObject.SetActive(foldPanel.BetMoney > 0);
                foldPanel.ShowGameType("fold");
                if (fseat == gdata.SelfSeat)
                {
                    SpeakMgr.ShowNothing();
                }
                break;


            case GameRequestType.Card:

                if (response.ContainsKey("selfCard"))
                {
                    int[] selfCards = response.GetIntArray("selfCard");
                    if (selfCards.Length > 0)
                    {
                        gdata.GetPlayer <PlayerPanel>().UserBetPoker.LeftCardValue = selfCards[0];
                    }
                }

                if (response.ContainsKey("cards"))
                {
                    int[] cardSeats = response.GetIntArray("seats");
                    int[] cards     = response.GetIntArray("cards");

                    int cardCount = response.GetInt("cardCount");
                    gdata.CardCount = cardCount;

                    //如果为cardCount是2,则是第一轮发牌,需要先发一轮暗牌
                    if (cardCount <= 2)
                    {
                        int[] tempCards = new int[cardSeats.Length];

                        for (int i = 0; i < cardSeats.Length; i++)
                        {
                            if (cardSeats[i] == gdata.SelfSeat)
                            {
                                tempCards[i] = gdata.GetPlayer <PlayerPanel>().UserBetPoker.LeftCardValue;
                            }
                        }

                        DealerMgr.BeginBigDeal(tempCards, cardSeats, 0);
                    }

                    DealerMgr.BeginBigDeal(cards, cardSeats, cardCount - 1);

                    //初始化玩家当前状态信息
                    foreach (int seat in cardSeats)
                    {
                        gdata.GetPlayer <PlayerPanel>(seat, true).ShowGameType(string.Empty);
                    }
                }

                //每轮开始清除最大下注
                SpeakMgr.MaxBetNum = 0;
                SpeakMgr.AddBetSum = 0;
                BetMgr.CollectBet();
                foreach (var yxBaseGamePlayer in gdata.PlayerList)
                {
                    var panel = (PlayerPanel)yxBaseGamePlayer;
                    panel.BetMoney      = 0;
                    panel.BetLabel.text = panel.BetMoney.ToString();
                }

                SpeakMgr.BetRemenber.Clear();

                break;


            case GameRequestType.Result:
                gdata.AllocateFour = false;
                //当接到结算时,由于要排除由于手机卡顿或者由于有玩家手上筹码过少,引起的直接结算,这里将手牌取消动画显示
                DealerMgr.OnResult();

                ResultMgr.OnGameResult(response.GetSFSArray("result"));
                StartCoroutine(ShowResultView());

                DoResult(response);

                HistoryResultMgr.GetHistoryInfo(response);

                YxClockManager.StopWaitPlayer();
                break;


            case GameRequestType.BetSpeak:

                int betSpeakSeat = response.GetInt("seat");
                var betSpeaker   = gdata.GetPlayer <PlayerPanel>(betSpeakSeat, true);

                if (!betSpeaker.ReadyState)
                {
                    return;
                }

                gdata.AllocateFour = response.ContainsKey("allocateFour") && response.GetBool("allocateFour");

                gdata.SpeakCd = response.GetInt("cd");
                betSpeaker.ShowGameType(string.Empty);
                Speaker(betSpeakSeat, response.GetInt("cd"));
                if (betSpeakSeat == gdata.SelfSeat)
                {
                    betSpeaker.BetLabel.gameObject.SetActive(true);
                    SpeakMgr.ShowSpeak();
                }
                break;



            case GameRequestType.FollowSpeak:

                int followSpeakSeat = response.GetInt("seat");
                var followSpeaker   = gdata.GetPlayer <PlayerPanel>(followSpeakSeat, true);
                if (!followSpeaker.ReadyState)
                {
                    return;
                }

                gdata.SpeakCd      = response.GetInt("cd");
                gdata.AllocateFour = response.GetBool("allocateFour");
                followSpeaker.ShowGameType(string.Empty);

                Speaker(followSpeakSeat, response.GetInt("cd"));
                if (followSpeakSeat == gdata.SelfSeat)
                {
                    followSpeaker.BetLabel.gameObject.SetActive(true);
                    SpeakMgr.ShowSpeak();
                }
                break;

            case GameRequestType.AllowReady:
                gdata.AllocateFour = false;
                gdata.IsGameStart  = false;

                _waitResult = false;       //允许显示结算

                YxClockManager.StopWaitPlayer();
                break;

            default:
                YxDebug.Log("不存在的服务器交互!");
                break;
            }
        }
예제 #10
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            var gdata = App.GetGameData <TexasGameData>();

            switch ((GameRequestType)type)
            {
            case GameRequestType.Bet:

                var bseat = response.GetInt("seat");
                var bgold = response.GetInt("gold");
                if (bseat == gdata.SelfSeat)
                {
                    gdata.GStatus = YxEGameStatus.PlayAndConfine;
                }
                var bplayer = gdata.GetPlayer <PlayerPanel>(bseat, true);
                bplayer.PlayerBet(bgold);
                YxClockManager.StopToCountDown();
                SpeakMagr.PoolNum += bgold;

                if (bplayer.CurGameType != PlayerGameType.AllIn && bplayer.BetMoney > SpeakMagr.MaxBetNum)
                {
                    Facade.Instance <MusicManager>().Play("addBet");
                }
                else if (bplayer.CurGameType != PlayerGameType.AllIn && bplayer.BetMoney == SpeakMagr.MaxBetNum)
                {
                    bool isCall = bgold > 0;
                    Facade.Instance <MusicManager>().Play(isCall
                            ? "call"
                            : "seePoker");
                    bplayer.CurGameType = isCall ? PlayerGameType.Call : PlayerGameType.SeePoker;
                }

                //设置最大下注
                SpeakMagr.MaxBetNum = bplayer.BetMoney >
                                      SpeakMagr.MaxBetNum
                        ? bplayer.BetMoney
                        : SpeakMagr.MaxBetNum;

                YxDebug.Log("玩家 " + bseat + " 下注 : " + bgold);

                if (response.ContainsKey("speaker"))
                {
                    StartCoroutine(Speaker(response.GetInt("speaker"),
                                           response.ContainsKey("cd")
                                ? response.GetInt("cd")
                                : App.GetGameData <TexasGameData>().SpeakCd));
                }

                break;

            case GameRequestType.Fold:
            {
                var fseat   = response.GetInt("seat");
                var fplayer = gdata.GetPlayer <PlayerPanel>(fseat, true);
                YxClockManager.StopWaitPlayer();
                fplayer.CurGameType = PlayerGameType.Fold;
                //fplayer.ReadyState = false;
                Facade.Instance <MusicManager>().Play("fold");
                if (fseat == gdata.SelfSeat)
                {
                    SpeakMagr.ShowNothing();
                    gdata.GStatus = YxEGameStatus.Normal;
                }
                YxDebug.Log("玩家 " + fseat + " 弃牌!!");

                if (response.ContainsKey("speaker"))
                {
                    StartCoroutine(Speaker(response.GetInt("speaker"),
                                           response.ContainsKey("cd")
                                    ? response.GetInt("cd")
                                    : App.GetGameData <TexasGameData>().SpeakCd));
                }
            }
            break;

            case GameRequestType.HandCard:
                //游戏开始
                gdata.IsGameStart = true;

                //设置自己的状态
                var self = gdata.GetPlayer <SelfPanel>();
                self.SetReadyBtnActive(false);

                //游戏开始要隐藏微信邀请按钮
                if (gdata.IsRoomGame)
                {
                    RModelMagr.OnGameStart();
                    gdata.IsPlayed = true;
                }

                //下大小盲注时,游戏开始
                if (response.ContainsKey("bkp"))
                {
                    int round = ++gdata.CurRound;

                    RModelMagr.UpDataRoundValue(round);
                    IsResultDone = false;

                    //小盲注 在下一家为大盲注
                    var bkp = response.GetInt("bkp");

                    if (gdata.GetPlayer().ReadyState)
                    {
                        gdata.GStatus = self.ReadyState ? YxEGameStatus.PlayAndConfine : YxEGameStatus.Play;
                    }

                    var playerList  = gdata.PlayerList;
                    var playerCount = playerList.Length;
                    var maxCount    = playerCount + bkp;
                    for (var i = bkp; i < maxCount; i++)
                    {
                        var index  = i % playerCount;
                        var player = gdata.GetPlayer <PlayerPanel>(index, true);
                        if (player.Info == null || !player.ReadyState)
                        {
                            continue;
                        }

                        if (SmallBanker == -1)
                        {
                            //小盲下注
                            var xmz = player.RoomCoin >= gdata.Ante
                                    ? gdata.Ante : player.RoomCoin;
                            player.PlayerBet(xmz);
                            SmallBanker         = index;
                            SpeakMagr.MaxBetNum = xmz;
                            SpeakMagr.PoolNum  += xmz;
                        }
                        else if (BigBanker == -1)
                        {
                            //大盲下注
                            var dmz = player.RoomCoin >= gdata.Ante * 2
                                    ? gdata.Ante * 2
                                    : player.RoomCoin;
                            player.Blinds.SetActive(true);
                            player.PlayerBet(dmz);
                            BigBanker           = i;
                            SpeakMagr.MaxBetNum = dmz > SpeakMagr.MaxBetNum
                                    ? dmz
                                    : SpeakMagr.MaxBetNum;
                            SpeakMagr.PoolNum += dmz;
                        }
                    }

                    //获得手牌
                    if (response.ContainsKey(RequestKey.KeyCards))
                    {
                        DealerMagr.BeginSmallDeal(SmallBanker, response.GetIntArray(RequestKey.KeyCards));
                    }

                    if (HistoryResultMgr != null)
                    {
                        HistoryResultMgr.CreateHistoryItem(response);
                    }
                }
                else
                {
                    SpeakMagr.MaxBetNum = 0;         //每轮开始清除最大下注

                    BetMagr.Invoke("CollectBet", 0.5f);

                    //发公共牌
                    DealerMagr.BeginBigDeal(response.GetIntArray(RequestKey.KeyCards));

                    if (response.ContainsKey("speaker"))
                    {
                        StartCoroutine(Speaker(response.GetInt("speaker"), gdata.SpeakCd, 0.7f));
                    }
                    HideAllPlayersGameType();
                }

                break;


            case GameRequestType.Request:
            {
                gdata.GStatus = YxEGameStatus.Normal;
                SpeakMagr.ShowNothing();
                HideAllPlayersGameType();
                YxClockManager.StopWaitPlayer();

                //每轮开始清除最大下注
                BetMagr.CollectBet();

                var players = response.GetSFSArray("players");

                ResultCd = response.GetInt("cd");

                if (response.ContainsKey("croomct"))
                {
                    RModelMagr.CalibrationTime((int)response.GetLong("croomct"));
                }

                var idxIndex        = 0;
                var playerDataCount = players.Count;
                for (var i = 0; i < playerDataCount; i++)
                {
                    var playerData = players.GetSFSObject(i);
                    //没有参与游戏的玩家直接跳过
                    if (!playerData.ContainsKey("isPlayed") || !playerData.GetBool("isPlayed"))
                    {
                        continue;
                    }
                    //弃牌玩家不会设置数据
                    bool isFold = playerData.ContainsKey("isGiveUp") && playerData.GetBool("isGiveUp");
                    if (isFold)
                    {
                        continue;
                    }

                    //座位号
                    var seat = playerData.GetInt("seat");

                    //玩家输赢
                    var winGold = Math.Abs(playerData.GetInt("xz")) + playerData.GetInt("gold");

                    var p = gdata.GetPlayer <PlayerPanel>(seat, true);
                    p.Blinds.SetActive(false);
                    if (seat != gdata.SelfSeat)
                    {
                        var cardArray = playerData.GetIntArray("cardArr");
                        p.ShowHandCards(cardArray);
                        p.UserBetPoker.TurnOverCard();
                    }

                    if (p.Info == null)
                    {
                        continue;
                    }

                    if (playerData.ContainsKey("roomGold"))
                    {
                        p.RoomCoin = playerData.GetInt("roomGold");
                    }

                    if (winGold <= 0)
                    {
                        continue;
                    }

                    ISFSObject teax;
                    if (playerData.ContainsKey("teax"))
                    {
                        teax = playerData.GetSFSObject("teax");
                    }
                    else
                    {
                        teax = new SFSObject();
                        teax.PutInt("idx", idxIndex);
                        idxIndex++;
                    }
                    teax.PutInt("seat", seat);
                    teax.PutInt("gold", winGold);
                    teax.PutBool("isGiveUp", false);
                    teax.PutIntArray("cardArr", playerData.GetIntArray("cardArr"));

                    ////赢家拿钱
                    var teaxIndex = teax.GetInt("idx");
                    var wins      = ResultData.ContainsKey(teaxIndex) ? ResultData[teaxIndex] : new List <ISFSObject>();
                    wins.Add(teax);
                    ResultData[teaxIndex] = wins;
                }

                if (HistoryResultMgr != null)
                {
                    if (response.ContainsKey("curTime"))
                    {
                        HistoryResultMgr.SetHistoryItemTime(response.GetUtfString("curTime"));
                    }
                    HistoryResultMgr.GetHistoryInfo(response);         //获取战绩信息
                }

                BeginResult();
                if (TotalScoreView != null)
                {
                    TotalScoreView.OnGetGameResultInfo(response);
                }
            }
            break;

            case GameRequestType.Speaker:
                var speakCd = response.GetInt("cd");
                gdata.SpeakCd = speakCd;
                StartCoroutine(Speaker(response.GetInt("speaker"), speakCd));
                break;

            case GameRequestType.SetGold:

                var setPlayer = gdata.GetPlayer <PlayerPanel>(response.GetInt("seat"), true);
                var gold      = response.GetInt(RequestKey.KeyGold);
                setPlayer.Coin    -= gold - setPlayer.RoomCoin;
                setPlayer.RoomCoin = gold;
                break;

            case GameRequestType.AllowReady:
                gdata.GStatus     = YxEGameStatus.Normal;
                gdata.IsGameStart = false;
                //清空准备列表开始接收准备信息
                //如果仍在结算则提前结算完成
                {
                    if (IsResultDone)
                    {
                        ResultDone();
                    }
                    var playerList  = gdata.PlayerList;
                    var playerCount = playerList.Length;
                    for (var i = 0; i < playerCount; i++)
                    {
                        var player = gdata.GetPlayer <PlayerPanel>(i);
                        if (player.Info != null && player.RoomCoin <= 0)
                        {
                            player.ReadyState = false;
                        }
                    }

                    CheckSelfGold();
                }
                break;

            default:
                YxDebug.Log("不存在的服务器交互!");
                break;
            }
        }
예제 #11
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            YxDebug.Log("Request == " + (GameRequestType)type);
            var gdata = App.GetGameData <FillpitGameData>();

            if (response.ContainsKey("anteRate"))
            {
                YxDebug.Log("===============================");
                YxDebug.LogArray(response.GetIntArray("anteRate"));
                BetMgr.SetAddBtns(response.GetIntArray("anteRate"));
            }

            if (!App.GetRServer <FillpitGameServer>().HasGetGameInfo)
            {
                return;
            }

            GameRequestType gameType = (GameRequestType)type;
            int             selfSeat = gdata.SelfSeat;

            switch (gameType)
            {
            case GameRequestType.Bet:

                //当存在users时,说明下盲注,这个名游戏已经开始
                if (response.ContainsKey("users"))
                {
                    OnBetBlinds(response);
                    //投盲注,如果烂底,盲注值为0
                    gdata.IsLanDi = response.ContainsKey("landi") && response.GetBool("landi");
                }

                if (response.ContainsKey("banker"))
                {
                    var banker   = response.GetInt("banker");
                    var betPanel = GetPlayerPanel(banker, true);
                    betPanel.SetBankIcon(true);
                }

                //此为某个玩家下注
                if (response.ContainsKey("seat"))
                {
                    int betGold = response.GetInt("gold");
                    int betseat = response.GetInt("seat");

                    gdata.LastBetValue = betGold;

                    var betPanel = GetPlayerPanel(betseat, true);
                    betPanel.PlayerBet(betGold, true, 200);
                    betPanel.ShowGameType(gameType);
                    if (response.ContainsKey("speakerType"))
                    {
                        betPanel.Speak((GameRequestType)response.GetInt("speakerType"), betGold);
                    }

                    LaddyMgr.OnPlayerBet(betGold);

                    if (betseat == selfSeat)
                    {
                        SpeakMgr.ShowNothing();
                    }
                }


                break;

            case GameRequestType.BetSpeak:
                int bseat = response.GetInt("seat");       //当前座位号
                Speaker(bseat, response.ContainsKey("cd") ? response.GetInt("cd") : 30f, GameRequestType.BetSpeak);
                break;

            case GameRequestType.Card:

                HideAllPalyerGameType(false);

                int[] cardSeats = response.GetIntArray("seats");
                DealerMgr.FirstSeat = response.GetInt("fs");

                int curCard = response.GetInt("curCardRound");
                LaddyMgr.OnDealCard(curCard);

                //新游戏开始,第一轮发牌带上隐藏牌
                if (curCard == 1)
                {
                    var count = DealerMgr.HideN;
                    for (int i = 0; i < count; i++)
                    {
                        int[] pokers = new int[cardSeats.Length];
                        DealerMgr.BeginBigDeal(pokers, cardSeats);
                    }
                }

                //如果存在私人牌,则将牌赋值到对应手牌处
                if (response.ContainsKey("selfCard") && response.GetIntArray("selfCard").Length >= 0)
                {
                    int[] selfCards = response.GetIntArray("selfCard");
                    YxDebug.LogArray(selfCards);
                    GetPlayerPanel().UserBetPoker.SetHandPokersValue(selfCards);
                }

                //将每个玩家明牌点数显示出来
                if (response.ContainsKey("openCV"))
                {
                    int seatCount          = cardSeats.Length;
                    var openCardValueArray = response.GetIntArray("openCV");
                    int openMax            = -1;
                    foreach (var openVal in openCardValueArray)
                    {
                        if (openMax < openVal)
                        {
                            openMax = openVal;
                        }
                    }
                    int arrayLength = openCardValueArray.Length;
                    for (int i = 0; i < arrayLength; i++)
                    {
                        int cvSeat  = cardSeats[i % seatCount];
                        int openVal = openCardValueArray[i];
                        var panel   = GetPlayerPanel(cvSeat, true);
                        panel.SetShownCardsPoint(openVal);
                        panel.SetMaxPoint(openMax);
                        panel.ShowPointLabel();
                    }
                }

                if (response.ContainsKey("selfCV"))
                {
                    gdata.GetPlayer <PlayerPanel>().SetAllCardPoint(response.GetInt("selfCV"));
                }

                //是否有公共牌,如果有,说明牌数少于在座人数
                //公共牌用于发给其余多的人
                if (response.ContainsKey("publicCard"))
                {
                    DealerMgr.PublicCardId = response.GetInt("publicCard");
                }

                if (response.ContainsKey("cardsArr"))
                {
                    ISFSArray cardsArray = response.GetSFSArray("cardsArr");
                    int       arraycount = cardsArray.Count;
                    for (int i = 0; i < arraycount; i++)
                    {
                        DealerMgr.BeginBigDeal(cardsArray.GetIntArray(i), cardSeats);
                    }
                }
                else
                {
                    DealerMgr.BeginBigDeal(response.GetIntArray("cards"), cardSeats);       //当有selfCard时,要将发牌重置到从第0张发
                }

                HideAllPalyerGameType(false);
                gdata.LastBetValue = 0;          //将最后一次下注重置,避免下次跟注时出现问题
                break;

            case GameRequestType.Fold:
                int foldSeat = response.GetInt("seat");
                YxClockManager.StopWaitPlayer();
                var foldPanel = GetPlayerPanel(foldSeat, true);
                foldPanel.Speak(GameRequestType.Fold);

                if (foldSeat == selfSeat)
                {
                    SpeakMgr.ShowNothing();
                }
                YxDebug.Log("玩家 " + foldSeat + " 弃牌!!");
                break;

            case GameRequestType.FollowSpeak:       //  跟注
                int followSeat = response.GetInt("seat");

                Speaker(followSeat, response.ContainsKey("cd") ? response.GetInt("cd") : 30f, gdata.LastBetValue > 0
                                ? GameRequestType.FollowSpeak
                                : GameRequestType.BetSpeak);
                var followPanel = GetPlayerPanel(followSeat, true);
                followPanel.HideGameType();
                break;


            case GameRequestType.KickSpeak:
                int kickSeat = response.GetInt("seat");
                Speaker(kickSeat, response.ContainsKey("cd") ? response.GetInt("cd") : 30f,
                        GameRequestType.KickSpeak);
                break;

            case GameRequestType.NotKick:

                int notKickSeat = response.GetInt("seat");
                YxClockManager.StopWaitPlayer();
                var notkickspeaker = gdata.GetPlayer <PlayerPanel>(notKickSeat, true);
                notkickspeaker.Speak(GameRequestType.NotKick);

                if (notKickSeat == selfSeat)
                {
                    SpeakMgr.ShowNothing();
                }
                break;

            case GameRequestType.Result:
                DealerMgr.FastDeal();          //把堆积的牌全部发出去
                gdata.IsGameing = false;
                if (response.ContainsKey("result"))
                {
                    YxClockManager.StopWaitPlayer();
                    bool isLandi = response.ContainsKey("landi") && response.GetBool("landi");
                    gdata.IsLanDi = isLandi;
                    AnimationMgr.SetResultLanDiAnim(isLandi);

                    HideAllPalyerGameType(true);

                    ISFSArray resultArray = response.GetSFSArray("result");
                    ShowPlayerCardsPoint(resultArray);
                    //是否是烂底
                    //如果烂底,直接显示结算结果,否则显示胜利动画
                    if (!isLandi)
                    {
                        ShowWinAnim(resultArray);
                    }
                    else
                    {
                        LaddyMgr.DeductHappys();
                    }
                    SummaryMgr.OnGameResult(resultArray);


                    //初始化玩家游戏币
                    foreach (ISFSObject resultItem in resultArray)
                    {
                        int resultSeat  = resultItem.GetInt("seat");
                        var resultPanel = GetPlayerPanel(resultSeat, true);
                        resultPanel.OnGameResult(resultItem);
                    }
                }

                break;


            case GameRequestType.BackKick:

                int backKickSeat = response.GetInt("seat");

                Speaker(backKickSeat, response.ContainsKey("cd") ? response.GetInt("cd") : 30f,
                        GameRequestType.BackKick);
                break;

            case GameRequestType.StartGame:
                //开始游戏,服务器标记本房间已经开始游戏,所以本机必须发送ready
                //为防止本机出现显示数据异常,以服务器信息为准
                if (response.ContainsKey("isStart") && response.GetBool("isStart"))
                {
                    App.GetRServer <FillpitGameServer>().ReadyGame();
                    WeiChatInvite.SetWeiChatBtnActive(false);
                }
                break;
            }
        }