Ejemplo n.º 1
0
        public void FreshWaitBankerList()
        {
            var freshBankers = new List <IRecycleData>();
            var oldBankers   = WaitBankers.ConvertAll(item => item as NbjlPlayerInfo);

            foreach (var waitBanker in oldBankers)
            {
                if (waitBanker != null)
                {
                    var getPlayer = RoundPlayers.Find(player => player != null && waitBanker.Seat == player.Seat);
                    if (getPlayer != null)
                    {
                        freshBankers.Add(getPlayer);
                    }
                }
            }
            WaitBankers = freshBankers.ToList();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得庄相关信息
        /// </summary>
        /// <param name="data"></param>
        public void GetBanerInfos(ISFSObject data)
        {
            var bankersData   = data.GetSFSArray(ConstantData.KeyBankers);
            var newBankerSeat = data.GetInt(ConstantData.KeyBankerSeat);

            BankerInfo    = null;
            IsApplyBanker = false;
            BankerSeat    = newBankerSeat;
            if (bankersData.Count == 0)
            {
                WaitBankerListChange = WaitBankers.Count != 0;
                WaitBankers          = new List <IRecycleData>();
            }
            else
            {
                var newWaitList   = new List <NbjlPlayerInfo>();
                var changeBankers = new List <NbjlPlayerInfo>();
                foreach (ISFSObject banker in bankersData)
                {
                    var user = new NbjlPlayerInfo();
                    user.Parse(banker);
                    var seat = user.Seat;
                    if (seat == SelfSeat)
                    {
                        IsApplyBanker = true;
                    }
                    changeBankers.Add(user);
                    if (seat == BankerSeat)
                    {
                        continue;
                    }
                    newWaitList.Add(user);
                }
                var changeCount = changeBankers.Count;
                if (changeCount > 0)
                {
                    var playerCount = Players.Count;
                    for (int i = 0; i < changeCount; i++)
                    {
                        var playerIndex = Players.FindIndex(item => (item != null && item.Seat == changeBankers[i].Seat));
                        if (playerIndex >= 0)
                        {
                            Players[playerIndex].CoinA = changeBankers[i].CoinA;
                        }
                    }
                }
                var oldWaitBankers = WaitBankers.ConvertAll(item => item as NbjlPlayerInfo);
                WaitBankerListChange = oldWaitBankers.Count != newWaitList.Count;
                if (!WaitBankerListChange)
                {
                    var count = oldWaitBankers.Count;
                    var state = false;
                    for (int i = 0; i < count; i++)
                    {
                        var oldItem = oldWaitBankers[i];
                        var newItem = newWaitList[i];
                        if (newItem.Seat != oldItem.Seat || newItem.NickM != oldItem.NickM || newItem.CoinA != oldItem.CoinA)
                        {
                            state = true;
                            break;
                        }
                    }
                    WaitBankerListChange = state;
                }
                if (WaitBankerListChange)
                {
                    WaitBankers = newWaitList.ConvertAll(item => item as IRecycleData);
                }
            }
            if (BankerSeat != ConstantData.KeyDefaultInt)
            {
                RoundPlayersFresh();
            }
            IsOnBanker = BankerInfo != null && BankerInfo.Seat.Equals(SelfSeat);
            if (IsOnBanker)
            {
                App.GameData.GStatus = YxEGameStatus.PlayAndConfine;
                IsApplyBanker        = true;
            }
        }