Esempio n. 1
0
        public void EnqueueCardInfo(BjPlayerPanel panel, int[] cards)
        {
            int len = cards.Length;

            for (int i = 0; i < len; i++)
            {
                EnqueueCardInfo(panel, cards[i]);
            }
        }
Esempio n. 2
0
 public void DealPokerNoAnim(BjPlayerPanel panel, int[] cards)
 {
     foreach (int v in cards)
     {
         panel.CardsId[panel.PokerCount] = v;
         DealOnePokerNoAnim(panel.GetPokerTran, v, panel.PokerCount);
     }
     panel.CheckCardPoint();
 }
Esempio n. 3
0
        //public ClockCD ClockCd;

        /// <summary>
        /// 初始化用户信息
        /// </summary>
        /// <param name="gameInfo"></param>
        public void InitUser(ISFSObject gameInfo)
        {
            var gdata = App.GetGameData <BlackJackGameData>();

            //初始化自己的信息
            if (gameInfo.ContainsKey("user"))
            {
                ISFSObject selfInfo = gameInfo.GetSFSObject(RequestKey.KeyUser);

                SelfSeat   = selfInfo.GetInt(RequestKey.KeySeat);
                SelfPlayer = gdata.GetPlayer <BjPlayerPanel>(SelfSeat, true);

                SelfPlayer.NameLabel.Color = Color.yellow;



                bool isGaming = gdata.IsGameing;
                bool isReady  = selfInfo.GetBool("state");
                SelfPlayer.SetReadyBtnActive(!isGaming && !isReady);
                SelfPlayer.SetReadyMarkActive(!isGaming && isReady);
            }


            //初始化其他玩家信息
            if (gameInfo.ContainsKey("users"))
            {
                //初始化每个玩家的信息
                ISFSArray users = gameInfo.GetSFSArray(RequestKey.KeyUserList);
                foreach (ISFSObject user in users)
                {
                    int seat         = user.GetInt(RequestKey.KeySeat);
                    var someonePanel = gdata.GetPlayer <BjPlayerPanel>(seat, true);

                    someonePanel.gameObject.SetActive(true);
                    someonePanel.SetReadyBtnActive(false);                                                                            //隐藏其他玩家的准备按钮
                    someonePanel.SetReadyMarkActive(user.GetBool("state") && !user.ContainsKey("bet") && !user.ContainsKey("cards")); //设置玩家的准备状态

                    if (user.ContainsKey("bet"))
                    {
                        someonePanel.BetMoney = user.GetInt("bet");
                    }

                    if (user.ContainsKey("cards"))
                    {
                        int[] cards = user.GetIntArray("cards");
                        DealPokerMgr.DealPokerNoAnim(seat, cards);
                    }
                }

                if (gameInfo.ContainsKey("bankcards"))
                {
                    int[] bankCards = gameInfo.GetIntArray("bankcards");
                    DealPokerMgr.DealPokerNoAnim(gdata.BjBankerBanker, bankCards);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 发牌协程
        /// </summary>
        /// <returns></returns>
        // ReSharper disable once FunctionRecursiveOnAllPaths
        IEnumerator BegintoDeal()
        {
            _isDealing = true;
            //var gdata = App.GameData;
            while (_pokers.Count > 0)
            {
                BjPlayerPanel panel   = _dealPanels.Dequeue(); //gdata.GetPlayer<BjPlayerPanel>(_seats.Dequeue(), true);   // blackjackGameManager.GetInstance().BjSeatSort[_seats.Dequeue()];
                int           pokerId = _pokers.Dequeue();
                int           index   = panel.PokerCount;
                panel.CardsId[index] = panel.CardsId[index] > 0 ? panel.CardsId[index] : pokerId;
                GameObject gob = DoDealOnePokerWithAnim(BrithTran,
                                                        panel.GetPokerTran,
                                                        index, index, panel.CardsId[index]);
                _pokerList.Add(gob);
                gob.GetComponent <PokerCard>().Owner = panel;
                yield return(new WaitForSeconds(0.3f));
            }

            _isDealing = false;
        }
Esempio n. 5
0
 public void EnqueueCardInfo(BjPlayerPanel panel, int card)
 {
     _dealPanels.Enqueue(panel);
     _pokers.Enqueue(card);
 }