Example #1
0
        void OnPlayerActionNeeded(object sender, PlayerInfoEventArgs e)
        {
            if (InvokeRequired)
            {
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new EventHandler <PlayerInfoEventArgs>(OnPlayerActionNeeded), new[] { sender, e });
                return;
            }
            var p     = e.Player;
            var table = m_Game.Table;

            if (p.NoSeat == m_NoSeat)
            {
                if (m_Game.Table.CanFold)
                {
                    EnableButton(btnFold);
                }
                SetCallButtonName(p);
                EnableButton(btnCall);
                if (table.HigherBet < p.MoneyAmnt)
                {
                    var min = table.MinRaiseAmnt(p) + p.MoneyBetAmnt;
                    EnableButton(btnRaise);
                    nudRaise.Enabled   = true;
                    nudRaise.Minimum   = min;
                    nudRaise.Maximum   = p.MoneyAmnt;
                    nudRaise.Value     = min;
                    nudRaise.Increment = table.MinimumRaiseAmount;
                }
            }
        }
Example #2
0
        void OnPlayerHoleCardsChanged(object sender, PlayerInfoEventArgs e)
        {
            var p = e.Player;

            Send(new PlayerHoleCardsChangedCommand()
            {
                NoSeat        = p.NoSeat,
                PlayerState   = p.State,
                FaceDownCards = p.NoSeat == Player.NoSeat ? p.FaceDownCards : p.FaceDownCards.Select(x => "??").ToArray(),
                FaceUpCards   = p.FaceUpCards
            });
        }
Example #3
0
        void OnPlayerHoleCardsChanged_Console(object sender, PlayerInfoEventArgs e)
        {
            if (InvokeRequired)
            {
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new EventHandler <PlayerInfoEventArgs>(OnPlayerHoleCardsChanged_Console), new[] { sender, e });
                return;
            }
            var p = e.Player;

            if (p.Cards.Any() && ConvertToGameCard(p.Cards[0]).Id >= 0)
            {
                WriteLine("==> Hole Card changed for " + p.Name + ": " + string.Join(" ", p.Cards));
            }
        }
Example #4
0
        void OnPlayerJoined(object sender, PlayerInfoEventArgs e)
        {
            var p = e.Player;

            if (p != Player)
            {
                Send(new GameMessageCommand
                {
                    Info = new GameMessageOptionPlayerJoined
                    {
                        PlayerName = p.Name
                    }
                });
            }
        }
Example #5
0
        void OnPlayerActionNeeded(object sender, PlayerInfoEventArgs e)
        {
            if (InvokeRequired)
            {
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new EventHandler <PlayerInfoEventArgs>(OnPlayerActionNeeded), new[] { sender, e });
                return;
            }
            SuspendLayout();
            var p   = e.Player;
            var php = m_Huds[p.NoSeat];

            php.DoAction(GameActionEnum.DoNothing);
            php.SetPlaying();
            ResumeLayout();
        }
Example #6
0
        void OnPlayerHoleCardsChanged(object sender, PlayerInfoEventArgs e)
        {
            if (InvokeRequired)
            {
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new EventHandler <PlayerInfoEventArgs>(OnPlayerHoleCardsChanged), new[] { sender, e });
                return;
            }
            SuspendLayout();
            var p   = e.Player;
            var php = m_Huds[p.NoSeat];

            if (p.Cards.Any())
            {
                php.SetCards(p.Cards.Select(ConvertToGameCard).ToArray());
            }
            else
            {
                php.SetCards(null, null);
            }
            ResumeLayout();
        }
Example #7
0
        private static bool OnPlayerInfo(byte _plrid, byte _hair, int _style, byte _difficulty, string _name)
        {
            if (PlayerInfo == null)
                return false;

            var args = new PlayerInfoEventArgs
            {
                PlayerId = _plrid,
                Hair = _hair,
                Style = _style,
                Difficulty = _difficulty,
                Name = _name,
            };
            PlayerInfo.Invoke(null, args);
            return args.Handled;
        }