示例#1
0
        public WindowTimer(Table table)
        {
            Table = table;
            InitializeComponent();

            // drag by right mouse click
            System.Windows.Point startPosition = new System.Windows.Point();
            PreviewMouseRightButtonDown += (sender, e) =>
            {
                startPosition = e.GetPosition(this);
            };
            PreviewMouseMove += (sender, e) =>
            {
                if (!Config.HudTimerLocationLocked && e.RightButton == MouseButtonState.Pressed)
                {
                    System.Windows.Point endPosition = e.GetPosition(this);
                    Vector vector = endPosition - startPosition;
                    Left += vector.X;
                    Top += vector.Y;

                    Rectangle cr = WinApi.GetClientRectangle(Table.Handle);
                    double x = (Left - cr.Left) / cr.Width;
                    double y = (Top - cr.Top) / cr.Height;
                    Config.HudTimerLocationsX[(int)Table.TableHud.TableSize] = (float)x;
                    Config.HudTimerLocationsY[(int)Table.TableHud.TableSize] = (float)y;
                }
            };
        }
示例#2
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     Amount = Player.PutChipsInTotal(AmountInTotal);
 }
示例#3
0
 public override void Undo(Table table)
 {
     base.Undo(table);
     Player.UnFold();
 }
示例#4
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     Player.Fold();
 }
示例#5
0
 public virtual void Exec(Table table)
 {
     table.Log("[Do] " + CommandText);
 }
示例#6
0
 public override void Undo(Table table)
 {
     base.Undo(table);
     Player.PutChips(Amount);
 }
示例#7
0
 public override void Undo(Table table)
 {
     base.Undo(table);
     table.CommunityCards[3] = null;
 }
示例#8
0
 public override void Undo(Table table)
 {
     base.Undo(table);
     Player.ArePocketCardsOpenfaced = false;
 }
示例#9
0
            public override void Exec(Table table)
            {
                while (table.Players.Any(o => o.Bet != 0))
                {
                    decimal amount = 0;
                    decimal bet = table.Players.Where(p => p.Bet > 0).Min(p => p.Bet);
                    var players = new List<Player>();
                    foreach (var player in table.Players)
                    {
                        if (player.Bet >= bet)
                        {
                            player.Bet -= bet;
                            amount += bet;
                            players.Add(player);
                        }
                    }
                    var pot = new Pot(players, amount, Street);
                    Pots.Add(pot);
                }

                table.Pots.AddRange(Pots);
            }
示例#10
0
 public override void Undo(Table table)
 {
     base.Undo(table);
     Player.CollectChipsFromPot(-Amount);
 }
示例#11
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     Player.CollectChipsFromPot(Amount);
 }
示例#12
0
 public override void Undo(Table table)
 {
     base.Undo(table);
 }
示例#13
0
 public override void Exec(Table table)
 {
     base.Exec(table);
 }
示例#14
0
 public virtual void Undo(Table table)
 {
     table.Log("[Undo] " + CommandText);
 }
示例#15
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     table.CommunityCards[4] = RiverCard;
 }
示例#16
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     Player.ArePocketCardsOpenfaced = true;
 }
示例#17
0
            public override void Undo(Table table)
            {
                foreach (var pot in Pots)
                {
                    decimal amountPerPlayer = pot.Amount / pot.Players.Count;
                    foreach (var player in pot.Players)
                    {
                        player.Bet += amountPerPlayer;
                    }
                }

                foreach (var pot in Pots)
                {
                    table.Pots.Remove(pot);
                }
                Pots.Clear();
            }
示例#18
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     table.CommunityCards[3] = TurnCard;
 }
示例#19
0
            public override void Exec(Table table)
            {
                var finalizedPots = new List<Pot>();
                var finalizedPotsSbs = new List<Pot>();
                foreach (var pot in table.Pots)
                {
                    var findPot = finalizedPots.FirstOrDefault(o => pot.Players.Where(player => player.IsInPlay).All(player => o.Players.Contains(player)) && o.Players.Count == pot.Players.Count(player => player.IsInPlay));
                    var findPotSbs = finalizedPotsSbs.FirstOrDefault(o => pot.Players.Where(player => player.IsInPlay).All(player => o.Players.Contains(player)) && o.Players.Count == pot.Players.Count(player => player.IsInPlay) && o.Street == pot.Street);
                    if (findPot == null)
                    {
                        findPot = new Pot(pot.Players.Where(player => player.IsInPlay).ToList(), 0, Street.Unknown);
                        finalizedPots.Add(findPot);
                    }
                    if (findPotSbs == null)
                    {
                        findPotSbs = new Pot(pot.Players.Where(player => player.IsInPlay).ToList(), 0, pot.Street);
                        finalizedPotsSbs.Add(findPotSbs);
                    }
                    findPot.Amount += pot.Amount;
                    findPotSbs.Amount += pot.Amount;
                }

                Pots = table.Pots;
                PotsStreetByStreet = table.PotsStreetByStreet;
                table.Pots = finalizedPots;
                table.PotsStreetByStreet = finalizedPotsSbs;
                table.TotalPotBeforeCollection = Pots.Sum(o => o.Amount);
            }
示例#20
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     Player.PutChips(-Amount);
 }
示例#21
0
 public override void Undo(Table table)
 {
     table.Pots = Pots;
     table.PotsStreetByStreet = PotsStreetByStreet;
     table.TotalPotBeforeCollection = 0;
 }
示例#22
0
 public override void Exec(Table table)
 {
     base.Exec(table);
     table.CommunityCards[0] = FlopCards[0];
     table.CommunityCards[1] = FlopCards[1];
     table.CommunityCards[2] = FlopCards[2];
 }
示例#23
0
        public TableHud(Table table)
        {
            #region Init Windows

            Methods.UiInvoke(() =>
            {
                Table = table;
                WindowTimer = new WindowTimer(Table);
                WindowTimer.Opacity = 0;
                WindowTimer.Show();
                for (int i = 0; i < 10; i++)
                {
                    WindowsBigBlind[i] = new WindowBigBlind(Table, i);
                    WindowsBigBlind[i].Opacity = 0;
                    WindowsBigBlind[i].Show();
                }
            });

            #endregion

            _thread = new Thread(() =>
            {
                try
                {
                    while (true)
                    {
                        #region Calculate Timer / BigBlinds

                        string title = Table.Title, className = Table.ClassName;
                        long tournamentNumber;
                        decimal sb, bb, ante;

                        string timerValue = null;
                        bool timerVisibility = false;
                        decimal[] bbValue = new decimal[10];
                        bool[] bbVisibility = new bool[10];
                        bool[] bbIsHero = new bool[10];
                        string[] bbTooltip = new string[10];

                        var success = GetInfo(title, out sb, out bb, out ante, out tournamentNumber);
                        if (success)
                        {
                            var tournament = App.HandHistoryManager.GetTournament(tournamentNumber);
                            if (tournament != null)
                            {
                                TableSize = tournament.GetLastHandTableSize();
                                GetContentTimer(title, className, tournament, sb, bb, out timerValue, out timerVisibility);
                                GetContentBigBlind(tournament, sb, bb, ante, out bbValue, out bbVisibility, out bbIsHero, out bbTooltip);
                            }
                        }

                        #endregion

                        #region Update Timer / BigBlinds

                        Methods.UiInvoke(() =>
                        {
                            try // to eliminate that stupid UpdateView null reference problem..
                            {
                                // Update View
                                WindowTimer.UpdateView(timerValue, PokerType != null ? PokerType.Name : "Unknown");
                                for (int i = 0; i < 10; i++)
                                {
                                    WindowsBigBlind[i].UpdateView(i, bbValue[i], bbTooltip[i], bbIsHero[i]);
                                }

                                // Ensure visibility
                                WindowTimer.EnsureVisibility(timerVisibility);
                                for (int i = 0; i < 10; i++)
                                {
                                    WindowsBigBlind[i].EnsureVisibility(bbVisibility[i] && ((!bbIsHero[i] && Config.HudBigBlindShowForOpponents) || (bbIsHero[i] && Config.HudBigBlindShowForHero)));
                                }
                            }
                            catch
                            {
                            }
                        });

                        #endregion

                        Thread.Sleep(500);
                    }
                }
            #if (DEBUG)
                catch (ThreadInterruptedException)
                {
                }
            #else
                catch (Exception e)
                {
                    if (!(e is ThreadInterruptedException))
                    {
                        Methods.DisplayException(e, App.WindowMain, WindowStartupLocation.CenterOwner);
                    }
                }
            #endif
                finally
                {
                    #region Dispose Windows

                    Methods.UiInvoke(() =>
                    {
                        WindowTimer.Close();
                        for (int i = 0; i < 10; i++)
                        {
                            WindowsBigBlind[i].Close();
                        }
                    });

                    #endregion
                }
            });
            _thread.Start();
        }