public override void Initialize()
        {
            Name = "GameLoadingWindow";
            BackgroundTexture = AssetLoader.LoadTexture("loadmissionbg.png");

            ClientRectangle = new Rectangle(0, 0, 600, 380);
            CenterOnParent();

            lbSaveGameList                 = new XNAMultiColumnListBox(WindowManager);
            lbSaveGameList.Name            = nameof(lbSaveGameList);
            lbSaveGameList.ClientRectangle = new Rectangle(13, 13, 574, 317);
            lbSaveGameList.AddColumn("SAVED GAME NAME", 400);
            lbSaveGameList.AddColumn("DATE / TIME", 174);
            lbSaveGameList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbSaveGameList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbSaveGameList.SelectedIndexChanged   += ListBox_SelectedIndexChanged;
            lbSaveGameList.AllowKeyboardInput      = true;

            btnLaunch                 = new XNAClientButton(WindowManager);
            btnLaunch.Name            = nameof(btnLaunch);
            btnLaunch.ClientRectangle = new Rectangle(125, 345, 110, 23);
            btnLaunch.Text            = "Load";
            btnLaunch.AllowClick      = false;
            btnLaunch.LeftClick      += BtnLaunch_LeftClick;

            btnDelete                 = new XNAClientButton(WindowManager);
            btnDelete.Name            = nameof(btnDelete);
            btnDelete.ClientRectangle = new Rectangle(btnLaunch.Right + 10, btnLaunch.Y, 110, 23);
            btnDelete.Text            = "Delete";
            btnDelete.AllowClick      = false;
            btnDelete.LeftClick      += BtnDelete_LeftClick;

            btnCancel                 = new XNAClientButton(WindowManager);
            btnCancel.Name            = nameof(btnCancel);
            btnCancel.ClientRectangle = new Rectangle(btnDelete.Right + 10, btnLaunch.Y, 110, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            AddChild(lbSaveGameList);
            AddChild(btnLaunch);
            AddChild(btnDelete);
            AddChild(btnCancel);

            base.Initialize();

            ListSaves();
        }
        public override void Initialize()
        {
            sm = StatisticsManager.Instance;

            string strLblEconomy    = "ECONOMY";
            string strLblAvgEconomy = "Average economy:";

            if (ClientConfiguration.Instance.UseBuiltStatistic)
            {
                strLblEconomy    = "BUILT";
                strLblAvgEconomy = "Avg. number of objects built:";
            }

            Name = "StatisticsWindow";
            BackgroundTexture = AssetLoader.LoadTexture("scoreviewerbg.png");
            ClientRectangle   = new Rectangle(0, 0, 700, 521);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = "tabControl";
            tabControl.ClientRectangle = new Rectangle(12, 10, 0, 0);
            tabControl.SoundOnClick    = AssetLoader.LoadSound("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Game Statistics", 133);
            tabControl.AddTab("Total Statistics", 133);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            XNALabel lblFilter = new XNALabel(WindowManager);

            lblFilter.Name            = "lblFilter";
            lblFilter.FontIndex       = 1;
            lblFilter.Text            = "FILTER:";
            lblFilter.ClientRectangle = new Rectangle(527, 12, 0, 0);

            cmbGameClassFilter = new XNAClientDropDown(WindowManager);
            cmbGameClassFilter.ClientRectangle = new Rectangle(585, 11, 105, 21);
            cmbGameClassFilter.Name            = "cmbGameClassFilter";
            cmbGameClassFilter.AddItem("All games");
            cmbGameClassFilter.AddItem("Online games");
            cmbGameClassFilter.AddItem("Online PvP");
            cmbGameClassFilter.AddItem("Online Co-Op");
            cmbGameClassFilter.AddItem("Skirmish");
            cmbGameClassFilter.SelectedIndex         = 0;
            cmbGameClassFilter.SelectedIndexChanged += CmbGameClassFilter_SelectedIndexChanged;

            XNALabel lblGameMode = new XNALabel(WindowManager);

            lblGameMode.Name            = "lblGameMode";
            lblGameMode.FontIndex       = 1;
            lblGameMode.Text            = "GAME MODE:";
            lblGameMode.ClientRectangle = new Rectangle(294, 12, 0, 0);

            cmbGameModeFilter                       = new XNAClientDropDown(WindowManager);
            cmbGameModeFilter.Name                  = "cmbGameModeFilter";
            cmbGameModeFilter.ClientRectangle       = new Rectangle(381, 11, 114, 21);
            cmbGameModeFilter.SelectedIndexChanged += CmbGameModeFilter_SelectedIndexChanged;

            var btnReturnToMenu = new XNAClientButton(WindowManager);

            btnReturnToMenu.Name            = "btnReturnToMenu";
            btnReturnToMenu.ClientRectangle = new Rectangle(270, 486, 160, 23);
            btnReturnToMenu.Text            = "Return to Main Menu";
            btnReturnToMenu.LeftClick      += BtnReturnToMenu_LeftClick;

            var btnClearStatistics = new XNAClientButton(WindowManager);

            btnClearStatistics.Name            = "btnClearStatistics";
            btnClearStatistics.ClientRectangle = new Rectangle(12, 486, 160, 23);
            btnClearStatistics.Text            = "Clear Statistics";
            btnClearStatistics.LeftClick      += BtnClearStatistics_LeftClick;
            btnClearStatistics.Visible         = false;

            chkIncludeSpectatedGames = new XNAClientCheckBox(WindowManager);

            AddChild(chkIncludeSpectatedGames);
            chkIncludeSpectatedGames.Name            = "chkIncludeSpectatedGames";
            chkIncludeSpectatedGames.Text            = "Include spectated games";
            chkIncludeSpectatedGames.Checked         = true;
            chkIncludeSpectatedGames.ClientRectangle = new Rectangle(
                Width - chkIncludeSpectatedGames.Width - 12,
                cmbGameModeFilter.Bottom + 3,
                chkIncludeSpectatedGames.Width,
                chkIncludeSpectatedGames.Height);
            chkIncludeSpectatedGames.CheckedChanged += ChkIncludeSpectatedGames_CheckedChanged;

            #region Match statistics

            panelGameStatistics      = new XNAPanel(WindowManager);
            panelGameStatistics.Name = "panelGameStatistics";
            panelGameStatistics.BackgroundTexture = AssetLoader.LoadTexture("scoreviewerpanelbg.png");
            panelGameStatistics.ClientRectangle   = new Rectangle(10, 55, 680, 425);

            AddChild(panelGameStatistics);

            XNALabel lblMatches = new XNALabel(WindowManager);
            lblMatches.Text            = "GAMES:";
            lblMatches.FontIndex       = 1;
            lblMatches.ClientRectangle = new Rectangle(4, 2, 0, 0);

            lbGameList      = new XNAMultiColumnListBox(WindowManager);
            lbGameList.Name = "lbGameList";
            lbGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbGameList.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbGameList.AddColumn("DATE / TIME", 130);
            lbGameList.AddColumn("MAP", 200);
            lbGameList.AddColumn("GAME MODE", 130);
            lbGameList.AddColumn("FPS", 50);
            lbGameList.AddColumn("DURATION", 76);
            lbGameList.AddColumn("COMPLETED", 90);
            lbGameList.ClientRectangle       = new Rectangle(2, 25, 676, 250);
            lbGameList.SelectedIndexChanged += LbGameList_SelectedIndexChanged;
            lbGameList.AllowKeyboardInput    = true;

            lbGameStatistics      = new XNAMultiColumnListBox(WindowManager);
            lbGameStatistics.Name = "lbGameStatistics";
            lbGameStatistics.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbGameStatistics.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbGameStatistics.AddColumn("NAME", 130);
            lbGameStatistics.AddColumn("KILLS", 78);
            lbGameStatistics.AddColumn("LOSSES", 78);
            lbGameStatistics.AddColumn(strLblEconomy, 80);
            lbGameStatistics.AddColumn("SCORE", 100);
            lbGameStatistics.AddColumn("WON", 50);
            lbGameStatistics.AddColumn("SIDE", 100);
            lbGameStatistics.AddColumn("TEAM", 60);
            lbGameStatistics.ClientRectangle = new Rectangle(2, 280, 676, 143);

            panelGameStatistics.AddChild(lblMatches);
            panelGameStatistics.AddChild(lbGameList);
            panelGameStatistics.AddChild(lbGameStatistics);

            #endregion

            #region Total statistics

            panelTotalStatistics      = new XNAPanel(WindowManager);
            panelTotalStatistics.Name = "panelTotalStatistics";
            panelTotalStatistics.BackgroundTexture = AssetLoader.LoadTexture("scoreviewerpanelbg.png");
            panelTotalStatistics.ClientRectangle   = new Rectangle(10, 55, 680, 425);

            AddChild(panelTotalStatistics);
            panelTotalStatistics.Visible = false;
            panelTotalStatistics.Enabled = false;

            int locationY = TOTAL_STATS_FIRST_ITEM_Y;

            AddTotalStatisticsLabel("lblGamesStarted", "Games started:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblGamesStartedValue                 = new XNALabel(WindowManager);
            lblGamesStartedValue.Name            = "lblGamesStartedValue";
            lblGamesStartedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblGamesStartedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblGamesFinished", "Games finished:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblGamesFinishedValue                 = new XNALabel(WindowManager);
            lblGamesFinishedValue.Name            = "lblGamesFinishedValue";
            lblGamesFinishedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblGamesFinishedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblWins", "Wins:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblWinsValue                 = new XNALabel(WindowManager);
            lblWinsValue.Name            = "lblWinsValue";
            lblWinsValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblWinsValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblLosses", "Losses:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblLossesValue                 = new XNALabel(WindowManager);
            lblLossesValue.Name            = "lblLossesValue";
            lblLossesValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblLossesValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblWinLossRatio", "Win / Loss ratio:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblWinLossRatioValue                 = new XNALabel(WindowManager);
            lblWinLossRatioValue.Name            = "lblWinLossRatioValue";
            lblWinLossRatioValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblWinLossRatioValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageGameLength", "Average game length:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageGameLengthValue                 = new XNALabel(WindowManager);
            lblAverageGameLengthValue.Name            = "lblAverageGameLengthValue";
            lblAverageGameLengthValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageGameLengthValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalTimePlayed", "Total time played:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblTotalTimePlayedValue                 = new XNALabel(WindowManager);
            lblTotalTimePlayedValue.Name            = "lblTotalTimePlayedValue";
            lblTotalTimePlayedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblTotalTimePlayedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageEnemyCount", "Average number of enemies:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageEnemyCountValue                 = new XNALabel(WindowManager);
            lblAverageEnemyCountValue.Name            = "lblAverageEnemyCountValue";
            lblAverageEnemyCountValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageEnemyCountValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageAllyCount", "Average number of allies:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageAllyCountValue                 = new XNALabel(WindowManager);
            lblAverageAllyCountValue.Name            = "lblAverageAllyCountValue";
            lblAverageAllyCountValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageAllyCountValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            // SECOND COLUMN

            locationY = TOTAL_STATS_FIRST_ITEM_Y;

            AddTotalStatisticsLabel("lblTotalKills", "Total kills:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalKillsValue                 = new XNALabel(WindowManager);
            lblTotalKillsValue.Name            = "lblTotalKillsValue";
            lblTotalKillsValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalKillsValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblKillsPerGame", "Kills / game:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblKillsPerGameValue                 = new XNALabel(WindowManager);
            lblKillsPerGameValue.Name            = "lblKillsPerGameValue";
            lblKillsPerGameValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblKillsPerGameValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalLosses", "Total losses:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalLossesValue                 = new XNALabel(WindowManager);
            lblTotalLossesValue.Name            = "lblTotalLossesValue";
            lblTotalLossesValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalLossesValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblLossesPerGame", "Losses / game:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblLossesPerGameValue                 = new XNALabel(WindowManager);
            lblLossesPerGameValue.Name            = "lblLossesPerGameValue";
            lblLossesPerGameValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblLossesPerGameValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblKillLossRatio", "Kill / loss ratio:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblKillLossRatioValue                 = new XNALabel(WindowManager);
            lblKillLossRatioValue.Name            = "lblKillLossRatioValue";
            lblKillLossRatioValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblKillLossRatioValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalScore", "Total score:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalScoreValue                 = new XNALabel(WindowManager);
            lblTotalScoreValue.Name            = "lblTotalScoreValue";
            lblTotalScoreValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalScoreValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageEconomy", strLblAvgEconomy, new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblAverageEconomyValue                 = new XNALabel(WindowManager);
            lblAverageEconomyValue.Name            = "lblAverageEconomyValue";
            lblAverageEconomyValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblAverageEconomyValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblFavouriteSide", "Favourite side:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblFavouriteSideValue                 = new XNALabel(WindowManager);
            lblFavouriteSideValue.Name            = "lblFavouriteSideValue";
            lblFavouriteSideValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblFavouriteSideValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageAILevel", "Average AI level:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblAverageAILevelValue                 = new XNALabel(WindowManager);
            lblAverageAILevelValue.Name            = "lblAverageAILevelValue";
            lblAverageAILevelValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblAverageAILevelValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            panelTotalStatistics.AddChild(lblGamesStartedValue);
            panelTotalStatistics.AddChild(lblGamesFinishedValue);
            panelTotalStatistics.AddChild(lblWinsValue);
            panelTotalStatistics.AddChild(lblLossesValue);
            panelTotalStatistics.AddChild(lblWinLossRatioValue);
            panelTotalStatistics.AddChild(lblAverageGameLengthValue);
            panelTotalStatistics.AddChild(lblTotalTimePlayedValue);
            panelTotalStatistics.AddChild(lblAverageEnemyCountValue);
            panelTotalStatistics.AddChild(lblAverageAllyCountValue);

            panelTotalStatistics.AddChild(lblTotalKillsValue);
            panelTotalStatistics.AddChild(lblKillsPerGameValue);
            panelTotalStatistics.AddChild(lblTotalLossesValue);
            panelTotalStatistics.AddChild(lblLossesPerGameValue);
            panelTotalStatistics.AddChild(lblKillLossRatioValue);
            panelTotalStatistics.AddChild(lblTotalScoreValue);
            panelTotalStatistics.AddChild(lblAverageEconomyValue);
            panelTotalStatistics.AddChild(lblFavouriteSideValue);
            panelTotalStatistics.AddChild(lblAverageAILevelValue);

            #endregion

            AddChild(tabControl);
            AddChild(lblFilter);
            AddChild(cmbGameClassFilter);
            AddChild(lblGameMode);
            AddChild(cmbGameModeFilter);
            AddChild(btnReturnToMenu);
            AddChild(btnClearStatistics);

            base.Initialize();

            CenterOnParent();

            sides = ClientConfiguration.Instance.GetSides().Split(',');

            sideTextures = new Texture2D[sides.Length + 1];
            for (int i = 0; i < sides.Length; i++)
            {
                sideTextures[i] = AssetLoader.LoadTexture(sides[i] + "icon.png");
            }

            sideTextures[sides.Length] = AssetLoader.LoadTexture("spectatoricon.png");

            mpColors = MultiplayerColor.LoadColors();

            ReadStatistics();
            ListGameModes();
            ListGames();

            StatisticsManager.Instance.GameAdded += Instance_GameAdded;
        }
        public override void Initialize()
        {
            Name = "GameLoadingWindow";
            BackgroundTexture = AssetLoader.LoadTexture("loadmissionbg.png");

            ClientRectangle = new Rectangle(0, 0, 800, 380);
            CenterOnParent();

            lbSaveGameList                 = new XNAMultiColumnListBox(WindowManager);
            lbSaveGameList.Name            = nameof(lbSaveGameList);
            lbSaveGameList.ClientRectangle = new Rectangle(13, 13, 574, 317);
            lbSaveGameList.AddColumn("SAVED GAME NAME", 400);
            lbSaveGameList.AddColumn("DATE / TIME", 174);
            lbSaveGameList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbSaveGameList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbSaveGameList.SelectedIndexChanged   += ListBox_SelectedIndexChanged;
            lbSaveGameList.AllowKeyboardInput      = true;

            btnLaunch                 = new XNAClientButton(WindowManager);
            btnLaunch.Name            = nameof(btnLaunch);
            btnLaunch.ClientRectangle = new Rectangle(0, 345, 110, 23);
            btnLaunch.Text            = "Load";
            btnLaunch.AllowClick      = false;
            btnLaunch.LeftClick      += BtnLaunch_LeftClick;

            btnDelete                 = new XNAClientButton(WindowManager);
            btnDelete.Name            = nameof(btnDelete);
            btnDelete.ClientRectangle = new Rectangle(0, btnLaunch.Y, 110, 23);
            btnDelete.Text            = "Delete";
            btnDelete.AllowClick      = false;
            btnDelete.LeftClick      += BtnDelete_LeftClick;

            btnCancel                 = new XNAClientButton(WindowManager);
            btnCancel.Name            = nameof(btnCancel);
            btnCancel.ClientRectangle = new Rectangle(0, btnLaunch.Y, 110, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            var lblSaveInfoHeader = new XNALabel(WindowManager);

            lblSaveInfoHeader.Name      = nameof(lblSaveInfoHeader);
            lblSaveInfoHeader.Y         = lbSaveGameList.Y;
            lblSaveInfoHeader.X         = lbSaveGameList.Right + UIDesignConstants.CONTROL_HORIZONTAL_MARGIN * 2;
            lblSaveInfoHeader.FontIndex = UIDesignConstants.BOLD_FONT_INDEX;
            lblSaveInfoHeader.Text      = "SAVE INFORMATION";
            AddChild(lblSaveInfoHeader);

            var lblSessionType = new XNALabel(WindowManager);

            lblSessionType.Name      = nameof(lblSessionType);
            lblSessionType.FontIndex = UIDesignConstants.BOLD_FONT_INDEX;
            lblSessionType.Y         = lblSaveInfoHeader.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2;
            lblSessionType.X         = lblSaveInfoHeader.X;
            lblSessionType.Text      = "Session Type:";
            AddChild(lblSessionType);

            lblSessionTypeValue      = new XNALabel(WindowManager);
            lblSessionTypeValue.Name = nameof(lblSessionTypeValue);
            lblSessionTypeValue.Y    = lblSessionType.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN;
            lblSessionTypeValue.X    = lblSaveInfoHeader.X;
            lblSessionTypeValue.Text = " ";
            AddChild(lblSessionTypeValue);

            var lblMissionName = new XNALabel(WindowManager);

            lblMissionName.Name      = nameof(lblMissionName);
            lblMissionName.FontIndex = UIDesignConstants.BOLD_FONT_INDEX;
            lblMissionName.Y         = lblSessionTypeValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2;
            lblMissionName.X         = lblSaveInfoHeader.X;
            lblMissionName.Text      = "Mission Name:";
            AddChild(lblMissionName);

            lblMissionNameValue      = new XNALabel(WindowManager);
            lblMissionNameValue.Name = nameof(lblMissionNameValue);
            lblMissionNameValue.Y    = lblMissionName.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN;
            lblMissionNameValue.X    = lblSessionTypeValue.X;
            lblMissionNameValue.Text = " ";
            AddChild(lblMissionNameValue);

            var lblDifficultyLevel = new XNALabel(WindowManager);

            lblDifficultyLevel.Name      = nameof(lblDifficultyLevel);
            lblDifficultyLevel.FontIndex = UIDesignConstants.BOLD_FONT_INDEX;
            lblDifficultyLevel.Y         = lblMissionNameValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2;
            lblDifficultyLevel.X         = lblSaveInfoHeader.X;
            lblDifficultyLevel.Text      = "Difficulty Level:";
            AddChild(lblDifficultyLevel);

            lblDifficultyLevelValue      = new XNALabel(WindowManager);
            lblDifficultyLevelValue.Name = nameof(lblDifficultyLevelValue);
            lblDifficultyLevelValue.Y    = lblDifficultyLevel.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN;
            lblDifficultyLevelValue.X    = lblSaveInfoHeader.X;
            lblDifficultyLevelValue.Text = " ";
            AddChild(lblDifficultyLevelValue);

            var lblGlobalFlags = new XNALabel(WindowManager);

            lblGlobalFlags.Name      = nameof(lblGlobalFlags);
            lblGlobalFlags.FontIndex = UIDesignConstants.BOLD_FONT_INDEX;
            lblGlobalFlags.Y         = lblDifficultyLevelValue.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2;
            lblGlobalFlags.X         = lblSaveInfoHeader.X;
            lblGlobalFlags.Text      = "Preconditions:";
            AddChild(lblGlobalFlags);

            lblGlobalFlagsValue      = new XNALabel(WindowManager);
            lblGlobalFlagsValue.Name = nameof(lblGlobalFlagsValue);
            lblGlobalFlagsValue.Y    = lblGlobalFlags.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN;
            lblGlobalFlagsValue.X    = lblSaveInfoHeader.X;
            lblGlobalFlagsValue.Text = " ";
            AddChild(lblGlobalFlagsValue);

            AddChild(lbSaveGameList);
            AddChild(btnLaunch);
            AddChild(btnDelete);
            AddChild(btnCancel);

            btnDelete.CenterOnParentHorizontally();
            btnLaunch.X = btnDelete.X - 10 - btnLaunch.Width;
            btnCancel.X = btnDelete.Right + 10;

            base.Initialize();

            ListSaves();
        }
Exemple #4
0
        public override void Initialize()
        {
            Name              = "GameCreationWindow";
            ClientRectangle   = new Rectangle(0, 0, 490, 188);
            BackgroundTexture = AssetLoader.LoadTexture("gamecreationoptionsbg.png");

            btnCreateGame = new XNAClientButton(WindowManager);
            btnCreateGame.ClientRectangle = new Rectangle(12, 159, 133, 23);
            btnCreateGame.Text            = "Create Game";
            btnCreateGame.LeftClick      += BtnCreateGame_LeftClick;

            btnCancel = new XNAClientButton(WindowManager);
            btnCancel.ClientRectangle = new Rectangle(345, btnCreateGame.Y, 133, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            btnLoadMPGame = new XNAClientButton(WindowManager);
            btnLoadMPGame.ClientRectangle = new Rectangle(178, btnCreateGame.Y, 133, 23);
            btnLoadMPGame.Text            = "Load Game";
            btnLoadMPGame.LeftClick      += BtnLoadMPGame_LeftClick;

            btnDisplayAdvancedOptions = new XNAClientButton(WindowManager);
            btnDisplayAdvancedOptions.ClientRectangle = new Rectangle(12, 124, 160, 23);
            btnDisplayAdvancedOptions.Text            = "Advanced Options";
            btnDisplayAdvancedOptions.LeftClick      += BtnDisplayAdvancedOptions_LeftClick;

            tbGameName = new XNATextBox(WindowManager);
            tbGameName.MaximumTextLength = 23;
            tbGameName.ClientRectangle   = new Rectangle(Width - 162, 12, 150, 21);
            tbGameName.Text = ProgramConstants.PLAYERNAME + "'s Game";

            lblRoomName = new XNALabel(WindowManager);
            lblRoomName.ClientRectangle = new Rectangle(12, tbGameName.Y + 1, 0, 0);
            lblRoomName.Text            = "Game room name:";

            ddMaxPlayers = new XNAClientDropDown(WindowManager);
            ddMaxPlayers.ClientRectangle = new Rectangle(tbGameName.X, 53,
                                                         tbGameName.Width, 21);
            for (int i = 8; i > 1; i--)
            {
                ddMaxPlayers.AddItem(i.ToString());
            }
            ddMaxPlayers.SelectedIndex = 0;

            lblMaxPlayers = new XNALabel(WindowManager);
            lblMaxPlayers.ClientRectangle = new Rectangle(12, ddMaxPlayers.Y + 1, 0, 0);
            lblMaxPlayers.Text            = "Maximum number of players:";

            tbPassword = new XNATextBox(WindowManager);
            tbPassword.MaximumTextLength = 20;
            tbPassword.ClientRectangle   = new Rectangle(tbGameName.X, 94,
                                                         tbGameName.Width, 21);

            lblPassword = new XNALabel(WindowManager);
            lblPassword.ClientRectangle = new Rectangle(12, tbPassword.Y + 1, 0, 0);
            lblPassword.Text            = "Password (leave blank for none):";

            lblTunnelServer = new XNALabel(WindowManager);
            lblTunnelServer.ClientRectangle = new Rectangle(12, 134, 0, 0);
            lblTunnelServer.Text            = "Tunnel server:";
            lblTunnelServer.Enabled         = false;
            lblTunnelServer.Visible         = false;

            lbTunnelList = new XNAMultiColumnListBox(WindowManager);
            lbTunnelList.ClientRectangle   = new Rectangle(12, 154, 466, 200);
            lbTunnelList.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbTunnelList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbTunnelList.AddColumn("Name", 230);
            lbTunnelList.AddColumn("Official", 70);
            lbTunnelList.AddColumn("Ping", 76);
            lbTunnelList.AddColumn("Players", 90);
            lbTunnelList.SelectedIndexChanged += LbTunnelList_SelectedIndexChanged;
            lbTunnelList.Enabled = false;
            lbTunnelList.Visible = false;
            lbTunnelList.AllowRightClickUnselect = false;
            lbTunnelList.AllowKeyboardInput      = true;

            AddChild(btnCreateGame);
            AddChild(btnCancel);
            if (!ClientConfiguration.Instance.DisableMultiplayerGameLoading)
            {
                AddChild(btnLoadMPGame);
            }
            AddChild(btnDisplayAdvancedOptions);
            AddChild(tbGameName);
            AddChild(lblRoomName);
            AddChild(lblMaxPlayers);
            AddChild(tbPassword);
            AddChild(lblPassword);
            AddChild(lblTunnelServer);
            AddChild(lbTunnelList);
            AddChild(ddMaxPlayers);

            base.Initialize();

            CenterOnParent();

            tunnelHandler.TunnelsRefreshed += TunnelHandler_TunnelsRefreshed;
            tunnelHandler.TunnelPinged     += TunnelHandler_TunnelPinged;

            UserINISettings.Instance.SettingsSaved += Instance_SettingsSaved;

            if (UserINISettings.Instance.AlwaysDisplayTunnelList)
            {
                BtnDisplayAdvancedOptions_LeftClick(this, EventArgs.Empty);
            }
        }
        public override void Initialize()
        {
            ReadGameCommands();

            Name              = "HotkeyConfigurationWindow";
            ClientRectangle   = new Rectangle(0, 0, 600, 450);
            BackgroundTexture = AssetLoader.LoadTextureUncached("hotkeyconfigbg.png");

            var lblCategory = new XNALabel(WindowManager);

            lblCategory.Name            = "lblCategory";
            lblCategory.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblCategory.Text            = "Category:";

            ddCategory                 = new XNAClientDropDown(WindowManager);
            ddCategory.Name            = "ddCategory";
            ddCategory.ClientRectangle = new Rectangle(lblCategory.Right + 12,
                                                       lblCategory.Y - 1, 250, ddCategory.Height);

            HashSet <string> categories = new HashSet <string>();

            foreach (var command in gameCommands)
            {
                if (!categories.Contains(command.Category))
                {
                    categories.Add(command.Category);
                }
            }

            foreach (string category in categories)
            {
                ddCategory.AddItem(category);
            }

            lbHotkeys                 = new XNAMultiColumnListBox(WindowManager);
            lbHotkeys.Name            = "lbHotkeys";
            lbHotkeys.ClientRectangle = new Rectangle(12, ddCategory.Bottom + 12,
                                                      ddCategory.Right - 12, Height - ddCategory.Bottom - 59);
            lbHotkeys.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbHotkeys.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbHotkeys.AddColumn("Command", 150);
            lbHotkeys.AddColumn("Shortcut", lbHotkeys.Width - 150);

            hotkeyInfoPanel                 = new XNAPanel(WindowManager);
            hotkeyInfoPanel.Name            = "HotkeyInfoPanel";
            hotkeyInfoPanel.ClientRectangle = new Rectangle(lbHotkeys.Right + 12,
                                                            ddCategory.Y, Width - lbHotkeys.Right - 24, lbHotkeys.Height + ddCategory.Height + 12);

            lblCommandCaption                 = new XNALabel(WindowManager);
            lblCommandCaption.Name            = "lblCommandCaption";
            lblCommandCaption.FontIndex       = 1;
            lblCommandCaption.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblCommandCaption.Text            = "Command name";

            lblDescription                 = new XNALabel(WindowManager);
            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, lblCommandCaption.Bottom + 12, 0, 0);
            lblDescription.Text            = "Command description";

            var lblCurrentHotkey = new XNALabel(WindowManager);

            lblCurrentHotkey.Name            = "lblCurrentHotkey";
            lblCurrentHotkey.ClientRectangle = new Rectangle(lblDescription.X,
                                                             lblDescription.Bottom + 48, 0, 0);
            lblCurrentHotkey.FontIndex = 1;
            lblCurrentHotkey.Text      = "Currently assigned hotkey:";

            lblCurrentHotkeyValue                 = new XNALabel(WindowManager);
            lblCurrentHotkeyValue.Name            = "lblCurrentHotkeyValue";
            lblCurrentHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X,
                                                                  lblCurrentHotkey.Bottom + 6, 0, 0);
            lblCurrentHotkeyValue.Text = "Current hotkey value";

            var lblNewHotkey = new XNALabel(WindowManager);

            lblNewHotkey.Name            = "lblNewHotkey";
            lblNewHotkey.ClientRectangle = new Rectangle(lblDescription.X,
                                                         lblCurrentHotkeyValue.Bottom + 48, 0, 0);
            lblNewHotkey.FontIndex = 1;
            lblNewHotkey.Text      = "New hotkey:";

            lblNewHotkeyValue                 = new XNALabel(WindowManager);
            lblNewHotkeyValue.Name            = "lblNewHotkeyValue";
            lblNewHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X,
                                                              lblNewHotkey.Bottom + 6, 0, 0);
            lblNewHotkeyValue.Text = HOTKEY_TIP_TEXT;

            lblCurrentlyAssignedTo                 = new XNALabel(WindowManager);
            lblCurrentlyAssignedTo.Name            = "lblCurrentlyAssignedTo";
            lblCurrentlyAssignedTo.ClientRectangle = new Rectangle(lblDescription.X,
                                                                   lblNewHotkeyValue.Bottom + 12, 0, 0);
            lblCurrentlyAssignedTo.Text = "Currently assigned to:\nKey";

            var btnAssign = new XNAClientButton(WindowManager);

            btnAssign.Name            = "btnAssign";
            btnAssign.ClientRectangle = new Rectangle(lblDescription.X,
                                                      lblCurrentlyAssignedTo.Bottom + 24, 121, 23);
            btnAssign.Text       = "Assign Hotkey";
            btnAssign.LeftClick += BtnAssign_LeftClick;

            btnResetKey                 = new XNAClientButton(WindowManager);
            btnResetKey.Name            = "btnResetKey";
            btnResetKey.ClientRectangle = new Rectangle(btnAssign.X, btnAssign.Bottom + 12, btnAssign.Width, 23);
            btnResetKey.Text            = "Reset to Default";
            btnResetKey.LeftClick      += BtnReset_LeftClick;

            var lblDefaultHotkey = new XNALabel(WindowManager);

            lblDefaultHotkey.Name            = "lblOriginalHotkey";
            lblDefaultHotkey.ClientRectangle = new Rectangle(lblCurrentHotkey.X, btnResetKey.Bottom + 12, 0, 0);
            lblDefaultHotkey.Text            = "Default hotkey:";

            lblDefaultHotkeyValue                 = new XNALabel(WindowManager);
            lblDefaultHotkeyValue.Name            = "lblDefaultHotkeyValue";
            lblDefaultHotkeyValue.ClientRectangle = new Rectangle(lblDefaultHotkey.Right + 12, lblDefaultHotkey.Y, 0, 0);

            var btnSave = new XNAClientButton(WindowManager);

            btnSave.Name            = "btnSave";
            btnSave.ClientRectangle = new Rectangle(12, lbHotkeys.Bottom + 12, 92, 23);
            btnSave.Text            = "Save";
            btnSave.LeftClick      += BtnSave_LeftClick;

            var btnResetAllKeys = new XNAClientButton(WindowManager);

            btnResetAllKeys.Name            = "btnResetAllToDefaults";
            btnResetAllKeys.ClientRectangle = new Rectangle(0, btnSave.Y, 121, 23);
            btnResetAllKeys.Text            = "Reset All Keys";
            btnResetAllKeys.LeftClick      += BtnResetToDefaults_LeftClick;
            AddChild(btnResetAllKeys);
            btnResetAllKeys.CenterOnParentHorizontally();

            var btnCancel = new XNAClientButton(WindowManager);

            btnCancel.Name            = "btnExit";
            btnCancel.ClientRectangle = new Rectangle(Width - 104, btnSave.Y, 92, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            AddChild(lbHotkeys);
            AddChild(lblCategory);
            AddChild(ddCategory);
            AddChild(hotkeyInfoPanel);
            AddChild(btnSave);
            AddChild(btnCancel);
            hotkeyInfoPanel.AddChild(lblCommandCaption);
            hotkeyInfoPanel.AddChild(lblDescription);
            hotkeyInfoPanel.AddChild(lblCurrentHotkey);
            hotkeyInfoPanel.AddChild(lblCurrentHotkeyValue);
            hotkeyInfoPanel.AddChild(lblNewHotkey);
            hotkeyInfoPanel.AddChild(lblNewHotkeyValue);
            hotkeyInfoPanel.AddChild(lblCurrentlyAssignedTo);
            hotkeyInfoPanel.AddChild(lblDefaultHotkey);
            hotkeyInfoPanel.AddChild(lblDefaultHotkeyValue);
            hotkeyInfoPanel.AddChild(btnAssign);
            hotkeyInfoPanel.AddChild(btnResetKey);

            if (categories.Count > 0)
            {
                hotkeyInfoPanel.Disable();
                lbHotkeys.SelectedIndexChanged += LbHotkeys_SelectedIndexChanged;

                ddCategory.SelectedIndexChanged += DdCategory_SelectedIndexChanged;
                ddCategory.SelectedIndex         = 0;
            }
            else
            {
                Logger.Log("No keyboard game commands exist!");
            }

            GameProcessLogic.GameProcessExited += GameProcessLogic_GameProcessExited;

            base.Initialize();

            CenterOnParent();

            Keyboard.OnKeyPressed += Keyboard_OnKeyPressed;
            EnabledChanged        += HotkeyConfigurationWindow_EnabledChanged;
        }