Ejemplo n.º 1
0
        /* In this method we take care of updating UI information
         * about this table */
        private void UpdateUI()
        {
            Trace.WriteLine("Refresh UI for " + GameID);

            Globals.Director.OnDisplayStatus("Displaying Table #" + TableId);

            // Flag to keep track of whether at least one mucked hand is available
            bool muckedHandsAvailable = false;

            // Check which players have shown their cards
            List <Player> showdownPlayers = new List <Player>();

            foreach (Player p in PlayerList)
            {
                // If it has showed and it's not us
                if (p.HasShowedThisRound && p.Name != CurrentHeroName)
                {
                    showdownPlayers.Add(p);
                    muckedHandsAvailable = true;
                }
            }

            if (muckedHandsAvailable)
            {
                Globals.Director.RunFromGUIThread(
                    (Action) delegate()
                {
                    if (DisplayWindow != null)
                    {
                        DisplayWindow.ClearMuck();
                    }
                }, false
                    );

                foreach (Player p in showdownPlayers)
                {
                    Globals.Director.RunFromGUIThread(
                        (Action) delegate()
                    {
                        if (DisplayWindow != null)
                        {
                            DisplayWindow.DisplayPlayerMuckedHand(p.Name, p.MuckedHand);
                        }
                    }, false
                        );
                }

                if (FinalBoard != null && !FinalBoard.Displayed)
                {
                    Globals.Director.RunFromGUIThread(
                        (Action) delegate()
                    {
                        if (DisplayWindow != null)
                        {
                            DisplayWindow.DisplayFinalBoard(FinalBoard);
                        }
                    }, false
                        );
                    FinalBoard.Displayed = true;
                }
            }


            Globals.Director.RunFromGUIThread(
                (Action) delegate()
            {
                // Display hud information
                if (Hud != null)
                {
                    Hud.DisplayAndUpdate();
                }

                // Update statistics
                if (DisplayWindow != null)
                {
                    DisplayWindow.UpdateStatistics();
                }
            }, true
                );
        }