Ejemplo n.º 1
0
        public void DisplayAndUpdate()
        {
            bool setupInitialWindowPositions = false; //Default

            // Do we have user specified positions?
            List <Point> positions = settings.RetrieveHudWindowPositions(table.PokerClientName, table.MaxSeatingCapacity, table.GameType);

            if (positions.Count > 0)
            {
                if (table.PlayerSeatingPositionIsRelative)
                {
                    positions = GetEffectivePositions(positions, table.PlayerList, table.CurrentHeroName, table.MaxSeatingCapacity);
                }
                Trace.Assert(positions.Count == table.MaxSeatingCapacity, "The number of available user defined hud positions is different that what we expected");
            }
            else
            {
                // We don't

                // The first time we'll need to setup the initial position of the windows
                setupInitialWindowPositions = true;
            }

            // Check for windows that have been set to be destroyed
            DisposeFlaggedWindows();

            // Now we're ready

            /* Check each player:
             * If the player doesn't have a hud window and is playing, create a window for him
             */
            foreach (Player p in table.PlayerList)
            {
                // Create window
                if (p.HudWindow == null && p.IsPlaying)
                {
                    HudWindow window = HudWindowFactory.CreateHudWindow(table);

                    Trace.WriteLine("Create window for " + p.Name + " (" + p.SeatNumber + ")");

                    // We set a 1:1 association between the player and the HudWindow
                    p.HudWindow = window;

                    window.RegisterHandlers(this, table, p);

                    windowsList.Add(window);
                    window.Show(); // Without this we cannot move the windows


                    // Move it to its proper location (if available)
                    if (positions.Count > 0)
                    {
                        window.SetAbsolutePosition(positions[p.SeatNumber - 1], table.WindowRect);
                    }
                }
            }

            if (setupInitialWindowPositions)
            {
                SetupHudInitialPosition();
            }

            UpdateHudData();

            table.PostHudDisplayAction();
        }