private void InitializeComponents()
        {
            //BackColor = ColorTranslator.FromHtml("#6B260B");
            //BackColor = Color.Transparent;
            BackgroundImage = Properties.Resources.MultiplayerLobby;

            TableLayoutPanel generalTlp = new TableLayoutPanel();
            generalTlp.RowStyles.Add(new RowStyle(SizeType.Percent, 80));
            generalTlp.RowStyles.Add(new RowStyle(SizeType.AutoSize, 50));
            generalTlp.AutoSize = true;
            generalTlp.BackColor = Color.Transparent;

            fieldSettings = new EditableFieldPanel();
            fieldSettings.Size = new Size(556, 326);
            fieldSettings.Anchor = AnchorStyles.None;
            fieldSettings.InitializeComponents(51, 25);
            fieldSettings.BorderStyle = BorderStyle.FixedSingle;

            TableLayoutPanel roundSettingsTlp = new TableLayoutPanel();
            roundSettingsTlp.AutoSize = true;
            roundSettingsTlp.Anchor = AnchorStyles.None;

            #region Create and Cancel
            FlowLayoutPanel buttonFlp = new FlowLayoutPanel();
            buttonFlp.Anchor = AnchorStyles.None;
            buttonFlp.AutoSize = true;

            createButton = new Button();
            createButton.Text = "Create";
            createButton.Click += createButton_Click;
            createButton.Size = new Size(80, 25);
            createButton.Anchor = AnchorStyles.None;
            createButton.Cursor = Cursors.Hand;
            createButton.BackColor = Control.DefaultBackColor;

            cancelButton = new Button();
            cancelButton.Text = "Cancel";
            cancelButton.Click += cancelButton_Click;
            cancelButton.Size = new Size(80, 25);
            cancelButton.BackColor = Control.DefaultBackColor;
            cancelButton.Cursor = Cursors.Hand;

            buttonFlp.Controls.Add(createButton);
            buttonFlp.Controls.Add(cancelButton);

            #endregion

            #region Game settings
            gameSettingsPanel = new GameSettingsPanel(false);
            gameSettingsPanel.AutoSize = true;
            gameSettingsPanel.Dock = DockStyle.Fill;
            #endregion

            roundSettingsTlp.Controls.Add(gameSettingsPanel, 0, 0);
            roundSettingsTlp.Controls.Add(buttonFlp, 0, 1);

            generalTlp.Controls.Add(fieldSettings, 0, 0);
            generalTlp.Controls.Add(roundSettingsTlp, 1, 0);

            Controls.Add(generalTlp);
        }
Example #2
0
        /// <summary>
        /// Initializes all components
        /// </summary>
        private void InitializeComponents()
        {
            BackgroundImage = Properties.Resources.MultiplayerLobby;

            TableLayoutPanel generalTlp = new TableLayoutPanel();
            generalTlp.RowStyles.Add(new RowStyle(SizeType.Percent, 80));
            generalTlp.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            generalTlp.Dock = DockStyle.Fill;
            generalTlp.BackColor = Color.Transparent;

            TableLayoutPanel settingsTlp = new TableLayoutPanel();
            settingsTlp.AutoSize = true;
            settingsTlp.Anchor = AnchorStyles.None;
            settingsTlp.BackColor = Color.Transparent;

            CurrentFieldSettingsPanel = new EditableFieldPanel();
            CurrentFieldSettingsPanel.Size = new Size(556, 326);
            CurrentFieldSettingsPanel.Anchor = AnchorStyles.None;
            CurrentFieldSettingsPanel.InitializeComponents(51, 25);
            CurrentFieldSettingsPanel.BorderStyle = BorderStyle.FixedSingle;
            CurrentFieldSettingsPanel.FieldSettingsChanged += FieldSettingsChanged;

            TableLayoutPanel roundSettingsTlp = new TableLayoutPanel();
            roundSettingsTlp.AutoSize = true;
            roundSettingsTlp.Dock = DockStyle.Right;
            roundSettingsTlp.Anchor = AnchorStyles.None;
            roundSettingsTlp.RowStyles.Add(new RowStyle(SizeType.AutoSize));
            roundSettingsTlp.RowStyles.Add(new RowStyle(SizeType.AutoSize));

            #region Game Settings
            gameSettingsPanel = new GameSettingsPanel(true);
            gameSettingsPanel.Dock = DockStyle.Right;
            gameSettingsPanel.AutoSize = true;
            gameSettingsPanel.GameSettingsChanged += SelectedIndexChanged;
            #endregion

            #region change team and start button flp
            FlowLayoutPanel teamAndStartFlp = new FlowLayoutPanel();
            teamAndStartFlp.AutoSize = true;
            teamAndStartFlp.Anchor = AnchorStyles.None;

            Button openTeamSwitcher = new Button();
            openTeamSwitcher.Text = "Show Teams";
            openTeamSwitcher.Size = new Size(110, 25);
            openTeamSwitcher.Click += openTeamSwitcher_Click;
            openTeamSwitcher.Anchor = AnchorStyles.None;
            openTeamSwitcher.BackColor = Control.DefaultBackColor;
            openTeamSwitcher.Cursor = Cursors.Hand;

            startButton = new Button();
            startButton.Text = "Start";
            startButton.Size = new Size(50, 25);
            startButton.BackColor = Control.DefaultBackColor;
            startButton.Anchor = AnchorStyles.None;
            startButton.Click += startButton_Click;
            startButton.Cursor = Cursors.Hand;

            teamAndStartFlp.Controls.Add(openTeamSwitcher);
            teamAndStartFlp.Controls.Add(startButton);
            #endregion

            #region upload round flp
            FlowLayoutPanel savefileFlp = new FlowLayoutPanel();
            savefileFlp.AutoSize = true;
            savefileFlp.Anchor = AnchorStyles.None;

            Button savefileButton = new Button();
            savefileButton.Text = "Upload Savegame";
            savefileButton.BackColor = Control.DefaultBackColor;
            savefileButton.Anchor = AnchorStyles.None;
            savefileButton.Click += uploadButton_Click;
            savefileButton.Cursor = Cursors.Hand;
            savefileButton.Size = new Size(110, 25);

            UseSavefileBox = new CheckBox();
            UseSavefileBox.Text = "Use";
            UseSavefileBox.Size = new Size(50, 25);
            UseSavefileBox.ForeColor = Color.White;
            UseSavefileBox.Anchor = AnchorStyles.None;

            savefileFlp.Controls.Add(savefileButton);
            savefileFlp.Controls.Add(UseSavefileBox);

            #endregion

            roundSettingsTlp.Controls.Add(gameSettingsPanel, 0, 0);
            roundSettingsTlp.Controls.Add(savefileFlp, 0, 1);
            roundSettingsTlp.Controls.Add(teamAndStartFlp, 0, 2);

            settingsTlp.Controls.Add(CurrentFieldSettingsPanel, 0, 0);
            settingsTlp.Controls.Add(roundSettingsTlp, 1, 0);

            CurrentChats.Size = new Size(400, 300);
            CurrentChats.Location = new Point(Width / 2 - CurrentChats.Width / 2, Height - (CurrentChats.Height + 50));
            CurrentChats.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
            CurrentChats.SelectedIndexChanged += CurrentChats_SelectedIndexChanged;

            generalTlp.Controls.Add(settingsTlp, 0, 0);
            generalTlp.Controls.Add(CurrentChats, 0, 1);

            Controls.Add(generalTlp);
        }