Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the main menu's controls.
        /// </summary>
        public override void Initialize()
        {
            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;

            Name = nameof(MainMenu);
            BackgroundTexture = AssetLoader.LoadTexture("MainMenu/mainmenubg.png");
            ClientRectangle   = new Rectangle(0, 0, BackgroundTexture.Width, BackgroundTexture.Height);

            WindowManager.CenterControlOnScreen(this);

            btnNewCampaign                  = new XNAClientButton(WindowManager);
            btnNewCampaign.Name             = nameof(btnNewCampaign);
            btnNewCampaign.IdleTexture      = AssetLoader.LoadTexture("MainMenu/campaign.png");
            btnNewCampaign.HoverTexture     = AssetLoader.LoadTexture("MainMenu/campaign_c.png");
            btnNewCampaign.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnNewCampaign.LeftClick       += BtnNewCampaign_LeftClick;

            btnLoadGame                  = new XNAClientButton(WindowManager);
            btnLoadGame.Name             = nameof(btnLoadGame);
            btnLoadGame.IdleTexture      = AssetLoader.LoadTexture("MainMenu/loadmission.png");
            btnLoadGame.HoverTexture     = AssetLoader.LoadTexture("MainMenu/loadmission_c.png");
            btnLoadGame.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnLoadGame.LeftClick       += BtnLoadGame_LeftClick;

            btnSkirmish                  = new XNAClientButton(WindowManager);
            btnSkirmish.Name             = nameof(btnSkirmish);
            btnSkirmish.IdleTexture      = AssetLoader.LoadTexture("MainMenu/skirmish.png");
            btnSkirmish.HoverTexture     = AssetLoader.LoadTexture("MainMenu/skirmish_c.png");
            btnSkirmish.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnSkirmish.LeftClick       += BtnSkirmish_LeftClick;

            btnCnCNet                  = new XNAClientButton(WindowManager);
            btnCnCNet.Name             = nameof(btnCnCNet);
            btnCnCNet.IdleTexture      = AssetLoader.LoadTexture("MainMenu/cncnet.png");
            btnCnCNet.HoverTexture     = AssetLoader.LoadTexture("MainMenu/cncnet_c.png");
            btnCnCNet.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnCnCNet.LeftClick       += BtnCnCNet_LeftClick;

            btnLan                  = new XNAClientButton(WindowManager);
            btnLan.Name             = nameof(btnLan);
            btnLan.IdleTexture      = AssetLoader.LoadTexture("MainMenu/lan.png");
            btnLan.HoverTexture     = AssetLoader.LoadTexture("MainMenu/lan_c.png");
            btnLan.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnLan.LeftClick       += BtnLan_LeftClick;

            btnOptions                  = new XNAClientButton(WindowManager);
            btnOptions.Name             = nameof(btnOptions);
            btnOptions.IdleTexture      = AssetLoader.LoadTexture("MainMenu/options.png");
            btnOptions.HoverTexture     = AssetLoader.LoadTexture("MainMenu/options_c.png");
            btnOptions.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnOptions.LeftClick       += BtnOptions_LeftClick;

            btnMapEditor                  = new XNAClientButton(WindowManager);
            btnMapEditor.Name             = nameof(btnMapEditor);
            btnMapEditor.IdleTexture      = AssetLoader.LoadTexture("MainMenu/mapeditor.png");
            btnMapEditor.HoverTexture     = AssetLoader.LoadTexture("MainMenu/mapeditor_c.png");
            btnMapEditor.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnMapEditor.LeftClick       += BtnMapEditor_LeftClick;

            btnStatistics                  = new XNAClientButton(WindowManager);
            btnStatistics.Name             = nameof(btnStatistics);
            btnStatistics.IdleTexture      = AssetLoader.LoadTexture("MainMenu/statistics.png");
            btnStatistics.HoverTexture     = AssetLoader.LoadTexture("MainMenu/statistics_c.png");
            btnStatistics.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnStatistics.LeftClick       += BtnStatistics_LeftClick;

            btnCredits                  = new XNAClientButton(WindowManager);
            btnCredits.Name             = nameof(btnCredits);
            btnCredits.IdleTexture      = AssetLoader.LoadTexture("MainMenu/credits.png");
            btnCredits.HoverTexture     = AssetLoader.LoadTexture("MainMenu/credits_c.png");
            btnCredits.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnCredits.LeftClick       += BtnCredits_LeftClick;

            btnExtras                  = new XNAClientButton(WindowManager);
            btnExtras.Name             = nameof(btnExtras);
            btnExtras.IdleTexture      = AssetLoader.LoadTexture("MainMenu/extras.png");
            btnExtras.HoverTexture     = AssetLoader.LoadTexture("MainMenu/extras_c.png");
            btnExtras.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnExtras.LeftClick       += BtnExtras_LeftClick;

            var btnExit = new XNAClientButton(WindowManager);

            btnExit.Name             = nameof(btnExit);
            btnExit.IdleTexture      = AssetLoader.LoadTexture("MainMenu/exitgame.png");
            btnExit.HoverTexture     = AssetLoader.LoadTexture("MainMenu/exitgame_c.png");
            btnExit.HoverSoundEffect = new EnhancedSoundEffect("MainMenu/button.wav");
            btnExit.LeftClick       += BtnExit_LeftClick;

            XNALabel lblCnCNetStatus = new XNALabel(WindowManager);

            lblCnCNetStatus.Name            = nameof(lblCnCNetStatus);
            lblCnCNetStatus.Text            = "DTA players on CnCNet:";
            lblCnCNetStatus.ClientRectangle = new Rectangle(12, 9, 0, 0);

            lblCnCNetPlayerCount      = new XNALabel(WindowManager);
            lblCnCNetPlayerCount.Name = nameof(lblCnCNetPlayerCount);
            lblCnCNetPlayerCount.Text = "-";

            lblVersion            = new XNALinkLabel(WindowManager);
            lblVersion.Name       = nameof(lblVersion);
            lblVersion.LeftClick += LblVersion_LeftClick;

            lblUpdateStatus                 = new XNALinkLabel(WindowManager);
            lblUpdateStatus.Name            = nameof(lblUpdateStatus);
            lblUpdateStatus.LeftClick      += LblUpdateStatus_LeftClick;
            lblUpdateStatus.ClientRectangle = new Rectangle(0, 0, 160, 20);

            AddChild(btnNewCampaign);
            AddChild(btnLoadGame);
            AddChild(btnSkirmish);
            AddChild(btnCnCNet);
            AddChild(btnLan);
            AddChild(btnOptions);
            AddChild(btnMapEditor);
            AddChild(btnStatistics);
            AddChild(btnCredits);
            AddChild(btnExtras);
            AddChild(btnExit);
            AddChild(lblCnCNetStatus);
            AddChild(lblCnCNetPlayerCount);

            if (!ClientConfiguration.Instance.ModMode)
            {
                // ModMode disables version tracking and the updater if it's enabled

                AddChild(lblVersion);
                AddChild(lblUpdateStatus);

                CUpdater.FileIdentifiersUpdated     += CUpdater_FileIdentifiersUpdated;
                CUpdater.OnCustomComponentsOutdated += CUpdater_OnCustomComponentsOutdated;
            }

            base.Initialize(); // Read control attributes from INI

            innerPanel = new MainMenuDarkeningPanel(WindowManager, discordHandler);
            innerPanel.ClientRectangle = new Rectangle(0, 0,
                                                       Width,
                                                       Height);
            innerPanel.DrawOrder   = int.MaxValue;
            innerPanel.UpdateOrder = int.MaxValue;
            AddChild(innerPanel);
            innerPanel.Hide();

            lblVersion.Text = CUpdater.GameVersion;

            innerPanel.UpdateQueryWindow.UpdateDeclined += UpdateQueryWindow_UpdateDeclined;
            innerPanel.UpdateQueryWindow.UpdateAccepted += UpdateQueryWindow_UpdateAccepted;

            innerPanel.UpdateWindow.UpdateCompleted += UpdateWindow_UpdateCompleted;
            innerPanel.UpdateWindow.UpdateCancelled += UpdateWindow_UpdateCancelled;
            innerPanel.UpdateWindow.UpdateFailed    += UpdateWindow_UpdateFailed;

            this.ClientRectangle = new Rectangle((WindowManager.RenderResolutionX - Width) / 2,
                                                 (WindowManager.RenderResolutionY - Height) / 2,
                                                 Width, Height);
            innerPanel.ClientRectangle = new Rectangle(0, 0,
                                                       Math.Max(WindowManager.RenderResolutionX, Width),
                                                       Math.Max(WindowManager.RenderResolutionY, Height));

            CnCNetPlayerCountTask.CnCNetGameCountUpdated += CnCNetInfoController_CnCNetGameCountUpdated;
            cncnetPlayerCountCancellationSource           = new CancellationTokenSource();
            CnCNetPlayerCountTask.InitializeService(cncnetPlayerCountCancellationSource);

            WindowManager.GameClosing += WindowManager_GameClosing;

            skirmishLobby.Exited         += SkirmishLobby_Exited;
            lanLobby.Exited              += LanLobby_Exited;
            optionsWindow.EnabledChanged += OptionsWindow_EnabledChanged;

            optionsWindow.OnForceUpdate += (s, e) => ForceUpdate();

            GameProcessLogic.GameProcessStarted  += SharedUILogic_GameProcessStarted;
            GameProcessLogic.GameProcessStarting += SharedUILogic_GameProcessStarting;

            UserINISettings.Instance.SettingsSaved += SettingsSaved;

            CUpdater.Restart += CUpdater_Restart;

            SetButtonHotkeys(true);
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            Name                    = "TopBar";
            ClientRectangle         = new Rectangle(0, -39, WindowManager.RenderResolutionX, 39);
            PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            BackgroundTexture       = AssetLoader.CreateTexture(Color.Black, 1, 1);
            DrawBorders             = false;

            btnMainButton                 = new XNAClientButton(WindowManager);
            btnMainButton.Name            = "btnMainButton";
            btnMainButton.ClientRectangle = new Rectangle(12, 9, 160, 23);
            btnMainButton.Text            = "Main Menu (F2)";
            btnMainButton.LeftClick      += BtnMainButton_LeftClick;

            btnCnCNetLobby                 = new XNAClientButton(WindowManager);
            btnCnCNetLobby.Name            = "btnCnCNetLobby";
            btnCnCNetLobby.ClientRectangle = new Rectangle(184, 9, 160, 23);
            btnCnCNetLobby.Text            = "CnCNet Lobby (F3)";
            btnCnCNetLobby.LeftClick      += BtnCnCNetLobby_LeftClick;

            btnPrivateMessages                 = new XNAClientButton(WindowManager);
            btnPrivateMessages.Name            = "btnPrivateMessages";
            btnPrivateMessages.ClientRectangle = new Rectangle(356, 9, 160, 23);
            btnPrivateMessages.Text            = "Private Messages (F4)";
            btnPrivateMessages.LeftClick      += BtnPrivateMessages_LeftClick;

            lblDate                 = new XNALabel(WindowManager);
            lblDate.Name            = "lblDate";
            lblDate.FontIndex       = 1;
            lblDate.Text            = Renderer.GetSafeString(DateTime.Now.ToShortDateString(), lblDate.FontIndex);
            lblDate.ClientRectangle = new Rectangle(Width -
                                                    (int)Renderer.GetTextDimensions(lblDate.Text, lblDate.FontIndex).X - 12, 18,
                                                    lblDate.Width, lblDate.Height);

            lblTime                 = new XNALabel(WindowManager);
            lblTime.Name            = "lblTime";
            lblTime.FontIndex       = 1;
            lblTime.Text            = "99:99:99";
            lblTime.ClientRectangle = new Rectangle(Width -
                                                    (int)Renderer.GetTextDimensions(lblTime.Text, lblTime.FontIndex).X - 12, 4,
                                                    lblTime.Width, lblTime.Height);

            btnLogout                 = new XNAClientButton(WindowManager);
            btnLogout.Name            = "btnLogout";
            btnLogout.ClientRectangle = new Rectangle(lblDate.X - 87, 9, 75, 23);
            btnLogout.FontIndex       = 1;
            btnLogout.Text            = "Log Out";
            btnLogout.AllowClick      = false;
            btnLogout.LeftClick      += BtnLogout_LeftClick;

            btnOptions                 = new XNAClientButton(WindowManager);
            btnOptions.Name            = "btnOptions";
            btnOptions.ClientRectangle = new Rectangle(btnLogout.X - 122, 9, 110, 23);
            btnOptions.Text            = "Options (F12)";
            btnOptions.LeftClick      += BtnOptions_LeftClick;

            lblConnectionStatus           = new XNALabel(WindowManager);
            lblConnectionStatus.Name      = "lblConnectionStatus";
            lblConnectionStatus.FontIndex = 1;
            lblConnectionStatus.Text      = "OFFLINE";

            AddChild(btnMainButton);
            AddChild(btnCnCNetLobby);
            AddChild(btnPrivateMessages);
            AddChild(btnOptions);
            AddChild(lblTime);
            AddChild(lblDate);
            AddChild(btnLogout);
            AddChild(lblConnectionStatus);

            if (ClientConfiguration.Instance.DisplayPlayerCountInTopBar)
            {
                lblCnCNetStatus                      = new XNALabel(WindowManager);
                lblCnCNetStatus.Name                 = "lblCnCNetStatus";
                lblCnCNetStatus.FontIndex            = 1;
                lblCnCNetStatus.Text                 = ClientConfiguration.Instance.LocalGame.ToUpper() + " PLAYERS ONLINE:";
                lblCnCNetPlayerCount                 = new XNALabel(WindowManager);
                lblCnCNetPlayerCount.Name            = "lblCnCNetPlayerCount";
                lblCnCNetPlayerCount.FontIndex       = 1;
                lblCnCNetPlayerCount.Text            = "-";
                lblCnCNetPlayerCount.ClientRectangle = new Rectangle(btnOptions.X - 50, 11, lblCnCNetPlayerCount.Width, lblCnCNetPlayerCount.Height);
                lblCnCNetStatus.ClientRectangle      = new Rectangle(lblCnCNetPlayerCount.X - lblCnCNetStatus.Width - 6, 11, lblCnCNetStatus.Width, lblCnCNetStatus.Height);
                AddChild(lblCnCNetStatus);
                AddChild(lblCnCNetPlayerCount);
                CnCNetPlayerCountTask.CnCNetGameCountUpdated += CnCNetInfoController_CnCNetGameCountUpdated;
                cncnetPlayerCountCancellationSource           = new CancellationTokenSource();
                CnCNetPlayerCountTask.InitializeService(cncnetPlayerCountCancellationSource);
            }

            lblConnectionStatus.CenterOnParent();

            base.Initialize();

            Keyboard.OnKeyPressed                    += Keyboard_OnKeyPressed;
            connectionManager.Connected              += ConnectionManager_Connected;
            connectionManager.Disconnected           += ConnectionManager_Disconnected;
            connectionManager.ConnectionLost         += ConnectionManager_ConnectionLost;
            connectionManager.WelcomeMessageReceived += ConnectionManager_WelcomeMessageReceived;
            connectionManager.AttemptedServerChanged += ConnectionManager_AttemptedServerChanged;
            connectionManager.ConnectAttemptFailed   += ConnectionManager_ConnectAttemptFailed;
        }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;

            Name = "MainMenu";
            BackgroundTexture = AssetLoader.LoadTexture("MainMenu\\mainmenubg.png");
            ClientRectangle   = new Rectangle(0, 0, BackgroundTexture.Width, BackgroundTexture.Height);

            WindowManager.CenterControlOnScreen(this);

            var btnNewCampaign = new XNAClientButton(WindowManager);

            btnNewCampaign.Name             = "btnNewCampaign";
            btnNewCampaign.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\campaign.png");
            btnNewCampaign.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\campaign_c.png");
            btnNewCampaign.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnNewCampaign.LeftClick       += BtnNewCampaign_LeftClick;
            btnNewCampaign.HotKey           = Keys.C;

            var btnLoadGame = new XNAClientButton(WindowManager);

            btnLoadGame.Name             = "btnLoadGame";
            btnLoadGame.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\loadmission.png");
            btnLoadGame.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\loadmission_c.png");
            btnLoadGame.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnLoadGame.LeftClick       += BtnLoadGame_LeftClick;
            btnLoadGame.HotKey           = Keys.L;

            var btnSkirmish = new XNAClientButton(WindowManager);

            btnSkirmish.Name             = "btnSkirmish";
            btnSkirmish.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\skirmish.png");
            btnSkirmish.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\skirmish_c.png");
            btnSkirmish.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnSkirmish.LeftClick       += BtnSkirmish_LeftClick;
            btnSkirmish.HotKey           = Keys.S;

            var btnCnCNet = new XNAClientButton(WindowManager);

            btnCnCNet.Name             = "btnCnCNet";
            btnCnCNet.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\cncnet.png");
            btnCnCNet.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\cncnet_c.png");
            btnCnCNet.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnCnCNet.LeftClick       += BtnCnCNet_LeftClick;
            btnCnCNet.HotKey           = Keys.M;

            var btnLan = new XNAClientButton(WindowManager);

            btnLan.Name             = "btnLan";
            btnLan.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\lan.png");
            btnLan.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\lan_c.png");
            btnLan.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnLan.LeftClick       += BtnLan_LeftClick;
            btnLan.HotKey           = Keys.N;

            var btnOptions = new XNAClientButton(WindowManager);

            btnOptions.Name             = "btnOptions";
            btnOptions.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\options.png");
            btnOptions.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\options_c.png");
            btnOptions.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnOptions.LeftClick       += BtnOptions_LeftClick;
            btnOptions.HotKey           = Keys.O;

            var btnMapEditor = new XNAClientButton(WindowManager);

            btnMapEditor.Name             = "btnMapEditor";
            btnMapEditor.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\mapeditor.png");
            btnMapEditor.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\mapeditor_c.png");
            btnMapEditor.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnMapEditor.LeftClick       += BtnMapEditor_LeftClick;
            btnMapEditor.HotKey           = Keys.E;

            var btnStatistics = new XNAClientButton(WindowManager);

            btnStatistics.Name             = "btnStatistics";
            btnStatistics.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\statistics.png");
            btnStatistics.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\statistics_c.png");
            btnStatistics.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnStatistics.LeftClick       += BtnStatistics_LeftClick;
            btnStatistics.HotKey           = Keys.T;

            var btnCredits = new XNAClientButton(WindowManager);

            btnCredits.Name             = "btnCredits";
            btnCredits.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\credits.png");
            btnCredits.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\credits_c.png");
            btnCredits.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnCredits.LeftClick       += BtnCredits_LeftClick;
            btnCredits.HotKey           = Keys.R;

            var btnExtras = new XNAClientButton(WindowManager);

            btnExtras.Name             = "btnExtras";
            btnExtras.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\extras.png");
            btnExtras.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\extras_c.png");
            btnExtras.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnExtras.LeftClick       += BtnExtras_LeftClick;
            btnExtras.HotKey           = Keys.E;

            var btnExit = new XNAClientButton(WindowManager);

            btnExit.Name             = "btnExit";
            btnExit.IdleTexture      = AssetLoader.LoadTexture("MainMenu\\exitgame.png");
            btnExit.HoverTexture     = AssetLoader.LoadTexture("MainMenu\\exitgame_c.png");
            btnExit.HoverSoundEffect = AssetLoader.LoadSound("MainMenu\\button.wav");
            btnExit.LeftClick       += BtnExit_LeftClick;

            XNALabel lblCnCNetStatus = new XNALabel(WindowManager);

            lblCnCNetStatus.Name            = "lblCnCNetStatus";
            lblCnCNetStatus.Text            = "DTA players on CnCNet:";
            lblCnCNetStatus.ClientRectangle = new Rectangle(12, 9, 0, 0);

            lblCnCNetPlayerCount      = new XNALabel(WindowManager);
            lblCnCNetPlayerCount.Name = "lblCnCNetPlayerCount";
            lblCnCNetPlayerCount.Text = "-";

            lblVersion      = new XNALabel(WindowManager);
            lblVersion.Name = "lblVersion";
            lblVersion.Text = CUpdater.GameVersion;

            lblUpdateStatus                 = new XNALinkLabel(WindowManager);
            lblUpdateStatus.Name            = "lblUpdateStatus";
            lblUpdateStatus.LeftClick      += LblUpdateStatus_LeftClick;
            lblUpdateStatus.ClientRectangle = new Rectangle(0, 0, 160, 20);

            AddChild(btnNewCampaign);
            AddChild(btnLoadGame);
            AddChild(btnSkirmish);
            AddChild(btnCnCNet);
            AddChild(btnLan);
            AddChild(btnOptions);
            AddChild(btnMapEditor);
            AddChild(btnStatistics);
            AddChild(btnCredits);
            AddChild(btnExtras);
            AddChild(btnExit);
            AddChild(lblCnCNetStatus);
            AddChild(lblCnCNetPlayerCount);

            if (!ClientConfiguration.Instance.ModMode)
            {
                AddChild(lblVersion);
                AddChild(lblUpdateStatus);

                CUpdater.FileIdentifiersUpdated += CUpdater_FileIdentifiersUpdated;
            }

            innerPanel = new MainMenuDarkeningPanel(WindowManager);
            innerPanel.ClientRectangle = new Rectangle(0, 0,
                                                       ClientRectangle.Width,
                                                       ClientRectangle.Height);
            AddChild(innerPanel);
            innerPanel.Hide();

            base.Initialize(); // Read control attributes from INI

            innerPanel.UpdateQueryWindow.UpdateDeclined += UpdateQueryWindow_UpdateDeclined;
            innerPanel.UpdateQueryWindow.UpdateAccepted += UpdateQueryWindow_UpdateAccepted;

            innerPanel.UpdateWindow.UpdateCompleted += UpdateWindow_UpdateCompleted;
            innerPanel.UpdateWindow.UpdateCancelled += UpdateWindow_UpdateCancelled;
            innerPanel.UpdateWindow.UpdateFailed    += UpdateWindow_UpdateFailed;

            this.ClientRectangle = new Rectangle((WindowManager.RenderResolutionX - ClientRectangle.Width) / 2,
                                                 (WindowManager.RenderResolutionY - ClientRectangle.Height) / 2,
                                                 ClientRectangle.Width, ClientRectangle.Height);
            innerPanel.ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX, WindowManager.RenderResolutionY);

            CnCNetPlayerCountTask.CnCNetGameCountUpdated += CnCNetInfoController_CnCNetGameCountUpdated;
            cncnetPlayerCountCancellationSource           = new CancellationTokenSource();
            CnCNetPlayerCountTask.InitializeService(cncnetPlayerCountCancellationSource);

            WindowManager.GameClosing += WindowManager_GameClosing;

            skirmishLobby.Exited += SkirmishLobby_Exited;
            lanLobby.Exited      += LanLobby_Exited;

            GameProcessLogic.GameProcessStarted  += SharedUILogic_GameProcessStarted;
            GameProcessLogic.GameProcessStarting += SharedUILogic_GameProcessStarting;

            UserINISettings.Instance.SettingsSaved += SettingsSaved;

            CUpdater.Restart += CUpdater_Restart;
        }