public override void Initialize()
        {
            base.Initialize();

            Name = "UpdaterOptionsPanel";

            var lblDescription = new XNALabel(WindowManager);

            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblDescription.Text            = "To change download server priority, select a server from the list and" +
                                             Environment.NewLine + "use the Move Up / Down buttons to change its priority.";

            lbUpdateServerList                 = new XNAListBox(WindowManager);
            lbUpdateServerList.Name            = "lblUpdateServerList";
            lbUpdateServerList.ClientRectangle = new Rectangle(lblDescription.X,
                                                               lblDescription.Bottom + 12, Width - 24, 100);
            lbUpdateServerList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            lbUpdateServerList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            var btnMoveUp = new XNAClientButton(WindowManager);

            btnMoveUp.Name            = "btnMoveUp";
            btnMoveUp.ClientRectangle = new Rectangle(lbUpdateServerList.X,
                                                      lbUpdateServerList.Bottom + 12, 133, 23);
            btnMoveUp.Text       = "Move Up";
            btnMoveUp.LeftClick += btnMoveUp_LeftClick;

            var btnMoveDown = new XNAClientButton(WindowManager);

            btnMoveDown.Name            = "btnMoveDown";
            btnMoveDown.ClientRectangle = new Rectangle(
                lbUpdateServerList.Right - 133,
                btnMoveUp.Y, 133, 23);
            btnMoveDown.Text       = "Move Down";
            btnMoveDown.LeftClick += btnMoveDown_LeftClick;

            chkAutoCheck                 = new XNAClientCheckBox(WindowManager);
            chkAutoCheck.Name            = "chkAutoCheck";
            chkAutoCheck.ClientRectangle = new Rectangle(lblDescription.X,
                                                         btnMoveUp.Bottom + 24, 0, 0);
            chkAutoCheck.Text = "Check for updates automatically";

            btnForceUpdate                 = new XNAClientButton(WindowManager);
            btnForceUpdate.Name            = "btnForceUpdate";
            btnForceUpdate.ClientRectangle = new Rectangle(btnMoveDown.X, btnMoveDown.Bottom + 24, 133, 23);
            btnForceUpdate.Text            = "Force Update";
            btnForceUpdate.LeftClick      += BtnForceUpdate_LeftClick;

            AddChild(lblDescription);
            AddChild(lbUpdateServerList);
            AddChild(btnMoveUp);
            AddChild(btnMoveDown);
            AddChild(chkAutoCheck);
            AddChild(btnForceUpdate);
        }
예제 #2
0
        public override void Initialize()
        {
            base.Initialize();

            Name = "UpdaterOptionsPanel";

            var lblDescription = new XNALabel(WindowManager);

            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblDescription.Text            = "欲更改优先下载的服务器,请从列表中选择一个服务器," +
                                             Environment.NewLine + "然后用 上移 或 下移 工具改变它的优先级。";

            lbUpdateServerList                 = new XNAListBox(WindowManager);
            lbUpdateServerList.Name            = "lblUpdateServerList";
            lbUpdateServerList.ClientRectangle = new Rectangle(lblDescription.X,
                                                               lblDescription.Bottom + 12, Width - 24, 100);
            lbUpdateServerList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            lbUpdateServerList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            var btnMoveUp = new XNAClientButton(WindowManager);

            btnMoveUp.Name            = "btnMoveUp";
            btnMoveUp.ClientRectangle = new Rectangle(lbUpdateServerList.X,
                                                      lbUpdateServerList.Bottom + 12, 133, 23);
            btnMoveUp.Text       = "上移";
            btnMoveUp.LeftClick += btnMoveUp_LeftClick;

            var btnMoveDown = new XNAClientButton(WindowManager);

            btnMoveDown.Name            = "btnMoveDown";
            btnMoveDown.ClientRectangle = new Rectangle(
                lbUpdateServerList.Right - 133,
                btnMoveUp.Y, 133, 23);
            btnMoveDown.Text       = "下移";
            btnMoveDown.LeftClick += btnMoveDown_LeftClick;

            chkAutoCheck                 = new XNAClientCheckBox(WindowManager);
            chkAutoCheck.Name            = "chkAutoCheck";
            chkAutoCheck.ClientRectangle = new Rectangle(lblDescription.X,
                                                         btnMoveUp.Bottom + 24, 0, 0);
            chkAutoCheck.Text = "自动检查更新";

            AddChild(lblDescription);
            AddChild(lbUpdateServerList);
            AddChild(btnMoveUp);
            AddChild(btnMoveDown);
            AddChild(chkAutoCheck);
        }
        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()
        {
            base.Initialize();

            Name = "GameOptionsPanel";

            var lblScrollRate = new XNALabel(WindowManager);

            lblScrollRate.Name            = "lblScrollRate";
            lblScrollRate.ClientRectangle = new Rectangle(12,
                                                          14, 0, 0);
            lblScrollRate.Text = "卷动速率:";

            lblScrollRateValue                 = new XNALabel(WindowManager);
            lblScrollRateValue.Name            = "lblScrollRateValue";
            lblScrollRateValue.FontIndex       = 1;
            lblScrollRateValue.Text            = "3";
            lblScrollRateValue.ClientRectangle = new Rectangle(
                Width - lblScrollRateValue.Width - 12,
                lblScrollRate.Y, 0, 0);

            trbScrollRate                 = new XNATrackbar(WindowManager);
            trbScrollRate.Name            = "trbClientVolume";
            trbScrollRate.ClientRectangle = new Rectangle(
                lblScrollRate.Right + 32,
                lblScrollRate.Y - 2,
                lblScrollRateValue.X - lblScrollRate.Right - 47,
                22);
            trbScrollRate.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            trbScrollRate.MinValue          = 0;
            trbScrollRate.MaxValue          = MAX_SCROLL_RATE;
            trbScrollRate.ValueChanged     += TrbScrollRate_ValueChanged;

            chkScrollCoasting                 = new XNAClientCheckBox(WindowManager);
            chkScrollCoasting.Name            = "chkScrollCoasting";
            chkScrollCoasting.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                trbScrollRate.Bottom + 20, 0, 0);
            chkScrollCoasting.Text = "Scroll Coasting";

            chkTargetLines                 = new XNAClientCheckBox(WindowManager);
            chkTargetLines.Name            = "chkTargetLines";
            chkTargetLines.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkScrollCoasting.Bottom + 24, 0, 0);
            chkTargetLines.Text = "目标线";

            chkTooltips      = new XNAClientCheckBox(WindowManager);
            chkTooltips.Name = "chkTooltips";
            chkTooltips.Text = "工具提示";

            var lblPlayerName = new XNALabel(WindowManager);

            lblPlayerName.Name = "lblPlayerName";
            lblPlayerName.Text = "玩家名字 (必填)*:";

#if YR
            chkShowHiddenObjects                 = new XNAClientCheckBox(WindowManager);
            chkShowHiddenObjects.Name            = "chkShowHiddenObjects";
            chkShowHiddenObjects.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkTargetLines.Bottom + 24, 0, 0);
            chkShowHiddenObjects.Text = "Show Hidden Objects";

            chkTooltips.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkShowHiddenObjects.Bottom + 24, 0, 0);

            lblPlayerName.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkTooltips.Bottom + 30, 0, 0);

            AddChild(chkShowHiddenObjects);
#else
            chkTooltips.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkTargetLines.Bottom + 24, 0, 0);
#endif

#if DTA || TI || TS
            chkBlackChatBackground                 = new XNAClientCheckBox(WindowManager);
            chkBlackChatBackground.Name            = "chkBlackChatBackground";
            chkBlackChatBackground.ClientRectangle = new Rectangle(
                chkScrollCoasting.X,
                chkTooltips.Bottom + 24, 0, 0);
            chkBlackChatBackground.Text = "游戏内聊天使用黑色底色";

            AddChild(chkBlackChatBackground);
#endif

#if DTA || TS || TI
            chkAltToUndeploy                 = new XNAClientCheckBox(WindowManager);
            chkAltToUndeploy.Name            = "chkAltToUndeploy";
            chkAltToUndeploy.ClientRectangle = new Rectangle(
                chkScrollCoasting.X,
                chkBlackChatBackground.Bottom + 24, 0, 0);
            chkAltToUndeploy.Text = "用Alt键收回可部署载具,而不是左键移动";

            AddChild(chkAltToUndeploy);

            lblPlayerName.ClientRectangle = new Rectangle(
                lblScrollRate.X,
                chkAltToUndeploy.Bottom + 30, 0, 0);
#endif



            tbPlayerName      = new XNATextBox(WindowManager);
            tbPlayerName.Name = "tbPlayerName";
            tbPlayerName.MaximumTextLength = ClientConfiguration.Instance.MaxNameLength;
            tbPlayerName.ClientRectangle   = new Rectangle(trbScrollRate.X,
                                                           lblPlayerName.Y - 2, 200, 19);
            tbPlayerName.Text = ProgramConstants.PLAYERNAME;

            var lblNotice = new XNALabel(WindowManager);
            lblNotice.Name            = "lblNotice";
            lblNotice.ClientRectangle = new Rectangle(lblPlayerName.X,
                                                      lblPlayerName.Bottom + 30, 0, 0);
            lblNotice.Text = "* 如果您已登录CnCNet,您需要注销并重新登录,改名方可生效。";

            hotkeyConfigWindow = new HotkeyConfigurationWindow(WindowManager);
            DarkeningPanel.AddAndInitializeWithControl(WindowManager, hotkeyConfigWindow);
            hotkeyConfigWindow.Disable();

            var btnConfigureHotkeys = new XNAClientButton(WindowManager);
            btnConfigureHotkeys.Name            = "btnConfigureHotkeys";
            btnConfigureHotkeys.ClientRectangle = new Rectangle(lblPlayerName.X, lblNotice.Bottom + 36, 160, 23);
            btnConfigureHotkeys.Text            = "快捷键设置";
            btnConfigureHotkeys.LeftClick      += BtnConfigureHotkeys_LeftClick;

            AddChild(lblScrollRate);
            AddChild(lblScrollRateValue);
            AddChild(trbScrollRate);
            AddChild(chkScrollCoasting);
            AddChild(chkTargetLines);
            AddChild(chkTooltips);
            AddChild(lblPlayerName);
            AddChild(tbPlayerName);
            AddChild(lblNotice);
            AddChild(btnConfigureHotkeys);
        }
예제 #5
0
        public override void Initialize()
        {
            base.Initialize();

            Name = "AudioOptionsPanel";

            var lblScoreVolume = new XNALabel(WindowManager);

            lblScoreVolume.Name            = "lblScoreVolume";
            lblScoreVolume.ClientRectangle = new Rectangle(12, 14, 0, 0);
            lblScoreVolume.Text            = "Music Volume:";

            lblScoreVolumeValue                 = new XNALabel(WindowManager);
            lblScoreVolumeValue.Name            = "lblScoreVolumeValue";
            lblScoreVolumeValue.FontIndex       = 1;
            lblScoreVolumeValue.Text            = "10";
            lblScoreVolumeValue.ClientRectangle = new Rectangle(
                ClientRectangle.Width - lblScoreVolumeValue.ClientRectangle.Width - 12,
                lblScoreVolume.ClientRectangle.Y, 0, 0);

            trbScoreVolume                 = new XNATrackbar(WindowManager);
            trbScoreVolume.Name            = "trbScoreVolume";
            trbScoreVolume.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.Right + 16,
                lblScoreVolume.ClientRectangle.Y - 2,
                lblScoreVolumeValue.ClientRectangle.X - lblScoreVolume.ClientRectangle.Right - 31,
                22);
            trbScoreVolume.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            trbScoreVolume.MinValue          = 0;
            trbScoreVolume.MaxValue          = 10;
            trbScoreVolume.ValueChanged     += TrbScoreVolume_ValueChanged;

            var lblSoundVolume = new XNALabel(WindowManager);

            lblSoundVolume.Name            = "lblSoundVolume";
            lblSoundVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                           lblScoreVolume.ClientRectangle.Bottom + 20, 0, 0);
            lblSoundVolume.Text = "Sound Volume:";

            lblSoundVolumeValue                 = new XNALabel(WindowManager);
            lblSoundVolumeValue.Name            = "lblSoundVolumeValue";
            lblSoundVolumeValue.FontIndex       = 1;
            lblSoundVolumeValue.Text            = "10";
            lblSoundVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblSoundVolume.ClientRectangle.Y, 0, 0);

            trbSoundVolume                 = new XNATrackbar(WindowManager);
            trbSoundVolume.Name            = "trbSoundVolume";
            trbSoundVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblSoundVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbSoundVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbSoundVolume.MinValue          = 0;
            trbSoundVolume.MaxValue          = 10;
            trbSoundVolume.ValueChanged     += TrbSoundVolume_ValueChanged;

            var lblVoiceVolume = new XNALabel(WindowManager);

            lblVoiceVolume.Name            = "lblVoiceVolume";
            lblVoiceVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                           lblSoundVolume.ClientRectangle.Bottom + 20, 0, 0);
            lblVoiceVolume.Text = "Voice Volume:";

            lblVoiceVolumeValue                 = new XNALabel(WindowManager);
            lblVoiceVolumeValue.Name            = "lblVoiceVolumeValue";
            lblVoiceVolumeValue.FontIndex       = 1;
            lblVoiceVolumeValue.Text            = "10";
            lblVoiceVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblVoiceVolume.ClientRectangle.Y, 0, 0);

            trbVoiceVolume                 = new XNATrackbar(WindowManager);
            trbVoiceVolume.Name            = "trbVoiceVolume";
            trbVoiceVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblVoiceVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbVoiceVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbVoiceVolume.MinValue          = 0;
            trbVoiceVolume.MaxValue          = 10;
            trbVoiceVolume.ValueChanged     += TrbVoiceVolume_ValueChanged;

            chkScoreShuffle                 = new XNAClientCheckBox(WindowManager);
            chkScoreShuffle.Name            = "chkScoreShuffle";
            chkScoreShuffle.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X,
                trbVoiceVolume.ClientRectangle.Bottom + 12, 0, 0);
            chkScoreShuffle.Text = "Shuffle Music";

            var lblClientVolume = new XNALabel(WindowManager);

            lblClientVolume.Name            = "lblClientVolume";
            lblClientVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                            chkScoreShuffle.ClientRectangle.Bottom + 40, 0, 0);
            lblClientVolume.Text = "Client Volume:";

            lblClientVolumeValue                 = new XNALabel(WindowManager);
            lblClientVolumeValue.Name            = "lblClientVolumeValue";
            lblClientVolumeValue.FontIndex       = 1;
            lblClientVolumeValue.Text            = "10";
            lblClientVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblClientVolume.ClientRectangle.Y, 0, 0);

            trbClientVolume                 = new XNATrackbar(WindowManager);
            trbClientVolume.Name            = "trbClientVolume";
            trbClientVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblClientVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbClientVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbClientVolume.MinValue          = 0;
            trbClientVolume.MaxValue          = 10;
            trbClientVolume.ValueChanged     += TrbClientVolume_ValueChanged;

            chkMainMenuMusic                 = new XNAClientCheckBox(WindowManager);
            chkMainMenuMusic.Name            = "chkMainMenuMusic";
            chkMainMenuMusic.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X,
                trbClientVolume.ClientRectangle.Bottom + 12, 0, 0);
            chkMainMenuMusic.Text            = "Main menu music";
            chkMainMenuMusic.CheckedChanged += ChkMainMenuMusic_CheckedChanged;

            chkStopMusicOnMenu                 = new XNAClientCheckBox(WindowManager);
            chkStopMusicOnMenu.Name            = "chkStopMusicOnMenu";
            chkStopMusicOnMenu.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X, chkMainMenuMusic.ClientRectangle.Bottom + 24, 0, 0);
            chkStopMusicOnMenu.Text = "Don't play main menu music in lobbies";

            AddChild(lblScoreVolume);
            AddChild(lblScoreVolumeValue);
            AddChild(trbScoreVolume);
            AddChild(lblSoundVolume);
            AddChild(lblSoundVolumeValue);
            AddChild(trbSoundVolume);
            AddChild(lblVoiceVolume);
            AddChild(lblVoiceVolumeValue);
            AddChild(trbVoiceVolume);

            AddChild(chkScoreShuffle);

            AddChild(lblClientVolume);
            AddChild(lblClientVolumeValue);
            AddChild(trbClientVolume);

            AddChild(chkMainMenuMusic);
            AddChild(chkStopMusicOnMenu);

            lblScoreVolumeValue.Text  = trbScoreVolume.Value.ToString();
            lblSoundVolumeValue.Text  = trbSoundVolume.Value.ToString();
            lblVoiceVolumeValue.Text  = trbVoiceVolume.Value.ToString();
            lblClientVolumeValue.Text = trbClientVolume.Value.ToString();
            AudioMaster.SetVolume(trbClientVolume.Value / 10.0f);
        }
        public override void Initialize()
        {
            Name = nameof(PlayerExtraOptionsPanel);
            BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 255), 1, 1);
            Visible           = false;

            var btnClose = new XNAClientButton(WindowManager);

            btnClose.ClientRectangle = new Rectangle(0, 0, 0, 0);
            btnClose.IdleTexture     = AssetLoader.LoadTexture("openedComboBoxArrow.png");
            btnClose.HoverTexture    = AssetLoader.LoadTexture("openedComboBoxArrow.png");
            btnClose.LeftClick      += (sender, args) => Disable();
            AddChild(btnClose);

            var lblHeader = new XNALabel(WindowManager);

            lblHeader.Name            = nameof(lblHeader);
            lblHeader.Text            = "Extra Player Options";
            lblHeader.ClientRectangle = new Rectangle(defaultX, 4, 0, 18);
            AddChild(lblHeader);

            chkBoxForceRandomSides                 = new XNAClientCheckBox(WindowManager);
            chkBoxForceRandomSides.Name            = nameof(chkBoxForceRandomSides);
            chkBoxForceRandomSides.Text            = "Force Random Sides";
            chkBoxForceRandomSides.ClientRectangle = new Rectangle(defaultX, lblHeader.Bottom + 4, 0, 0);
            chkBoxForceRandomSides.CheckedChanged += Options_Changed;
            AddChild(chkBoxForceRandomSides);

            chkBoxForceRandomColors                 = new XNAClientCheckBox(WindowManager);
            chkBoxForceRandomColors.Name            = nameof(chkBoxForceRandomColors);
            chkBoxForceRandomColors.Text            = "Force Random Colors";
            chkBoxForceRandomColors.ClientRectangle = new Rectangle(defaultX, chkBoxForceRandomSides.Bottom + 4, 0, 0);
            chkBoxForceRandomColors.CheckedChanged += Options_Changed;
            AddChild(chkBoxForceRandomColors);

            chkBoxForceRandomTeams                 = new XNAClientCheckBox(WindowManager);
            chkBoxForceRandomTeams.Name            = nameof(chkBoxForceRandomTeams);
            chkBoxForceRandomTeams.Text            = "Force Random Teams";
            chkBoxForceRandomTeams.ClientRectangle = new Rectangle(defaultX, chkBoxForceRandomColors.Bottom + 4, 0, 0);
            chkBoxForceRandomTeams.CheckedChanged += Options_Changed;
            AddChild(chkBoxForceRandomTeams);

            chkBoxForceRandomStarts                 = new XNAClientCheckBox(WindowManager);
            chkBoxForceRandomStarts.Name            = nameof(chkBoxForceRandomStarts);
            chkBoxForceRandomStarts.Text            = "Force Random Starts";
            chkBoxForceRandomStarts.ClientRectangle = new Rectangle(defaultX, chkBoxForceRandomTeams.Bottom + 4, 0, 0);
            chkBoxForceRandomStarts.CheckedChanged += Options_Changed;
            AddChild(chkBoxForceRandomStarts);

            /////////////////////////////

            chkBoxUseTeamStartMappings                 = new XNAClientCheckBox(WindowManager);
            chkBoxUseTeamStartMappings.Name            = nameof(chkBoxUseTeamStartMappings);
            chkBoxUseTeamStartMappings.Text            = "Enable Auto Allying:";
            chkBoxUseTeamStartMappings.ClientRectangle = new Rectangle(defaultTeamStartMappingX, lblHeader.Y, 0, 0);
            chkBoxUseTeamStartMappings.CheckedChanged += ChkBoxUseTeamStartMappings_Changed;
            AddChild(chkBoxUseTeamStartMappings);

            var btnHelp = new XNAClientButton(WindowManager);

            btnHelp.Name            = nameof(btnHelp);
            btnHelp.IdleTexture     = AssetLoader.LoadTexture("questionMark.png");
            btnHelp.HoverTexture    = AssetLoader.LoadTexture("questionMark.png");
            btnHelp.LeftClick      += BtnHelp_LeftClick;
            btnHelp.ClientRectangle = new Rectangle(chkBoxUseTeamStartMappings.Right + 4, chkBoxUseTeamStartMappings.Y - 1, 0, 0);
            AddChild(btnHelp);

            var lblPreset = new XNALabel(WindowManager);

            lblPreset.Name            = nameof(lblPreset);
            lblPreset.Text            = "Presets:";
            lblPreset.ClientRectangle = new Rectangle(chkBoxUseTeamStartMappings.X, chkBoxUseTeamStartMappings.Bottom + 8, 0, 0);
            AddChild(lblPreset);

            ddTeamStartMappingPreset                       = new XNAClientDropDown(WindowManager);
            ddTeamStartMappingPreset.Name                  = nameof(ddTeamStartMappingPreset);
            ddTeamStartMappingPreset.ClientRectangle       = new Rectangle(lblPreset.X + 50, lblPreset.Y - 2, 160, 0);
            ddTeamStartMappingPreset.SelectedIndexChanged += DdTeamMappingPreset_SelectedIndexChanged;
            ddTeamStartMappingPreset.AllowDropDown         = true;
            AddChild(ddTeamStartMappingPreset);

            teamStartMappingsPanel = new TeamStartMappingsPanel(WindowManager);
            teamStartMappingsPanel.ClientRectangle = new Rectangle(200, ddTeamStartMappingPreset.Bottom + 8, Width, Height - ddTeamStartMappingPreset.Bottom + 4);
            AddChild(teamStartMappingsPanel);

            AddLocationAssignments();

            base.Initialize();

            RefreshTeamStartMappingsPanel();
        }
예제 #7
0
        public override void Initialize()
        {
            base.Initialize();

            Name = "GameOptionsPanel";

            var lblScrollRate = new XNALabel(WindowManager);

            lblScrollRate.Name            = "lblScrollRate";
            lblScrollRate.ClientRectangle = new Rectangle(12,
                                                          14, 0, 0);
            lblScrollRate.Text = "Scroll Rate:";

            lblScrollRateValue                 = new XNALabel(WindowManager);
            lblScrollRateValue.Name            = "lblScrollRateValue";
            lblScrollRateValue.FontIndex       = 1;
            lblScrollRateValue.Text            = "3";
            lblScrollRateValue.ClientRectangle = new Rectangle(
                ClientRectangle.Width - lblScrollRateValue.ClientRectangle.Width - 12,
                lblScrollRate.ClientRectangle.Y, 0, 0);

            trbScrollRate                 = new XNATrackbar(WindowManager);
            trbScrollRate.Name            = "trbClientVolume";
            trbScrollRate.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.Right + 32,
                lblScrollRate.ClientRectangle.Y - 2,
                lblScrollRateValue.ClientRectangle.X - lblScrollRate.ClientRectangle.Right - 47,
                22);
            trbScrollRate.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            trbScrollRate.MinValue          = 0;
            trbScrollRate.MaxValue          = MAX_SCROLL_RATE;
            trbScrollRate.ValueChanged     += TrbScrollRate_ValueChanged;

            chkScrollCoasting                 = new XNAClientCheckBox(WindowManager);
            chkScrollCoasting.Name            = "chkScrollCoasting";
            chkScrollCoasting.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                trbScrollRate.ClientRectangle.Bottom + 20, 0, 0);
            chkScrollCoasting.Text = "Scroll Coasting";

            chkTargetLines                 = new XNAClientCheckBox(WindowManager);
            chkTargetLines.Name            = "chkTargetLines";
            chkTargetLines.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkScrollCoasting.ClientRectangle.Bottom + 24, 0, 0);
            chkTargetLines.Text = "Target Lines";

            chkTooltips      = new XNAClientCheckBox(WindowManager);
            chkTooltips.Name = "chkTooltips";
            chkTooltips.Text = "Tooltips";

            var lblPlayerName = new XNALabel(WindowManager);

            lblPlayerName.Name = "lblPlayerName";
            lblPlayerName.Text = "Player Name*:";

#if YR
            chkShowHiddenObjects                 = new XNAClientCheckBox(WindowManager);
            chkShowHiddenObjects.Name            = "chkShowHiddenObjects";
            chkShowHiddenObjects.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkTargetLines.ClientRectangle.Bottom + 24, 0, 0);
            chkShowHiddenObjects.Text = "Show Hidden Objects";

            chkTooltips.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkShowHiddenObjects.ClientRectangle.Bottom + 24, 0, 0);

            lblPlayerName.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkTooltips.ClientRectangle.Bottom + 30, 0, 0);

            AddChild(chkShowHiddenObjects);
#else
            chkTooltips.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkTargetLines.ClientRectangle.Bottom + 24, 0, 0);
#endif

#if DTA || TI || TS
            chkBlackChatBackground                 = new XNAClientCheckBox(WindowManager);
            chkBlackChatBackground.Name            = "chkBlackChatBackground";
            chkBlackChatBackground.ClientRectangle = new Rectangle(
                chkScrollCoasting.ClientRectangle.X,
                chkTooltips.ClientRectangle.Bottom + 24, 0, 0);
            chkBlackChatBackground.Text = "Use black background for in-game chat messages";

            AddChild(chkBlackChatBackground);
#endif

#if DTA || TS
            chkAltToUndeploy                 = new XNAClientCheckBox(WindowManager);
            chkAltToUndeploy.Name            = "chkAltToUndeploy";
            chkAltToUndeploy.ClientRectangle = new Rectangle(
                chkScrollCoasting.ClientRectangle.X,
                chkBlackChatBackground.ClientRectangle.Bottom + 24, 0, 0);
            chkAltToUndeploy.Text = "Undeploy units by holding Alt key instead of a regular move command";

            AddChild(chkAltToUndeploy);

            lblPlayerName.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkAltToUndeploy.ClientRectangle.Bottom + 30, 0, 0);
#elif TI
            lblPlayerName.ClientRectangle = new Rectangle(
                lblScrollRate.ClientRectangle.X,
                chkBlackChatBackground.ClientRectangle.Bottom + 30, 0, 0);
#endif



            tbPlayerName      = new XNATextBox(WindowManager);
            tbPlayerName.Name = "tbPlayerName";
            tbPlayerName.MaximumTextLength = ClientConfiguration.Instance.MaxNameLength;
            tbPlayerName.ClientRectangle   = new Rectangle(trbScrollRate.ClientRectangle.X,
                                                           lblPlayerName.ClientRectangle.Y - 2, 200, 19);
            tbPlayerName.Text = ProgramConstants.PLAYERNAME;

            var lblNotice = new XNALabel(WindowManager);
            lblNotice.Name            = "lblNotice";
            lblNotice.ClientRectangle = new Rectangle(lblPlayerName.ClientRectangle.X,
                                                      lblPlayerName.ClientRectangle.Bottom + 30, 0, 0);
            lblNotice.Text = "* If you are currently connected to CnCNet, you need to log out and reconnect" +
                             Environment.NewLine + "for your new name to be applied.";

            hotkeyConfigWindow = new HotkeyConfigurationWindow(WindowManager);
            DarkeningPanel.AddAndInitializeWithControl(WindowManager, hotkeyConfigWindow);
            hotkeyConfigWindow.Disable();

            var btnConfigureHotkeys = new XNAClientButton(WindowManager);
            btnConfigureHotkeys.Name            = "btnConfigureHotkeys";
            btnConfigureHotkeys.ClientRectangle = new Rectangle(lblPlayerName.X, lblNotice.Bottom + 36, 160, 23);
            btnConfigureHotkeys.Text            = "Configure Hotkeys";
            btnConfigureHotkeys.LeftClick      += BtnConfigureHotkeys_LeftClick;

            AddChild(lblScrollRate);
            AddChild(lblScrollRateValue);
            AddChild(trbScrollRate);
            AddChild(chkScrollCoasting);
            AddChild(chkTargetLines);
            AddChild(chkTooltips);
            AddChild(lblPlayerName);
            AddChild(tbPlayerName);
            AddChild(lblNotice);
            AddChild(btnConfigureHotkeys);
        }
        //private bool FinalSunCompatFixDeclined = false;
#endif


        public override void Initialize()
        {
            base.Initialize();

            Name = "DisplayOptionsPanel";

            var lblIngameResolution = new XNALabel(WindowManager);

            lblIngameResolution.Name            = "lblIngameResolution";
            lblIngameResolution.ClientRectangle = new Rectangle(12, 14, 0, 0);
            lblIngameResolution.Text            = "In-game Resolution:";

            ddIngameResolution                 = new XNAClientDropDown(WindowManager);
            ddIngameResolution.Name            = "ddIngameResolution";
            ddIngameResolution.ClientRectangle = new Rectangle(
                lblIngameResolution.Right + 12,
                lblIngameResolution.Y - 2, 120, 19);

            var clientConfig = ClientConfiguration.Instance;

            var resolutions = GetResolutions(clientConfig.MinimumIngameWidth,
                                             clientConfig.MinimumIngameHeight,
                                             clientConfig.MaximumIngameWidth, clientConfig.MaximumIngameHeight);

            resolutions.Sort();

            foreach (var res in resolutions)
            {
                ddIngameResolution.AddItem(res.ToString());
            }

            var lblDetailLevel = new XNALabel(WindowManager);

            lblDetailLevel.Name            = "lblDetailLevel";
            lblDetailLevel.ClientRectangle = new Rectangle(lblIngameResolution.X,
                                                           ddIngameResolution.Bottom + 16, 0, 0);
            lblDetailLevel.Text = "Detail Level:";

            ddDetailLevel                 = new XNAClientDropDown(WindowManager);
            ddDetailLevel.Name            = "ddDetailLevel";
            ddDetailLevel.ClientRectangle = new Rectangle(
                ddIngameResolution.X,
                lblDetailLevel.Y - 2,
                ddIngameResolution.Width,
                ddIngameResolution.Height);
            ddDetailLevel.AddItem("Low");
            ddDetailLevel.AddItem("Medium");
            ddDetailLevel.AddItem("High");

            var lblRenderer = new XNALabel(WindowManager);

            lblRenderer.Name            = "lblRenderer";
            lblRenderer.ClientRectangle = new Rectangle(lblDetailLevel.X,
                                                        ddDetailLevel.Bottom + 16, 0, 0);
            lblRenderer.Text = "Renderer:";

            ddRenderer                 = new XNAClientDropDown(WindowManager);
            ddRenderer.Name            = "ddRenderer";
            ddRenderer.ClientRectangle = new Rectangle(
                ddDetailLevel.X,
                lblRenderer.Y - 2,
                ddDetailLevel.Width,
                ddDetailLevel.Height);

            GetRenderers();

            var localOS = ClientConfiguration.Instance.GetOperatingSystemVersion();

            foreach (var renderer in renderers)
            {
                if (renderer.IsCompatibleWithOS(localOS) && !renderer.Hidden)
                {
                    ddRenderer.AddItem(new XNADropDownItem()
                    {
                        Text = renderer.UIName,
                        Tag  = renderer
                    });
                }
            }

            //ddRenderer.AddItem("Default");
            //ddRenderer.AddItem("IE-DDRAW");
            //ddRenderer.AddItem("TS-DDRAW");
            //ddRenderer.AddItem("DDWrapper");
            //ddRenderer.AddItem("DxWnd");
            //if (ClientConfiguration.Instance.GetOperatingSystemVersion() == OSVersion.WINXP)
            //    ddRenderer.AddItem("Software");

            chkWindowedMode                 = new XNAClientCheckBox(WindowManager);
            chkWindowedMode.Name            = "chkWindowedMode";
            chkWindowedMode.ClientRectangle = new Rectangle(lblDetailLevel.X,
                                                            ddRenderer.Bottom + 16, 0, 0);
            chkWindowedMode.Text            = "Windowed Mode";
            chkWindowedMode.CheckedChanged += ChkWindowedMode_CheckedChanged;

            chkBorderlessWindowedMode                 = new XNAClientCheckBox(WindowManager);
            chkBorderlessWindowedMode.Name            = "chkBorderlessWindowedMode";
            chkBorderlessWindowedMode.ClientRectangle = new Rectangle(
                chkWindowedMode.X + 50,
                chkWindowedMode.Bottom + 24, 0, 0);
            chkBorderlessWindowedMode.Text          = "Borderless Windowed Mode";
            chkBorderlessWindowedMode.AllowChecking = false;

            chkBackBufferInVRAM                 = new XNAClientCheckBox(WindowManager);
            chkBackBufferInVRAM.Name            = "chkBackBufferInVRAM";
            chkBackBufferInVRAM.ClientRectangle = new Rectangle(
                lblDetailLevel.X,
                chkBorderlessWindowedMode.Bottom + 28, 0, 0);
            chkBackBufferInVRAM.Text = "Back Buffer in Video Memory" + Environment.NewLine +
                                       "(lower performance, but is" + Environment.NewLine + "necessary on some systems)";

            var lblClientResolution = new XNALabel(WindowManager);

            lblClientResolution.Name            = "lblClientResolution";
            lblClientResolution.ClientRectangle = new Rectangle(
                285, 14, 0, 0);
            lblClientResolution.Text = "Client Resolution:";

            ddClientResolution                 = new XNAClientPreferredItemDropDown(WindowManager);
            ddClientResolution.Name            = "ddClientResolution";
            ddClientResolution.ClientRectangle = new Rectangle(
                lblClientResolution.Right + 12,
                lblClientResolution.Y - 2,
                Width - (lblClientResolution.Right + 24),
                ddIngameResolution.Height);
            ddClientResolution.AllowDropDown      = false;
            ddClientResolution.PreferredItemLabel = "(recommended)";

            var screenBounds = Screen.PrimaryScreen.Bounds;

            resolutions = GetResolutions(800, 600,
                                         screenBounds.Width, screenBounds.Height);

            // Add "optimal" client resolutions for windowed mode
            // if they're not supported in fullscreen mode

            AddResolutionIfFitting(1024, 600, resolutions);
            AddResolutionIfFitting(1024, 720, resolutions);
            AddResolutionIfFitting(1280, 600, resolutions);
            AddResolutionIfFitting(1280, 720, resolutions);
            AddResolutionIfFitting(1280, 768, resolutions);
            AddResolutionIfFitting(1280, 800, resolutions);

            resolutions.Sort();

            foreach (var res in resolutions)
            {
                var item = new XNADropDownItem();
                item.Text = res.ToString();
                item.Tag  = res.ToString();
                ddClientResolution.AddItem(item);
            }

            // So we add the optimal resolutions to the list, sort it and then find
            // out the optimal resolution index - it's inefficient, but works

            int optimalWindowedResIndex = resolutions.FindIndex(res => res.ToString() == "1280x800");

            if (optimalWindowedResIndex == -1)
            {
                optimalWindowedResIndex = resolutions.FindIndex(res => res.ToString() == "1280x768");
            }

            if (optimalWindowedResIndex > -1)
            {
                ddClientResolution.PreferredItemIndex = optimalWindowedResIndex;
            }

            chkBorderlessClient                 = new XNAClientCheckBox(WindowManager);
            chkBorderlessClient.Name            = "chkBorderlessClient";
            chkBorderlessClient.ClientRectangle = new Rectangle(
                lblClientResolution.X,
                lblDetailLevel.Y, 0, 0);
            chkBorderlessClient.Text            = "Fullscreen Client";
            chkBorderlessClient.CheckedChanged += ChkBorderlessMenu_CheckedChanged;
            chkBorderlessClient.Checked         = true;

            var lblClientTheme = new XNALabel(WindowManager);

            lblClientTheme.Name            = "lblClientTheme";
            lblClientTheme.ClientRectangle = new Rectangle(
                lblClientResolution.X,
                lblRenderer.Y, 0, 0);
            lblClientTheme.Text = "Client Theme:";

            ddClientTheme                 = new XNAClientDropDown(WindowManager);
            ddClientTheme.Name            = "ddClientTheme";
            ddClientTheme.ClientRectangle = new Rectangle(
                ddClientResolution.X,
                ddRenderer.Y,
                ddClientResolution.Width,
                ddRenderer.Height);

            int themeCount = ClientConfiguration.Instance.ThemeCount;

            for (int i = 0; i < themeCount; i++)
            {
                ddClientTheme.AddItem(ClientConfiguration.Instance.GetThemeInfoFromIndex(i)[0]);
            }

#if !YR
            lblCompatibilityFixes           = new XNALabel(WindowManager);
            lblCompatibilityFixes.Name      = "lblCompatibilityFixes";
            lblCompatibilityFixes.FontIndex = 1;
            lblCompatibilityFixes.Text      = "Compatibility Fixes (advanced):";
            AddChild(lblCompatibilityFixes);
            lblCompatibilityFixes.CenterOnParent();
            lblCompatibilityFixes.Y = Height - 103;

            lblGameCompatibilityFix                 = new XNALabel(WindowManager);
            lblGameCompatibilityFix.Name            = "lblGameCompatibilityFix";
            lblGameCompatibilityFix.ClientRectangle = new Rectangle(132,
                                                                    lblCompatibilityFixes.Bottom + 20, 0, 0);
            lblGameCompatibilityFix.Text = "DTA/TI/TS Compatibility Fix:";

            btnGameCompatibilityFix                 = new XNAClientButton(WindowManager);
            btnGameCompatibilityFix.Name            = "btnGameCompatibilityFix";
            btnGameCompatibilityFix.ClientRectangle = new Rectangle(
                lblGameCompatibilityFix.Right + 20,
                lblGameCompatibilityFix.Y - 4, 133, 23);
            btnGameCompatibilityFix.FontIndex  = 1;
            btnGameCompatibilityFix.Text       = "Enable";
            btnGameCompatibilityFix.LeftClick += BtnGameCompatibilityFix_LeftClick;

            lblMapEditorCompatibilityFix                 = new XNALabel(WindowManager);
            lblMapEditorCompatibilityFix.Name            = "lblMapEditorCompatibilityFix";
            lblMapEditorCompatibilityFix.ClientRectangle = new Rectangle(
                lblGameCompatibilityFix.X,
                lblGameCompatibilityFix.Bottom + 20, 0, 0);
            lblMapEditorCompatibilityFix.Text = "FinalSun Compatibility Fix:";

            btnMapEditorCompatibilityFix                 = new XNAClientButton(WindowManager);
            btnMapEditorCompatibilityFix.Name            = "btnMapEditorCompatibilityFix";
            btnMapEditorCompatibilityFix.ClientRectangle = new Rectangle(
                btnGameCompatibilityFix.X,
                lblMapEditorCompatibilityFix.Y - 4,
                btnGameCompatibilityFix.Width,
                btnGameCompatibilityFix.Height);
            btnMapEditorCompatibilityFix.FontIndex  = 1;
            btnMapEditorCompatibilityFix.Text       = "Enable";
            btnMapEditorCompatibilityFix.LeftClick += BtnMapEditorCompatibilityFix_LeftClick;

            AddChild(lblGameCompatibilityFix);
            AddChild(btnGameCompatibilityFix);
            AddChild(lblMapEditorCompatibilityFix);
            AddChild(btnMapEditorCompatibilityFix);
#endif

            AddChild(chkWindowedMode);
            AddChild(chkBorderlessWindowedMode);
            AddChild(chkBackBufferInVRAM);
            AddChild(chkBorderlessClient);
            AddChild(lblClientTheme);
            AddChild(ddClientTheme);
            AddChild(lblClientResolution);
            AddChild(ddClientResolution);
            AddChild(lblRenderer);
            AddChild(ddRenderer);
            AddChild(lblDetailLevel);
            AddChild(ddDetailLevel);
            AddChild(lblIngameResolution);
            AddChild(ddIngameResolution);
        }
예제 #9
0
        public override void Initialize()
        {
            base.Initialize();

            Name = "GameFiltersWindow";
            BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0), Width, Height);

            const int gap = 12;

            var lblTitle = new XNALabel(WindowManager);

            lblTitle.Name            = nameof(lblTitle);
            lblTitle.Text            = "Game Filters";
            lblTitle.ClientRectangle = new Rectangle(
                gap, gap, 120, UIDesignConstants.BUTTON_HEIGHT
                );

            chkBoxFriendsOnly                 = new XNAClientCheckBox(WindowManager);
            chkBoxFriendsOnly.Name            = nameof(chkBoxFriendsOnly);
            chkBoxFriendsOnly.Text            = "Show Friend Games Only";
            chkBoxFriendsOnly.ClientRectangle = new Rectangle(
                gap, lblTitle.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                0, 0
                );

            chkBoxHideLockedGames                 = new XNAClientCheckBox(WindowManager);
            chkBoxHideLockedGames.Name            = nameof(chkBoxHideLockedGames);
            chkBoxHideLockedGames.Text            = "Hide Locked Games";
            chkBoxHideLockedGames.ClientRectangle = new Rectangle(
                gap, chkBoxFriendsOnly.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                0, 0
                );

            chkBoxHidePasswordedGames                 = new XNAClientCheckBox(WindowManager);
            chkBoxHidePasswordedGames.Name            = nameof(chkBoxHidePasswordedGames);
            chkBoxHidePasswordedGames.Text            = "Hide Passworded Games";
            chkBoxHidePasswordedGames.ClientRectangle = new Rectangle(
                gap, chkBoxHideLockedGames.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                0, 0
                );

            chkBoxHideIncompatibleGames                 = new XNAClientCheckBox(WindowManager);
            chkBoxHideIncompatibleGames.Name            = nameof(chkBoxHideIncompatibleGames);
            chkBoxHideIncompatibleGames.Text            = "Hide Incompatible Games";
            chkBoxHideIncompatibleGames.ClientRectangle = new Rectangle(
                gap, chkBoxHidePasswordedGames.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                0, 0
                );

            ddMaxPlayerCount                 = new XNAClientDropDown(WindowManager);
            ddMaxPlayerCount.Name            = nameof(ddMaxPlayerCount);
            ddMaxPlayerCount.ClientRectangle = new Rectangle(
                gap, chkBoxHideIncompatibleGames.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                40, UIDesignConstants.BUTTON_HEIGHT
                );
            for (var i = minPlayerCount; i <= maxPlayerCount; i++)
            {
                ddMaxPlayerCount.AddItem(i.ToString());
            }

            var lblMaxPlayerCount = new XNALabel(WindowManager);

            lblMaxPlayerCount.Name            = nameof(lblMaxPlayerCount);
            lblMaxPlayerCount.Text            = "Max Player Count";
            lblMaxPlayerCount.ClientRectangle = new Rectangle(
                ddMaxPlayerCount.X + ddMaxPlayerCount.Width + gap, ddMaxPlayerCount.Y,
                0, UIDesignConstants.BUTTON_HEIGHT
                );

            var btnResetDefaults = new XNAClientButton(WindowManager);

            btnResetDefaults.Name            = nameof(btnResetDefaults);
            btnResetDefaults.Text            = "Reset Defaults";
            btnResetDefaults.ClientRectangle = new Rectangle(
                gap, ddMaxPlayerCount.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT
                );
            btnResetDefaults.LeftClick += BtnResetDefaults_LeftClick;

            var btnSave = new XNAClientButton(WindowManager);

            btnSave.Name            = nameof(btnSave);
            btnSave.Text            = "Save";
            btnSave.ClientRectangle = new Rectangle(
                gap, btnResetDefaults.Y + UIDesignConstants.BUTTON_HEIGHT + gap,
                UIDesignConstants.BUTTON_WIDTH_92, UIDesignConstants.BUTTON_HEIGHT
                );
            btnSave.LeftClick += BtnSave_LeftClick;

            var btnCancel = new XNAClientButton(WindowManager);

            btnCancel.Name            = nameof(btnCancel);
            btnCancel.Text            = "Cancel";
            btnCancel.ClientRectangle = new Rectangle(
                Width - gap - UIDesignConstants.BUTTON_WIDTH_92, btnSave.Y,
                UIDesignConstants.BUTTON_WIDTH_92, UIDesignConstants.BUTTON_HEIGHT
                );
            btnCancel.LeftClick += BtnCancel_LeftClick;

            AddChild(lblTitle);
            AddChild(chkBoxFriendsOnly);
            AddChild(chkBoxHideLockedGames);
            AddChild(chkBoxHidePasswordedGames);
            AddChild(chkBoxHideIncompatibleGames);
            AddChild(lblMaxPlayerCount);
            AddChild(ddMaxPlayerCount);
            AddChild(btnResetDefaults);
            AddChild(btnSave);
            AddChild(btnCancel);
        }
        public override void Initialize()
        {
            base.Initialize();

            Name = "CnCNetOptionsPanel";

            chkPingUnofficialTunnels                 = new XNAClientCheckBox(WindowManager);
            chkPingUnofficialTunnels.Name            = "chkPingUnofficialTunnels";
            chkPingUnofficialTunnels.ClientRectangle = new Rectangle(12, 12, 0, 0);
            chkPingUnofficialTunnels.Text            = "Ping unofficial CnCNet tunnels";

            AddChild(chkPingUnofficialTunnels);

            chkWriteInstallPathToRegistry                 = new XNAClientCheckBox(WindowManager);
            chkWriteInstallPathToRegistry.Name            = "chkWriteInstallPathToRegistry";
            chkWriteInstallPathToRegistry.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPingUnofficialTunnels.Bottom + 12, 0, 0);
            chkWriteInstallPathToRegistry.Text = "Write game installation path to Windows" + Environment.NewLine +
                                                 "Registry (makes it possible to join" + Environment.NewLine +
                                                 "other games' game rooms on CnCNet)";

            AddChild(chkWriteInstallPathToRegistry);

            chkPlaySoundOnGameHosted                 = new XNAClientCheckBox(WindowManager);
            chkPlaySoundOnGameHosted.Name            = "chkPlaySoundOnGameHosted";
            chkPlaySoundOnGameHosted.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkWriteInstallPathToRegistry.Bottom + 12, 0, 0);
            chkPlaySoundOnGameHosted.Text = "Play sound when a game is hosted";

            AddChild(chkPlaySoundOnGameHosted);

            chkNotifyOnUserListChange                 = new XNAClientCheckBox(WindowManager);
            chkNotifyOnUserListChange.Name            = "chkNotifyOnUserListChange";
            chkNotifyOnUserListChange.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPlaySoundOnGameHosted.Bottom + 12, 0, 0);
            chkNotifyOnUserListChange.Text = "Show player join / quit messages" + Environment.NewLine +
                                             "on CnCNet lobby";

            AddChild(chkNotifyOnUserListChange);

            chkSkipLoginWindow                 = new XNAClientCheckBox(WindowManager);
            chkSkipLoginWindow.Name            = "chkSkipLoginWindow";
            chkSkipLoginWindow.ClientRectangle = new Rectangle(
                276,
                12, 0, 0);
            chkSkipLoginWindow.Text            = "Skip login dialog";
            chkSkipLoginWindow.CheckedChanged += ChkSkipLoginWindow_CheckedChanged;

            AddChild(chkSkipLoginWindow);

            chkPersistentMode                 = new XNAClientCheckBox(WindowManager);
            chkPersistentMode.Name            = "chkPersistentMode";
            chkPersistentMode.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkSkipLoginWindow.Bottom + 12, 0, 0);
            chkPersistentMode.Text            = "Stay connected outside of the CnCNet lobby";
            chkPersistentMode.CheckedChanged += ChkPersistentMode_CheckedChanged;

            AddChild(chkPersistentMode);

            chkConnectOnStartup                 = new XNAClientCheckBox(WindowManager);
            chkConnectOnStartup.Name            = "chkConnectOnStartup";
            chkConnectOnStartup.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkPersistentMode.Bottom + 12, 0, 0);
            chkConnectOnStartup.Text          = "Connect automatically on client startup";
            chkConnectOnStartup.AllowChecking = false;

            AddChild(chkConnectOnStartup);

            chkDiscordIntegration                 = new XNAClientCheckBox(WindowManager);
            chkDiscordIntegration.Name            = "chkDiscordIntegration";
            chkDiscordIntegration.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkConnectOnStartup.Bottom + 12, 0, 0);
            chkDiscordIntegration.Text = "Show detailed game info in Discord status";

            if (String.IsNullOrEmpty(ClientConfiguration.Instance.DiscordAppId))
            {
                chkDiscordIntegration.AllowChecking = false;
                chkDiscordIntegration.Checked       = false;
            }
            else
            {
                chkDiscordIntegration.AllowChecking = true;
            }

            AddChild(chkDiscordIntegration);

            var lblFollowedGames = new XNALabel(WindowManager);

            lblFollowedGames.Name            = "lblFollowedGames";
            lblFollowedGames.ClientRectangle = new Rectangle(
                chkNotifyOnUserListChange.X,
                chkNotifyOnUserListChange.Bottom + 24, 0, 0);
            lblFollowedGames.Text = "Show game rooms from the following games:";

            AddChild(lblFollowedGames);

            int chkCount          = 0;
            int chkCountPerColumn = 5;
            int nextColumnXOffset = 0;
            int columnXOffset     = 0;

            foreach (CnCNetGame game in gameCollection.GameList)
            {
                if (!game.Supported || string.IsNullOrEmpty(game.GameBroadcastChannel))
                {
                    continue;
                }

                if (chkCount == chkCountPerColumn)
                {
                    chkCount          = 0;
                    columnXOffset    += nextColumnXOffset + 6;
                    nextColumnXOffset = 0;
                }

                var panel = new XNAPanel(WindowManager);
                panel.Name            = "panel" + game.InternalName;
                panel.ClientRectangle = new Rectangle(chkPingUnofficialTunnels.X + columnXOffset,
                                                      lblFollowedGames.Bottom + 12 + chkCount * 22, 16, 16);
                panel.DrawBorders       = false;
                panel.BackgroundTexture = game.Texture;

                var chkBox = new XNAClientCheckBox(WindowManager);
                chkBox.Name            = game.InternalName.ToUpper();
                chkBox.ClientRectangle = new Rectangle(
                    panel.Right + 6,
                    panel.Y, 0, 0);
                chkBox.Text = game.UIName;

                chkCount++;

                AddChild(panel);
                AddChild(chkBox);
                followedGameChks.Add(chkBox);

                if (chkBox.Right > nextColumnXOffset)
                {
                    nextColumnXOffset = chkBox.Right;
                }
            }
        }
예제 #11
0
        public override void Initialize()
        {
            Name              = "CnCNetLoginWindow";
            ClientRectangle   = new Rectangle(0, 0, 300, 220);
            BackgroundTexture = AssetLoader.LoadTextureUncached("logindialogbg.png");

            lblConnectToCnCNet           = new XNALabel(WindowManager);
            lblConnectToCnCNet.Name      = "lblConnectToCnCNet";
            lblConnectToCnCNet.FontIndex = 1;
            lblConnectToCnCNet.Text      = "CONNECT TO CNCNET";

            AddChild(lblConnectToCnCNet);
            lblConnectToCnCNet.CenterOnParent();
            lblConnectToCnCNet.ClientRectangle = new Rectangle(
                lblConnectToCnCNet.ClientRectangle.X, 12,
                lblConnectToCnCNet.ClientRectangle.Width,
                lblConnectToCnCNet.ClientRectangle.Height);

            tbPlayerName                   = new XNATextBox(WindowManager);
            tbPlayerName.Name              = "tbPlayerName";
            tbPlayerName.ClientRectangle   = new Rectangle(ClientRectangle.Width - 132, 50, 120, 19);
            tbPlayerName.MaximumTextLength = ClientConfiguration.Instance.MaxNameLength;
            string defgame = ClientConfiguration.Instance.LocalGame;

            lblPlayerName                 = new XNALabel(WindowManager);
            lblPlayerName.Name            = "lblPlayerName";
            lblPlayerName.FontIndex       = 1;
            lblPlayerName.Text            = "PLAYER NAME:";
            lblPlayerName.ClientRectangle = new Rectangle(12, tbPlayerName.ClientRectangle.Y + 1,
                                                          lblPlayerName.ClientRectangle.Width, lblPlayerName.ClientRectangle.Height);

            chkRememberMe                 = new XNAClientCheckBox(WindowManager);
            chkRememberMe.Name            = "chkRememberMe";
            chkRememberMe.ClientRectangle = new Rectangle(12, tbPlayerName.ClientRectangle.Bottom + 12, 0, 0);
            chkRememberMe.Text            = "Remember me";
            chkRememberMe.TextPadding     = 7;
            chkRememberMe.CheckedChanged += ChkRememberMe_CheckedChanged;

            chkPersistentMode                 = new XNAClientCheckBox(WindowManager);
            chkPersistentMode.Name            = "chkPersistentMode";
            chkPersistentMode.ClientRectangle = new Rectangle(12, chkRememberMe.ClientRectangle.Bottom + 30, 0, 0);
            chkPersistentMode.Text            = "Stay connected outside of the CnCNet lobby";
            chkPersistentMode.TextPadding     = chkRememberMe.TextPadding;
            chkPersistentMode.CheckedChanged += ChkPersistentMode_CheckedChanged;

            chkAutoConnect                 = new XNAClientCheckBox(WindowManager);
            chkAutoConnect.Name            = "chkAutoConnect";
            chkAutoConnect.ClientRectangle = new Rectangle(12, chkPersistentMode.ClientRectangle.Bottom + 30, 0, 0);
            chkAutoConnect.Text            = "Connect automatically on client startup";
            chkAutoConnect.TextPadding     = chkRememberMe.TextPadding;
            chkAutoConnect.AllowChecking   = false;

            btnConnect                 = new XNAClientButton(WindowManager);
            btnConnect.Name            = "btnConnect";
            btnConnect.ClientRectangle = new Rectangle(12, ClientRectangle.Height - 35, 110, 23);
            btnConnect.Text            = "Connect";
            btnConnect.LeftClick      += BtnConnect_LeftClick;

            btnCancel                 = new XNAClientButton(WindowManager);
            btnCancel.Name            = "btnCancel";
            btnCancel.ClientRectangle = new Rectangle(ClientRectangle.Width - 122, btnConnect.ClientRectangle.Y, 110, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            AddChild(tbPlayerName);
            AddChild(lblPlayerName);
            AddChild(chkRememberMe);
            AddChild(chkPersistentMode);
            AddChild(chkAutoConnect);
            AddChild(btnConnect);
            AddChild(btnCancel);

            base.Initialize();

            CenterOnParent();

            UserINISettings.Instance.SettingsSaved += Instance_SettingsSaved;
        }
        public override void Initialize()
        {
            Name = "MultiplayerGameLobby";

            base.Initialize();

            InitPlayerOptionDropdowns();

            ReadyBoxes = new XNACheckBox[MAX_PLAYER_COUNT];

            int readyBoxX = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxX", 7);
            int readyBoxY = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxY", 4);

            for (int i = 0; i < MAX_PLAYER_COUNT; i++)
            {
                XNACheckBox chkPlayerReady = new XNACheckBox(WindowManager);
                chkPlayerReady.Name            = "chkPlayerReady" + i;
                chkPlayerReady.Checked         = false;
                chkPlayerReady.AllowChecking   = false;
                chkPlayerReady.ClientRectangle = new Rectangle(readyBoxX, ddPlayerTeams[i].Y + readyBoxY,
                                                               0, 0);

                PlayerOptionsPanel.AddChild(chkPlayerReady);

                chkPlayerReady.DisabledClearTexture   = chkPlayerReady.ClearTexture;
                chkPlayerReady.DisabledCheckedTexture = chkPlayerReady.CheckedTexture;

                ReadyBoxes[i] = chkPlayerReady;
                ddPlayerSides[i].AddItem("Spectator", AssetLoader.LoadTexture("spectatoricon.png"));
            }

            ddGameMode.ClientRectangle = new Rectangle(
                MapPreviewBox.X - 12 - ddGameMode.Width,
                MapPreviewBox.Y, ddGameMode.Width,
                ddGameMode.Height);

            lblGameModeSelect.ClientRectangle = new Rectangle(
                btnLaunchGame.X, ddGameMode.Y + 1,
                lblGameModeSelect.Width, lblGameModeSelect.Height);

            lbMapList.ClientRectangle = new Rectangle(btnLaunchGame.X,
                                                      MapPreviewBox.Y + 23,
                                                      MapPreviewBox.X - btnLaunchGame.X - 12,
                                                      MapPreviewBox.Height - 23);

            lbChatMessages                 = new ChatListBox(WindowManager);
            lbChatMessages.Name            = "lbChatMessages";
            lbChatMessages.ClientRectangle = new Rectangle(lbMapList.X,
                                                           GameOptionsPanel.Y,
                                                           lbMapList.Width, GameOptionsPanel.Height - 24);
            lbChatMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbChatMessages.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbChatMessages.LineHeight  = 16;
            lbChatMessages.DrawOrder   = -1;
            lbChatMessages.UpdateOrder = -1;

            tbChatInput                 = new XNAChatTextBox(WindowManager);
            tbChatInput.Name            = "tbChatInput";
            tbChatInput.Suggestion      = "Type here to chat..";
            tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.X,
                                                        lbChatMessages.Bottom + 3,
                                                        lbChatMessages.Width, 21);
            tbChatInput.MaximumTextLength = 150;
            tbChatInput.EnterPressed     += TbChatInput_EnterPressed;
            tbChatInput.DrawOrder         = 1;
            tbChatInput.UpdateOrder       = 1;

            btnLockGame                 = new XNAClientButton(WindowManager);
            btnLockGame.Name            = "btnLockGame";
            btnLockGame.ClientRectangle = new Rectangle(btnLaunchGame.Right + 12,
                                                        btnLaunchGame.Y, 133, 23);
            btnLockGame.Text       = "Lock Game";
            btnLockGame.LeftClick += BtnLockGame_LeftClick;

            chkAutoReady                 = new XNAClientCheckBox(WindowManager);
            chkAutoReady.Name            = "chkAutoReady";
            chkAutoReady.ClientRectangle = new Rectangle(btnLaunchGame.Right + 12,
                                                         btnLaunchGame.Y + 2, 133, 23);
            chkAutoReady.Text            = "Auto-Ready";
            chkAutoReady.CheckedChanged += ChkAutoReady_CheckedChanged;
            chkAutoReady.Disable();

            AddChild(lbChatMessages);
            AddChild(tbChatInput);
            AddChild(btnLockGame);
            AddChild(chkAutoReady);

            MapPreviewBox.LocalStartingLocationSelected += MapPreviewBox_LocalStartingLocationSelected;
            MapPreviewBox.StartingLocationApplied       += MapPreviewBox_StartingLocationApplied;

            InitializeWindow();

            sndJoinSound     = new EnhancedSoundEffect("joingame.wav");
            sndLeaveSound    = new EnhancedSoundEffect("leavegame.wav");
            sndMessageSound  = new EnhancedSoundEffect("message.wav");
            sndGetReadySound = new EnhancedSoundEffect("getready.wav", 0.0, 0.0, 5.0f);

            if (SavedGameManager.AreSavedGamesAvailable())
            {
                fsw                     = new FileSystemWatcher(ProgramConstants.GamePath + "Saved Games", "*.NET");
                fsw.Created            += fsw_Created;
                fsw.Changed            += fsw_Created;
                fsw.EnableRaisingEvents = false;
            }
            else
            {
                Logger.Log("MultiplayerGameLobby: Saved games are not available!");
            }

            CenterOnParent();

            // To move the lblMapAuthor label into its correct position
            // if it was moved in the theme description INI file
            LoadDefaultMap();
        }
        public override void Initialize()
        {
            base.Initialize();

            Name = "AudioOptionsPanel";

            var lblScoreVolume = new XNALabel(WindowManager);

            lblScoreVolume.Name            = "lblScoreVolume";
            lblScoreVolume.ClientRectangle = new Rectangle(12, 14, 0, 0);
            lblScoreVolume.Text            = "Music Volume:";

            lblScoreVolumeValue                 = new XNALabel(WindowManager);
            lblScoreVolumeValue.Name            = "lblScoreVolumeValue";
            lblScoreVolumeValue.FontIndex       = 1;
            lblScoreVolumeValue.Text            = "10";
            lblScoreVolumeValue.ClientRectangle = new Rectangle(
                ClientRectangle.Width - lblScoreVolumeValue.ClientRectangle.Width - 12,
                lblScoreVolume.ClientRectangle.Y, 0, 0);

            trbScoreVolume                 = new XNATrackbar(WindowManager);
            trbScoreVolume.Name            = "trbScoreVolume";
            trbScoreVolume.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.Right + 16,
                lblScoreVolume.ClientRectangle.Y - 2,
                lblScoreVolumeValue.ClientRectangle.X - lblScoreVolume.ClientRectangle.Right - 31,
                22);
            trbScoreVolume.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2);
            trbScoreVolume.MinValue          = 0;
            trbScoreVolume.MaxValue          = 10;
            trbScoreVolume.ValueChanged     += TrbScoreVolume_ValueChanged;

            var lblSoundVolume = new XNALabel(WindowManager);

            lblSoundVolume.Name            = "lblSoundVolume";
            lblSoundVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                           lblScoreVolume.ClientRectangle.Bottom + 20, 0, 0);
            lblSoundVolume.Text = "Sound Volume:";

            lblSoundVolumeValue                 = new XNALabel(WindowManager);
            lblSoundVolumeValue.Name            = "lblSoundVolumeValue";
            lblSoundVolumeValue.FontIndex       = 1;
            lblSoundVolumeValue.Text            = "10";
            lblSoundVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblSoundVolume.ClientRectangle.Y, 0, 0);

            trbSoundVolume                 = new XNATrackbar(WindowManager);
            trbSoundVolume.Name            = "trbSoundVolume";
            trbSoundVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblSoundVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbSoundVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbSoundVolume.MinValue          = 0;
            trbSoundVolume.MaxValue          = 10;
            trbSoundVolume.ValueChanged     += TrbSoundVolume_ValueChanged;

            var lblVoiceVolume = new XNALabel(WindowManager);

            lblVoiceVolume.Name            = "lblVoiceVolume";
            lblVoiceVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                           lblSoundVolume.ClientRectangle.Bottom + 20, 0, 0);
            lblVoiceVolume.Text = "Voice Volume:";

            lblVoiceVolumeValue                 = new XNALabel(WindowManager);
            lblVoiceVolumeValue.Name            = "lblVoiceVolumeValue";
            lblVoiceVolumeValue.FontIndex       = 1;
            lblVoiceVolumeValue.Text            = "10";
            lblVoiceVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblVoiceVolume.ClientRectangle.Y, 0, 0);

            trbVoiceVolume                 = new XNATrackbar(WindowManager);
            trbVoiceVolume.Name            = "trbVoiceVolume";
            trbVoiceVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblVoiceVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbVoiceVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbVoiceVolume.MinValue          = 0;
            trbVoiceVolume.MaxValue          = 10;
            trbVoiceVolume.ValueChanged     += TrbVoiceVolume_ValueChanged;

            chkScoreShuffle                 = new XNAClientCheckBox(WindowManager);
            chkScoreShuffle.Name            = "chkScoreShuffle";
            chkScoreShuffle.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X,
                trbVoiceVolume.ClientRectangle.Bottom + 12, 0, 0);
            chkScoreShuffle.Text = "Shuffle Music";

            var lblClientVolume = new XNALabel(WindowManager);

            lblClientVolume.Name            = "lblClientVolume";
            lblClientVolume.ClientRectangle = new Rectangle(lblScoreVolume.ClientRectangle.X,
                                                            chkScoreShuffle.ClientRectangle.Bottom + 40, 0, 0);
            lblClientVolume.Text = "Client Volume:";

            lblClientVolumeValue                 = new XNALabel(WindowManager);
            lblClientVolumeValue.Name            = "lblClientVolumeValue";
            lblClientVolumeValue.FontIndex       = 1;
            lblClientVolumeValue.Text            = "10";
            lblClientVolumeValue.ClientRectangle = new Rectangle(
                lblScoreVolumeValue.ClientRectangle.X,
                lblClientVolume.ClientRectangle.Y, 0, 0);

            trbClientVolume                 = new XNATrackbar(WindowManager);
            trbClientVolume.Name            = "trbClientVolume";
            trbClientVolume.ClientRectangle = new Rectangle(
                trbScoreVolume.ClientRectangle.X,
                lblClientVolume.ClientRectangle.Y - 2,
                trbScoreVolume.ClientRectangle.Width,
                trbScoreVolume.ClientRectangle.Height);
            trbClientVolume.BackgroundTexture = trbScoreVolume.BackgroundTexture;
            trbClientVolume.MinValue          = 0;
            trbClientVolume.MaxValue          = 10;
            trbClientVolume.ValueChanged     += TrbClientVolume_ValueChanged;

            chkMainMenuMusic                 = new XNAClientCheckBox(WindowManager);
            chkMainMenuMusic.Name            = "chkMainMenuMusic";
            chkMainMenuMusic.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X,
                trbClientVolume.ClientRectangle.Bottom + 12, 0, 0);
            chkMainMenuMusic.Text            = "Main menu music";
            chkMainMenuMusic.CheckedChanged += ChkMainMenuMusic_CheckedChanged;

            chkStopMusicOnMenu                 = new XNAClientCheckBox(WindowManager);
            chkStopMusicOnMenu.Name            = "chkStopMusicOnMenu";
            chkStopMusicOnMenu.ClientRectangle = new Rectangle(
                lblScoreVolume.ClientRectangle.X, chkMainMenuMusic.ClientRectangle.Bottom + 24, 0, 0);
            chkStopMusicOnMenu.Text = "Don't play main menu music in lobbies";

#if DTA
            var chkRABuildingCrumbleSound = new FileSettingCheckBox(WindowManager,
                                                                    "Resources\\Ecache03.mix", "MIX\\Ecache03.mix", false);
            chkRABuildingCrumbleSound.Name            = "chkRABuildingCrumbleSound";
            chkRABuildingCrumbleSound.ClientRectangle = new Rectangle(
                chkStopMusicOnMenu.ClientRectangle.X,
                chkStopMusicOnMenu.ClientRectangle.Bottom + 24, 0, 0);
            chkRABuildingCrumbleSound.Text = "Use Red Alert building crumble sound";

            var chkReplaceRACannonSounds = new FileSettingCheckBox(WindowManager,
                                                                   "Resources\\Ecache02.mix", "MIX\\Ecache02.mix", false);
            chkReplaceRACannonSounds.Name            = "chkReplaceRACannonSounds";
            chkReplaceRACannonSounds.ClientRectangle = new Rectangle(
                chkMainMenuMusic.ClientRectangle.X,
                chkRABuildingCrumbleSound.ClientRectangle.Bottom + 24, 0, 0);
            chkReplaceRACannonSounds.Text = "Replace Red Alert cannon sounds with Tiberian Dawn cannon sounds";

            fileSettingCheckBoxes.Add(chkRABuildingCrumbleSound);
            fileSettingCheckBoxes.Add(chkReplaceRACannonSounds);
#endif

            fileSettingCheckBoxes.ForEach(chkBox => AddChild(chkBox));

            AddChild(lblScoreVolume);
            AddChild(lblScoreVolumeValue);
            AddChild(trbScoreVolume);
            AddChild(lblSoundVolume);
            AddChild(lblSoundVolumeValue);
            AddChild(trbSoundVolume);
            AddChild(lblVoiceVolume);
            AddChild(lblVoiceVolumeValue);
            AddChild(trbVoiceVolume);

            AddChild(chkScoreShuffle);

            AddChild(lblClientVolume);
            AddChild(lblClientVolumeValue);
            AddChild(trbClientVolume);

            AddChild(chkMainMenuMusic);
            AddChild(chkStopMusicOnMenu);

            lblScoreVolumeValue.Text  = trbScoreVolume.Value.ToString();
            lblSoundVolumeValue.Text  = trbSoundVolume.Value.ToString();
            lblVoiceVolumeValue.Text  = trbVoiceVolume.Value.ToString();
            lblClientVolumeValue.Text = trbClientVolume.Value.ToString();
            AudioMaster.SetVolume(trbClientVolume.Value / 10.0f);
        }
예제 #14
0
        public override void Initialize()
        {
            base.Initialize();

            Name = "DisplayOptionsPanel";

            var lblIngameResolution = new XNALabel(WindowManager);

            lblIngameResolution.Name            = "lblIngameResolution";
            lblIngameResolution.ClientRectangle = new Rectangle(12, 14, 0, 0);
            lblIngameResolution.Text            = "In-game Resolution:";

            ddIngameResolution                 = new XNAClientDropDown(WindowManager);
            ddIngameResolution.Name            = "ddIngameResolution";
            ddIngameResolution.ClientRectangle = new Rectangle(
                lblIngameResolution.ClientRectangle.Right + 12,
                lblIngameResolution.ClientRectangle.Y - 2, 120, 19);

#if TI
            var resolutions = GetResolutions(800, 600, 4096, 4096);
#else
            var resolutions = GetResolutions(640, 480, 4096, 4096);
#endif
            resolutions.Sort();

            foreach (var res in resolutions)
            {
                ddIngameResolution.AddItem(res.ToString());
            }

            var lblDetailLevel = new XNALabel(WindowManager);
            lblDetailLevel.Name            = "lblDetailLevel";
            lblDetailLevel.ClientRectangle = new Rectangle(lblIngameResolution.ClientRectangle.X,
                                                           ddIngameResolution.ClientRectangle.Bottom + 16, 0, 0);
            lblDetailLevel.Text = "Detail Level:";

            ddDetailLevel                 = new XNAClientDropDown(WindowManager);
            ddDetailLevel.Name            = "ddDetailLevel";
            ddDetailLevel.ClientRectangle = new Rectangle(
                ddIngameResolution.ClientRectangle.X,
                lblDetailLevel.ClientRectangle.Y - 2,
                ddIngameResolution.ClientRectangle.Width,
                ddIngameResolution.ClientRectangle.Height);
            ddDetailLevel.AddItem("Low");
            ddDetailLevel.AddItem("Medium");
            ddDetailLevel.AddItem("High");

            var lblRenderer = new XNALabel(WindowManager);
            lblRenderer.Name            = "lblRenderer";
            lblRenderer.ClientRectangle = new Rectangle(lblDetailLevel.ClientRectangle.X,
                                                        ddDetailLevel.ClientRectangle.Bottom + 16, 0, 0);
            lblRenderer.Text = "Renderer:";

            ddRenderer                 = new XNAClientDropDown(WindowManager);
            ddRenderer.Name            = "ddRenderer";
            ddRenderer.ClientRectangle = new Rectangle(
                ddDetailLevel.ClientRectangle.X,
                lblRenderer.ClientRectangle.Y - 2,
                ddDetailLevel.ClientRectangle.Width,
                ddDetailLevel.ClientRectangle.Height);

            ddRenderer.AddItem("Default");
            ddRenderer.AddItem("IE-DDRAW");
            ddRenderer.AddItem("TS-DDRAW");
            ddRenderer.AddItem("DDWrapper");
            ddRenderer.AddItem("DxWnd");
            if (ClientConfiguration.Instance.GetOperatingSystemVersion() == OSVersion.WINXP)
            {
                ddRenderer.AddItem("Software");
            }

            chkWindowedMode                 = new XNAClientCheckBox(WindowManager);
            chkWindowedMode.Name            = "chkWindowedMode";
            chkWindowedMode.ClientRectangle = new Rectangle(lblDetailLevel.ClientRectangle.X,
                                                            ddRenderer.ClientRectangle.Bottom + 16, 0, 0);
            chkWindowedMode.Text            = "Windowed Mode";
            chkWindowedMode.CheckedChanged += ChkWindowedMode_CheckedChanged;

            chkBorderlessWindowedMode                 = new XNAClientCheckBox(WindowManager);
            chkBorderlessWindowedMode.Name            = "chkBorderlessWindowedMode";
            chkBorderlessWindowedMode.ClientRectangle = new Rectangle(
                chkWindowedMode.ClientRectangle.X + 50,
                chkWindowedMode.ClientRectangle.Bottom + 24, 0, 0);
            chkBorderlessWindowedMode.Text          = "Borderless Windowed Mode";
            chkBorderlessWindowedMode.AllowChecking = false;

            chkBackBufferInVRAM                 = new XNAClientCheckBox(WindowManager);
            chkBackBufferInVRAM.Name            = "chkBackBufferInVRAM";
            chkBackBufferInVRAM.ClientRectangle = new Rectangle(
                lblDetailLevel.ClientRectangle.X,
                chkBorderlessWindowedMode.ClientRectangle.Bottom + 28, 0, 0);
            chkBackBufferInVRAM.Text = "Back Buffer in Video Memory" + Environment.NewLine +
                                       "(lower performance, but is" + Environment.NewLine + "necessary on some systems)";

            var lblClientResolution = new XNALabel(WindowManager);
            lblClientResolution.Name            = "lblClientResolution";
            lblClientResolution.ClientRectangle = new Rectangle(
                285, 14, 0, 0);
            lblClientResolution.Text = "Client Resolution:";

            ddClientResolution                 = new XNAClientDropDown(WindowManager);
            ddClientResolution.Name            = "ddClientResolution";
            ddClientResolution.ClientRectangle = new Rectangle(
                lblClientResolution.ClientRectangle.Right + 12,
                lblClientResolution.ClientRectangle.Y - 2,
                ClientRectangle.Width - (lblClientResolution.ClientRectangle.Right + 24),
                ddIngameResolution.ClientRectangle.Height);
            ddClientResolution.AllowDropDown = false;

            var screenBounds = Screen.PrimaryScreen.Bounds;

            resolutions = GetResolutions(800, 600,
                                         screenBounds.Width, screenBounds.Height);

            // Add "optimal" client resolutions for windowed mode
            // if they're not supported in fullscreen mode

            AddResolutionIfFitting(1024, 600, resolutions);
            AddResolutionIfFitting(1024, 720, resolutions);
            AddResolutionIfFitting(1280, 600, resolutions);
            AddResolutionIfFitting(1280, 720, resolutions);
            AddResolutionIfFitting(1280, 768, resolutions);
            AddResolutionIfFitting(1280, 800, resolutions);

            resolutions.Sort();

            foreach (var res in resolutions)
            {
                var item = new XNADropDownItem();
                item.Text      = res.ToString();
                item.Tag       = res.ToString();
                item.TextColor = UISettings.AltColor;
                ddClientResolution.AddItem(item);
            }

            // So we add the optimal resolutions to the list, sort it and then find
            // out the optimal resolution index - it's inefficient, but works

            int optimalWindowedResIndex = resolutions.FindIndex(res => res.ToString() == "1280x800");
            if (optimalWindowedResIndex == -1)
            {
                optimalWindowedResIndex = resolutions.FindIndex(res => res.ToString() == "1280x768");
            }

            if (optimalWindowedResIndex > -1)
            {
                var item = ddClientResolution.Items[optimalWindowedResIndex];
                item.Text = item.Text + " (recommended)";
            }

            chkBorderlessClient                 = new XNAClientCheckBox(WindowManager);
            chkBorderlessClient.Name            = "chkBorderlessClient";
            chkBorderlessClient.ClientRectangle = new Rectangle(
                lblClientResolution.ClientRectangle.X,
                lblDetailLevel.ClientRectangle.Y, 0, 0);
            chkBorderlessClient.Text            = "Fullscreen Client";
            chkBorderlessClient.CheckedChanged += ChkBorderlessMenu_CheckedChanged;
            chkBorderlessClient.Checked         = true;

            var lblClientTheme = new XNALabel(WindowManager);
            lblClientTheme.Name            = "lblClientTheme";
            lblClientTheme.ClientRectangle = new Rectangle(
                lblClientResolution.ClientRectangle.X,
                lblRenderer.ClientRectangle.Y, 0, 0);
            lblClientTheme.Text = "Client Theme:";

            ddClientTheme                 = new XNAClientDropDown(WindowManager);
            ddClientTheme.Name            = "ddClientTheme";
            ddClientTheme.ClientRectangle = new Rectangle(
                ddClientResolution.ClientRectangle.X,
                ddRenderer.ClientRectangle.Y,
                ddClientResolution.ClientRectangle.Width,
                ddRenderer.ClientRectangle.Height);

            int themeCount = ClientConfiguration.Instance.ThemeCount;

            for (int i = 0; i < themeCount; i++)
            {
                ddClientTheme.AddItem(ClientConfiguration.Instance.GetThemeInfoFromIndex(i)[0]);
            }

#if DTA
            chkEnableCannonTracers = new FileSettingCheckBox(WindowManager,
                                                             "Resources\\ECache91.mix", "MIX\\ECache91.mix", true);
            chkEnableCannonTracers.Name            = "chkEnableCannonTracers";
            chkEnableCannonTracers.ClientRectangle = new Rectangle(
                chkBorderlessClient.ClientRectangle.X,
                chkWindowedMode.ClientRectangle.Y, 0, 0);
            chkEnableCannonTracers.Text = "Use Cannon Tracers";

            AddChild(chkEnableCannonTracers);

            fileSettingCheckBoxes.Add(chkEnableCannonTracers);
#elif TI
            chkSmallerVehicleGraphics = new FileSettingCheckBox(WindowManager,
                                                                "Resources\\ecache02.mix", "MIX\\ecache02.mix", false);
            chkSmallerVehicleGraphics.AddFile("Resources\\expand02.mix", "MIX\\expand02.mix");
            chkSmallerVehicleGraphics.Name            = "chkSmallerVehicleGraphics";
            chkSmallerVehicleGraphics.ClientRectangle = new Rectangle(
                chkBorderlessClient.ClientRectangle.X,
                chkWindowedMode.ClientRectangle.Y, 0, 0);
            chkSmallerVehicleGraphics.Text = "Smaller Vehicle Graphics";

            AddChild(chkSmallerVehicleGraphics);
            fileSettingCheckBoxes.Add(chkSmallerVehicleGraphics);

            chkLargerInfantryGraphics = new FileSettingCheckBox(WindowManager,
                                                                "Resources\\ecache01.mix", "MIX\\ecache01.mix", false);
            chkLargerInfantryGraphics.Name            = "chkLargerInfantryGraphics";
            chkLargerInfantryGraphics.ClientRectangle = new Rectangle(
                chkSmallerVehicleGraphics.ClientRectangle.X,
                chkBorderlessWindowedMode.ClientRectangle.Y, 0, 0);
            chkLargerInfantryGraphics.Text = "Larger Infantry Graphics";

            AddChild(chkLargerInfantryGraphics);
            fileSettingCheckBoxes.Add(chkLargerInfantryGraphics);
#endif

#if !YR
            lblCompatibilityFixes           = new XNALabel(WindowManager);
            lblCompatibilityFixes.Name      = "lblCompatibilityFixes";
            lblCompatibilityFixes.FontIndex = 1;
            lblCompatibilityFixes.Text      = "Compatibility Fixes (advanced):";
            AddChild(lblCompatibilityFixes);
            lblCompatibilityFixes.CenterOnParent();
            lblCompatibilityFixes.ClientRectangle = new Rectangle(
                lblCompatibilityFixes.ClientRectangle.X,
                ClientRectangle.Height - 103,
                lblCompatibilityFixes.ClientRectangle.Width,
                lblCompatibilityFixes.ClientRectangle.Height);

            lblGameCompatibilityFix                 = new XNALabel(WindowManager);
            lblGameCompatibilityFix.Name            = "lblGameCompatibilityFix";
            lblGameCompatibilityFix.ClientRectangle = new Rectangle(132,
                                                                    lblCompatibilityFixes.ClientRectangle.Bottom + 20, 0, 0);
            lblGameCompatibilityFix.Text = "DTA/TI/TS Compatibility Fix:";

            btnGameCompatibilityFix                 = new XNAClientButton(WindowManager);
            btnGameCompatibilityFix.Name            = "btnGameCompatibilityFix";
            btnGameCompatibilityFix.ClientRectangle = new Rectangle(
                lblGameCompatibilityFix.ClientRectangle.Right + 20,
                lblGameCompatibilityFix.ClientRectangle.Y - 4, 133, 23);
            btnGameCompatibilityFix.FontIndex  = 1;
            btnGameCompatibilityFix.Text       = "Enable";
            btnGameCompatibilityFix.LeftClick += BtnGameCompatibilityFix_LeftClick;

            lblMapEditorCompatibilityFix                 = new XNALabel(WindowManager);
            lblMapEditorCompatibilityFix.Name            = "lblMapEditorCompatibilityFix";
            lblMapEditorCompatibilityFix.ClientRectangle = new Rectangle(
                lblGameCompatibilityFix.ClientRectangle.X,
                lblGameCompatibilityFix.ClientRectangle.Bottom + 20, 0, 0);
            lblMapEditorCompatibilityFix.Text = "FinalSun Compatibility Fix:";

            btnMapEditorCompatibilityFix                 = new XNAClientButton(WindowManager);
            btnMapEditorCompatibilityFix.Name            = "btnMapEditorCompatibilityFix";
            btnMapEditorCompatibilityFix.ClientRectangle = new Rectangle(
                btnGameCompatibilityFix.ClientRectangle.X,
                lblMapEditorCompatibilityFix.ClientRectangle.Y - 4,
                btnGameCompatibilityFix.ClientRectangle.Width,
                btnGameCompatibilityFix.ClientRectangle.Height);
            btnMapEditorCompatibilityFix.FontIndex  = 1;
            btnMapEditorCompatibilityFix.Text       = "Enable";
            btnMapEditorCompatibilityFix.LeftClick += BtnMapEditorCompatibilityFix_LeftClick;

            AddChild(lblGameCompatibilityFix);
            AddChild(btnGameCompatibilityFix);
            AddChild(lblMapEditorCompatibilityFix);
            AddChild(btnMapEditorCompatibilityFix);
#endif

            AddChild(chkWindowedMode);
            AddChild(chkBorderlessWindowedMode);
            AddChild(chkBackBufferInVRAM);
            AddChild(chkBorderlessClient);
            AddChild(lblClientTheme);
            AddChild(ddClientTheme);
            AddChild(lblClientResolution);
            AddChild(ddClientResolution);
            AddChild(lblRenderer);
            AddChild(ddRenderer);
            AddChild(lblDetailLevel);
            AddChild(ddDetailLevel);
            AddChild(lblIngameResolution);
            AddChild(ddIngameResolution);
        }
        private void InitOptions()
        {
            // LEFT COLUMN

            chkPingUnofficialTunnels                 = new XNAClientCheckBox(WindowManager);
            chkPingUnofficialTunnels.Name            = nameof(chkPingUnofficialTunnels);
            chkPingUnofficialTunnels.ClientRectangle = new Rectangle(12, 12, 0, 0);
            chkPingUnofficialTunnels.Text            = "Ping unofficial CnCNet tunnels";

            AddChild(chkPingUnofficialTunnels);

            chkWriteInstallPathToRegistry                 = new XNAClientCheckBox(WindowManager);
            chkWriteInstallPathToRegistry.Name            = nameof(chkWriteInstallPathToRegistry);
            chkWriteInstallPathToRegistry.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPingUnofficialTunnels.Bottom + 12, 0, 0);
            chkWriteInstallPathToRegistry.Text = "Write game installation path to Windows" + Environment.NewLine +
                                                 "Registry (makes it possible to join" + Environment.NewLine +
                                                 "other games' game rooms on CnCNet)";

            AddChild(chkWriteInstallPathToRegistry);

            chkPlaySoundOnGameHosted                 = new XNAClientCheckBox(WindowManager);
            chkPlaySoundOnGameHosted.Name            = nameof(chkPlaySoundOnGameHosted);
            chkPlaySoundOnGameHosted.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkWriteInstallPathToRegistry.Bottom + 12, 0, 0);
            chkPlaySoundOnGameHosted.Text = "Play sound when a game is hosted";

            AddChild(chkPlaySoundOnGameHosted);

            chkNotifyOnUserListChange                 = new XNAClientCheckBox(WindowManager);
            chkNotifyOnUserListChange.Name            = nameof(chkNotifyOnUserListChange);
            chkNotifyOnUserListChange.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPlaySoundOnGameHosted.Bottom + 12, 0, 0);
            chkNotifyOnUserListChange.Text = "Show player join / quit messages" + Environment.NewLine +
                                             "on CnCNet lobby";

            AddChild(chkNotifyOnUserListChange);

            chkDisablePrivateMessagePopup                 = new XNAClientCheckBox(WindowManager);
            chkDisablePrivateMessagePopup.Name            = nameof(chkDisablePrivateMessagePopup);
            chkDisablePrivateMessagePopup.ClientRectangle = new Rectangle(
                chkNotifyOnUserListChange.X,
                chkNotifyOnUserListChange.Bottom + 8, 0, 0);
            chkDisablePrivateMessagePopup.Text = "Disable Popups from Private Messages";

            AddChild(chkDisablePrivateMessagePopup);

            InitAllowPrivateMessagesFromDropdown();

            // RIGHT COLUMN

            chkSkipLoginWindow                 = new XNAClientCheckBox(WindowManager);
            chkSkipLoginWindow.Name            = nameof(chkSkipLoginWindow);
            chkSkipLoginWindow.ClientRectangle = new Rectangle(
                276,
                12, 0, 0);
            chkSkipLoginWindow.Text            = "Skip login dialog";
            chkSkipLoginWindow.CheckedChanged += ChkSkipLoginWindow_CheckedChanged;

            AddChild(chkSkipLoginWindow);

            chkPersistentMode                 = new XNAClientCheckBox(WindowManager);
            chkPersistentMode.Name            = nameof(chkPersistentMode);
            chkPersistentMode.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkSkipLoginWindow.Bottom + 12, 0, 0);
            chkPersistentMode.Text            = "Stay connected outside of the CnCNet lobby";
            chkPersistentMode.CheckedChanged += ChkPersistentMode_CheckedChanged;

            AddChild(chkPersistentMode);

            chkConnectOnStartup                 = new XNAClientCheckBox(WindowManager);
            chkConnectOnStartup.Name            = nameof(chkConnectOnStartup);
            chkConnectOnStartup.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkPersistentMode.Bottom + 12, 0, 0);
            chkConnectOnStartup.Text          = "Connect automatically on client startup";
            chkConnectOnStartup.AllowChecking = false;

            AddChild(chkConnectOnStartup);

            chkDiscordIntegration                 = new XNAClientCheckBox(WindowManager);
            chkDiscordIntegration.Name            = nameof(chkDiscordIntegration);
            chkDiscordIntegration.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkConnectOnStartup.Bottom + 12, 0, 0);
            chkDiscordIntegration.Text = "Show detailed game info in Discord status";

            if (String.IsNullOrEmpty(ClientConfiguration.Instance.DiscordAppId))
            {
                chkDiscordIntegration.AllowChecking = false;
                chkDiscordIntegration.Checked       = false;
            }
            else
            {
                chkDiscordIntegration.AllowChecking = true;
            }

            AddChild(chkDiscordIntegration);

            chkAllowGameInvitesFromFriendsOnly                 = new XNAClientCheckBox(WindowManager);
            chkAllowGameInvitesFromFriendsOnly.Name            = nameof(chkAllowGameInvitesFromFriendsOnly);
            chkAllowGameInvitesFromFriendsOnly.ClientRectangle = new Rectangle(
                chkDiscordIntegration.X,
                chkDiscordIntegration.Bottom + 12, 0, 0);
            chkAllowGameInvitesFromFriendsOnly.Text = "Only receive game invitations from friends";

            AddChild(chkAllowGameInvitesFromFriendsOnly);
        }
        private void InitGameListPanel()
        {
            const int gameListPanelHeight = 185;
            XNAPanel  gameListPanel       = new XNAPanel(WindowManager);

            gameListPanel.DrawBorders     = false;
            gameListPanel.Name            = nameof(gameListPanel);
            gameListPanel.ClientRectangle = new Rectangle(0, Bottom - gameListPanelHeight, Width, gameListPanelHeight);

            AddChild(gameListPanel);

            var lblFollowedGames = new XNALabel(WindowManager);

            lblFollowedGames.Name            = nameof(lblFollowedGames);
            lblFollowedGames.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblFollowedGames.Text            = "Show game rooms from the following games:";

            gameListPanel.AddChild(lblFollowedGames);

            int chkCount          = 0;
            int chkCountPerColumn = 4;
            int nextColumnXOffset = 0;
            int columnXOffset     = 0;

            foreach (CnCNetGame game in gameCollection.GameList)
            {
                if (!game.Supported || string.IsNullOrEmpty(game.GameBroadcastChannel))
                {
                    continue;
                }

                if (chkCount == chkCountPerColumn)
                {
                    chkCount          = 0;
                    columnXOffset    += nextColumnXOffset + 6;
                    nextColumnXOffset = 0;
                }

                var panel = new XNAPanel(WindowManager);
                panel.Name            = "panel" + game.InternalName;
                panel.ClientRectangle = new Rectangle(lblFollowedGames.X + columnXOffset,
                                                      lblFollowedGames.Bottom + 12 + chkCount * 22, 16, 16);
                panel.DrawBorders       = false;
                panel.BackgroundTexture = game.Texture;

                var chkBox = new XNAClientCheckBox(WindowManager);
                chkBox.Name            = game.InternalName.ToUpper();
                chkBox.ClientRectangle = new Rectangle(
                    panel.Right + 6,
                    panel.Y, 0, 0);
                chkBox.Text = game.UIName;

                chkCount++;

                gameListPanel.AddChild(panel);
                gameListPanel.AddChild(chkBox);
                followedGameChks.Add(chkBox);

                if (chkBox.Right > nextColumnXOffset)
                {
                    nextColumnXOffset = chkBox.Right;
                }
            }
        }