Ejemplo n.º 1
0
        public void PlayChips(NbjlPlayer sender, BetArea area, List <ChipData> chipDatas, int gold, bool selfBet)
        {
            List <YxView> items   = new List <YxView>();
            var           index   = _pos.FindIndex(item => item == area.AreaType);
            var           posName = _posName[index];

            foreach (ChipData chipData in chipDatas)
            {
                var view = AddChildToShow(chipData);

                TweenFromTo(view, sender.ChipPosVec, area.ChipPosVec, GetRandomTime());
                sender.ShowBet(posName, chipData.Value);
                items.Add(view);
            }
            area.Items.AddRange(items);
            if (selfBet)
            {
                area.ShowBetNum(gold, gold);
                if (_selfInRank)
                {
                    if (SelfPlayer)
                    {
                        SelfPlayer.FreshCoinA();
                    }
                }
            }
            else
            {
                area.ShowBetNum(gold, 0);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 玩家下注
        /// </summary>
        /// <param name="data"></param>
        private void OnPlayerBet(BetData data)
        {
            var        gold       = data.Gold;
            var        selfGold   = 0;
            var        chipDatas  = GetChipDatas(gold);
            var        position   = data.Position;
            var        seat       = data.Seat;
            var        areaCount  = BetAreas.Length;
            NbjlPlayer sendPlayer = null;
            BetArea    getArea    = null;
            bool       selfBet    = seat == App.GameData.SelfSeat;

            for (int i = 0; i < areaCount; i++)
            {
                BetArea area = BetAreas[i];
                if (area.AreaType == position)
                {
                    getArea = BetAreas[i];
                }
            }
            foreach (var player in ShowPlayers)
            {
                if (!player.gameObject.activeInHierarchy)
                {
                    continue;
                }
                if (player.Info != null)
                {
                    if (player.Info.Seat.Equals(seat))
                    {
                        sendPlayer = player;
                    }
                }
            }
            if (selfBet && sendPlayer == null)
            {
                App.GameData.GStatus = YxEGameStatus.PlayAndConfine;
                App.GameData.GetPlayerInfo().CoinA -= gold;
                sendPlayer = SelfPlayer;
            }
            if (sendPlayer == null)
            {
                sendPlayer = OtherPlayer;
            }
            PlayChips(sendPlayer, getArea, chipDatas, gold, selfBet);
        }