public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f))
        {
            trigger=(MyTriggerBlockDestroyed)trig;
            AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed);

            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10);
            layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33);

            m_selectedBlocks = new MyGuiControlTable();
            m_selectedBlocks.VisibleRowsCount = 8;
            m_selectedBlocks.ColumnsCount = 1;
            m_selectedBlocks.SetCustomColumnWidths(new float[]{1});
            m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName));

            layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_buttonPaste = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnPasteButtonClick
                );
            m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip);
            layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1);

            m_buttonDelete = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks),
                visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
                onButtonClick: OnDeleteButtonClick);
            layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1);

            m_labelSingleMessage = new MyGuiControlLabel(
                text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString()
                );
            layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1);
            m_textboxSingleMessage = new MyGuiControlTextbox(
                defaultText: trigger.SingleMessage,
                maxLength: 85);
            layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3);

            foreach(var block in trigger.Blocks)
                AddRow(block.Key);
            m_tempSb.Clear().Append(trigger.SingleMessage);
            m_textboxSingleMessage.SetText(m_tempSb);

        }
        protected virtual void BuildControls()
        {
            Vector2 buttonSize = MyGuiConstants.BACK_BUTTON_SIZE;
            Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.65f, 0.1f);

            AddCaption(MySpaceTexts.ScreenCaptionScenario);

            //RIGHT:
            int numControls = 0;

            var nameLabel = MakeLabel(MySpaceTexts.Name);
            var descriptionLabel = MakeLabel(MySpaceTexts.Description);
            var difficultyLabel = MakeLabel(MySpaceTexts.Difficulty);
            var onlineModeLabel = MakeLabel(MySpaceTexts.WorldSettings_OnlineMode);
            m_maxPlayersLabel = MakeLabel(MySpaceTexts.MaxPlayers);

            float width = 0.284375f + 0.025f;

            m_nameTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
            m_descriptionTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH);
            m_difficultyCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
            m_difficultyCombo.AddItem((int)0, MySpaceTexts.DifficultyEasy);
            m_difficultyCombo.AddItem((int)1, MySpaceTexts.DifficultyNormal);
            m_difficultyCombo.AddItem((int)2, MySpaceTexts.DifficultyHard);

            m_onlineMode = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
            m_maxPlayersSlider = new MyGuiControlSlider(
                position: Vector2.Zero,
                width: m_onlineMode.Size.X,
                minValue: 2,
                maxValue: 16,
                labelText: new StringBuilder("{0}").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.05f,
                intValue: true
                );

            m_scenarioTypesList = new MyGuiControlList();


            //BUTTONS
            m_removeButton = new MyGuiControlButton(position: buttonsOrigin, size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonRemove), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_publishButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f + m_removeButton.Size.X, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonPublish), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_createButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(2*(0.01f + m_removeButton.Size.X), 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonCreateNew), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_browseWorkshopButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(3*(0.01f + m_removeButton.Size.X), 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonBrowseWorkshop), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);

            m_refreshButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.0f, m_removeButton.Size.Y+0.01f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonRefresh), 
                onButtonClick: OnRefreshButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_openInWorkshopButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2((0.01f + m_removeButton.Size.X), m_removeButton.Size.Y + 0.01f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.buttonOpenInWorkshop), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(2 * (0.01f + m_removeButton.Size.X), m_removeButton.Size.Y + 0.01f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Ok), 
                onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(3 * (0.01f + m_removeButton.Size.X), m_removeButton.Size.Y + 0.01f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Cancel), 
                onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);

            m_onlineMode.ItemSelected += OnOnlineModeSelect;
            m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MySpaceTexts.WorldSettings_OnlineModeOffline);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MySpaceTexts.WorldSettings_OnlineModePrivate);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MySpaceTexts.WorldSettings_OnlineModeFriends);
            m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MySpaceTexts.WorldSettings_OnlineModePublic);


            m_nameTextbox.TextChanged += m_nameTextbox_TextChanged;

            // Add controls in pairs; label first, control second. They will be laid out automatically this way.
            Controls.Add(nameLabel);
            Controls.Add(m_nameTextbox);
            //m_nameTextbox.Enabled = false;
            Controls.Add(descriptionLabel);
            Controls.Add(m_descriptionTextbox);
            //m_descriptionTextbox.Enabled = false;
            Controls.Add(difficultyLabel);
            Controls.Add(m_difficultyCombo);
            m_difficultyCombo.Enabled = false;

            Controls.Add(onlineModeLabel);
            Controls.Add(m_onlineMode);
            m_onlineMode.Enabled = false;
            Controls.Add(m_maxPlayersLabel);
            Controls.Add(m_maxPlayersSlider);


            float labelSize = 0.12f;

            float MARGIN_TOP = 0.1f;
            float MARGIN_LEFT = 0.42f;// m_isNewGame ? 0.315f : 0.08f;

            // Automatic layout.
            Vector2 originL, originC;
            Vector2 controlsDelta = new Vector2(0f, 0.052f);
            float rightColumnOffset;
            originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
            originC = originL + new Vector2(labelSize, 0f);
            rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f;

            foreach (var control in Controls)
            {
                control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                if (control is MyGuiControlLabel)
                    control.Position = originL + controlsDelta * numControls;
                else
                    control.Position = originC + controlsDelta * numControls++;
            }
            //BRIEFING:
            //var textBackgroundPanel = AddCompositePanel(MyGuiConstants.TEXTURE_RECTANGLE_DARK, new Vector2(0f,0f), new Vector2(0.43f, 0.422f), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
            //textBackgroundPanel.InnerHeight = 6;
            MyGuiControlParent briefing = new MyGuiControlParent();//new Vector2(0f, 0f), new Vector2(0.43f, 0.422f));

            var briefingScrollableArea = new MyGuiControlScrollablePanel(
                scrolledControl: briefing)
            {
                Name = "BriefingScrollableArea",
                ScrollbarVEnabled = true,
                Position = new Vector2(-0.02f, -0.12f),
                Size = new Vector2(0.43f, 0.422f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
                ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
            };
            Controls.Add(briefingScrollableArea);
            //inside scrollable area:
            m_descriptionBox = AddMultilineText(offset: new Vector2(0.0f, 0.0f), size: new Vector2(1f, 1f), selectable: false);
            briefing.Controls.Add(m_descriptionBox);

            //LEFT:
            m_scenarioTable = new MyGuiControlTable();
            m_scenarioTable.Position = new Vector2(-0.42f, -0.5f+MARGIN_TOP);
            m_scenarioTable.Size = new Vector2(0.38f, 1.8f);
            m_scenarioTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_scenarioTable.VisibleRowsCount = 20;
            m_scenarioTable.ColumnsCount = 2;
            m_scenarioTable.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
            m_scenarioTable.SetColumnName(1, MyTexts.Get(MySpaceTexts.Name));
            m_scenarioTable.ItemSelected += OnTableItemSelected;
            //m_scenarioTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
            //m_scenarioTable.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
            Controls.Add(m_scenarioTable);
            //BUTTONS:
            Controls.Add(m_removeButton);
            m_removeButton.Enabled = false;
            Controls.Add(m_publishButton);
            m_publishButton.Enabled = false;
            Controls.Add(m_createButton);
            m_createButton.Enabled = false;
            Controls.Add(m_browseWorkshopButton);
            m_browseWorkshopButton.Enabled = false;
            Controls.Add(m_refreshButton);
            Controls.Add(m_openInWorkshopButton);
            m_openInWorkshopButton.Enabled = false;
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            CloseButtonEnabled = true;

            SetDefaultValues();
        }
Пример #3
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            CloseButtonEnabled = true;

            var caption = AddCaption(MySpaceTexts.ScreenCaptionPlayers);
            var captionCenter = MyUtils.GetCoordCenterFromAligned(caption.Position, caption.Size, caption.OriginAlign);
            var captionBottomCenter = captionCenter + new Vector2(0f, 0.5f * caption.Size.Y);

            Vector2 sizeScale = Size.Value / MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.SizeGui;
            Vector2 topLeft = -0.5f * Size.Value + sizeScale * MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.PaddingSizeGui * 1.1f;

            float verticalSpacing = 0.5f * caption.Size.Y;

            m_lobbyTypeCombo = new MyGuiControlCombobox(
                position: new Vector2(-topLeft.X, captionBottomCenter.Y + verticalSpacing),
                openAreaItemsCount: 3);
            m_lobbyTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Private, MySpaceTexts.ScreenPlayersLobby_Private);
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.FriendsOnly, MySpaceTexts.ScreenPlayersLobby_Friends);
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Public, MySpaceTexts.ScreenPlayersLobby_Public);
            m_lobbyTypeCombo.SelectItemByKey((int)MyMultiplayer.Static.GetLobbyType());

            MyGuiControlBase aboveControl;

            m_inviteButton = new MyGuiControlButton(
                position: new Vector2(-m_lobbyTypeCombo.Position.X, m_lobbyTypeCombo.Position.Y + m_lobbyTypeCombo.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Invite));
            aboveControl = m_inviteButton;

            m_kickButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Kick));
            aboveControl = m_kickButton;

            m_banButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Ban));
            aboveControl = m_banButton;

            var maxPlayersLabel = new MyGuiControlLabel(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.GetString(MySpaceTexts.MaxPlayers));
            aboveControl = maxPlayersLabel;

            m_maxPlayersSlider = new MyGuiControlSlider(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
                width: 0.15f,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                minValue: 0,
                maxValue: MyMultiplayer.Static != null ? MyMultiplayer.Static.MaxPlayers : 16,
                labelText: new StringBuilder("{0}").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.02f,
                defaultValue: Sync.IsServer ? MySession.Static.MaxPlayers : MyMultiplayer.Static.MemberLimit,
                intValue: true);
            m_maxPlayersSlider.ValueChanged = MaxPlayersSlider_Changed;
            aboveControl = m_maxPlayersSlider;

            m_playersTable = new MyGuiControlTable()
            {
                Position = new Vector2(-m_inviteButton.Position.X, m_inviteButton.Position.Y),
                Size = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f) - m_inviteButton.Size * 1.05f,
                VisibleRowsCount = 21,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                ColumnsCount = 2,
            };
            m_playersTable.SetCustomColumnWidths(new float[] { 0.7f, 0.3f });
            m_playersTable.SetColumnName(0, MyTexts.Get(MySpaceTexts.ScreenPlayers_PlayerName));
            m_playersTable.SetColumnName(1, MyTexts.Get(MySpaceTexts.ScreenPlayers_GameAdmin));
            m_playersTable.SetColumnComparison(0, (a, b) => (a.Text.CompareToIgnoreCase(b.Text)));
            m_playersTable.ItemSelected += playersTable_ItemSelected;
            foreach (var userId in MyMultiplayer.Static.Members)
                AddPlayer(userId);

            m_inviteButton.ButtonClicked  += inviteButton_ButtonClicked;
            m_kickButton.ButtonClicked    += kickButton_ButtonClicked;
            m_banButton.ButtonClicked     += banButton_ButtonClicked;
            m_lobbyTypeCombo.ItemSelected += lobbyTypeCombo_OnSelect;

            Controls.Add(m_inviteButton);
            Controls.Add(m_kickButton);
            Controls.Add(m_banButton);
            Controls.Add(m_playersTable);
            Controls.Add(m_lobbyTypeCombo);
            Controls.Add(m_maxPlayersSlider);
            Controls.Add(maxPlayersLabel);

            UpdateButtonsEnabledState();
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            CloseButtonEnabled = true;

            var caption = AddCaption(MyCommonTexts.ScreenCaptionPlayers);
            var captionCenter = MyUtils.GetCoordCenterFromAligned(caption.Position, caption.Size, caption.OriginAlign);
            var captionBottomCenter = captionCenter + new Vector2(0f, 0.5f * caption.Size.Y);

            Vector2 sizeScale = Size.Value / MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.SizeGui;
            Vector2 topLeft = -0.5f * Size.Value + sizeScale * MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.PaddingSizeGui * 1.1f;

            float verticalSpacing = 0.0045f;

            m_lobbyTypeCombo = new MyGuiControlCombobox(
                position: new Vector2(-topLeft.X, captionBottomCenter.Y + verticalSpacing),
                openAreaItemsCount: 3);
            m_lobbyTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Private, MyCommonTexts.ScreenPlayersLobby_Private);
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.FriendsOnly, MyCommonTexts.ScreenPlayersLobby_Friends);
            m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Public, MyCommonTexts.ScreenPlayersLobby_Public);
            m_lobbyTypeCombo.SelectItemByKey((int)MyMultiplayer.Static.GetLobbyType());

            MyGuiControlBase aboveControl;

            m_inviteButton = new MyGuiControlButton(
                position: new Vector2(-m_lobbyTypeCombo.Position.X, m_lobbyTypeCombo.Position.Y + m_lobbyTypeCombo.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Invite));
            aboveControl = m_inviteButton;

            m_promoteButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Promote));
            aboveControl = m_promoteButton;

            m_demoteButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Demote));
            aboveControl = m_demoteButton;

            m_kickButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Kick));
            aboveControl = m_kickButton;

            m_banButton = new MyGuiControlButton(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Ban));
            aboveControl = m_banButton;

            var maxPlayersLabel = new MyGuiControlLabel(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                text: MyTexts.GetString(MyCommonTexts.MaxPlayers));
            aboveControl = maxPlayersLabel;

            m_maxPlayersSlider = new MyGuiControlSlider(
                position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
                width: 0.15f,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                minValue: 2,
                maxValue: MyMultiplayer.Static != null ? MyMultiplayer.Static.MaxPlayers : 16,
                labelText: new StringBuilder("{0}").ToString(),
                labelDecimalPlaces: 0,
                labelSpaceWidth: 0.02f,
                defaultValue: Sync.IsServer ? MySession.Static.MaxPlayers : MyMultiplayer.Static.MemberLimit,
                intValue: true);
            m_maxPlayersSlider.ValueChanged = MaxPlayersSlider_Changed;
            aboveControl = m_maxPlayersSlider;

            m_playersTable = new MyGuiControlTable()
            {
                Position = new Vector2(-m_inviteButton.Position.X, m_inviteButton.Position.Y),
                Size = new Vector2(1200f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f) - m_inviteButton.Size * 1.05f,
                VisibleRowsCount = 21,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                ColumnsCount = 5,
            };
            float PlayerNameWidth = 0.3f;
            float FactionTagWidth = 0.1f;
            float FactionNameWidth = MyPerGameSettings.EnableMutePlayer ? 0.3f : 0.34f;
            float MutedWidth = MyPerGameSettings.EnableMutePlayer ? 0.13f : 0;
            m_playersTable.SetCustomColumnWidths(new float[] { PlayerNameWidth, FactionTagWidth, FactionNameWidth, MutedWidth, 1 - PlayerNameWidth - FactionTagWidth - FactionNameWidth - MutedWidth });
            m_playersTable.SetColumnName(PlayerNameColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_PlayerName));
            m_playersTable.SetColumnName(PlayerFactionTagColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_FactionTag));
            m_playersTable.SetColumnName(PlayerFactionNameColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_FactionName));
            m_playersTable.SetColumnName(PlayerMutedColumn, new StringBuilder(MyTexts.GetString(MyCommonTexts.ScreenPlayers_Muted)));
            m_playersTable.SetColumnName(GameAdminColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_GameAdmin));
            m_playersTable.SetColumnComparison(0, (a, b) => (a.Text.CompareToIgnoreCase(b.Text)));
            m_playersTable.ItemSelected += playersTable_ItemSelected;

            // CH: To show the clients correctly, we would need to know, whether the game is a dedicated-server-hosted game.
            // We don't know that, so I just show all clients with players
            foreach (var player in Sync.Players.GetOnlinePlayers())
            {
                if (player.Id.SerialId != 0) continue;

                for (int i = 0; i < m_playersTable.RowsCount; ++i)
                {
                    var row = m_playersTable.GetRow(i);
                    if (row.UserData is ulong && (ulong)row.UserData == player.Id.SteamId) continue;
                }

                AddPlayer(player.Id.SteamId);
            }

            m_inviteButton.ButtonClicked += inviteButton_ButtonClicked;
            m_promoteButton.ButtonClicked += promoteButton_ButtonClicked;
            m_demoteButton.ButtonClicked += demoteButton_ButtonClicked;
            m_kickButton.ButtonClicked += kickButton_ButtonClicked;
            m_banButton.ButtonClicked += banButton_ButtonClicked;
            m_lobbyTypeCombo.ItemSelected += lobbyTypeCombo_OnSelect;

            Controls.Add(m_inviteButton);
            Controls.Add(m_promoteButton);
            Controls.Add(m_demoteButton);
            Controls.Add(m_kickButton);
            Controls.Add(m_banButton);
            Controls.Add(m_playersTable);
            Controls.Add(m_lobbyTypeCombo);
            Controls.Add(m_maxPlayersSlider);
            Controls.Add(maxPlayersLabel);
            
            UpdateButtonsEnabledState();
        }
Пример #5
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            string filepath = MakeScreenFilepath("MedicalsScreen");
            MyObjectBuilder_GuiScreen objectBuilder;

            var fsPath = Path.Combine(MyFileSystem.ContentPath, filepath);
            MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_multilineRespawnWhenShipReady = new MyGuiControlMultilineText()
            {
                Position = new Vector2(0, -0.5f * Size.Value.Y + 80f / MyGuiConstants.GUI_OPTIMAL_SIZE.Y),
                Size = new Vector2(Size.Value.X * 0.85f, 75f / MyGuiConstants.GUI_OPTIMAL_SIZE.Y),
                Font = MyFontEnum.Red,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
                TextAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            };

            Controls.Add(m_multilineRespawnWhenShipReady);

            UpdateRespawnShipLabel();

            m_respawnsTable = new MyGuiControlTable();
            m_respawnsTable.Position = new Vector2(0, -0.01f);
            m_respawnsTable.Size = new Vector2(550f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1.3f);
            m_respawnsTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;
            m_respawnsTable.VisibleRowsCount = 17;
            Controls.Add(m_respawnsTable);

            m_respawnsTable.ColumnsCount = 2;
            m_respawnsTable.ItemSelected += OnTableItemSelected;
            m_respawnsTable.ItemDoubleClicked += OnTableItemDoubleClick;
            m_respawnsTable.SetCustomColumnWidths(new float[] { 0.50f, 0.50f });

            m_respawnsTable.SetColumnName(0, MyTexts.Get(MySpaceTexts.Name));
            m_respawnsTable.SetColumnName(1, MyTexts.Get(MySpaceTexts.ScreenMedicals_OwnerTimeoutColumn));

            m_labelNoRespawn = new MyGuiControlLabel()
            {
                Position = new Vector2(0, -0.35f),
                ColorMask = Color.Red,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP
            };
            Controls.Add(m_labelNoRespawn);

            m_respawnButton = new MyGuiControlButton(
                            position: new Vector2(-0.1f, 0.35f),
                            text: MyTexts.Get(MySpaceTexts.Respawn),
                            onButtonClick: onRespawnClick
                            );
            Controls.Add(m_respawnButton);

            m_refreshButton = new MyGuiControlButton(
                          position: new Vector2(0.1f, 0.35f),
                          text: MyTexts.Get(MySpaceTexts.Refresh),
                          onButtonClick: onRefreshClick
                          );
            Controls.Add(m_refreshButton);

            m_noRespawnText = new MyGuiControlMultilineText(
                            position: new Vector2(-0.02f, -0.19f),
                            size: new Vector2(0.32f, 0.5f),
                            contents: MyTexts.Get(MySpaceTexts.ScreenMedicals_NoRespawnPossible),
                            textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                            font: MyFontEnum.Red
                            );
            Controls.Add(m_noRespawnText);

            RefreshRespawnPoints();
        }
Пример #6
0
        private void CreateFactionsPageControls(MyGuiControlTabPage page)
        {
            page.Name = "PageFactions";
            page.TextEnum = MySpaceTexts.TerminalTab_Factions;

            var left = -0.462f;
            var top = -0.34f;
            var spacingH = 0.0045f;
            var spacingV = 0.01f;
            var buttonSize = new Vector2(0.29f, 0.052f);
            var smallerBtn = new Vector2(0.13f, 0.04f);

            var factionsComposite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.4f, 0.69f),
                Name = "Factions"
            };
            left += spacingH;
            top += spacingV;

            var factionsPanel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionsComposite.Size.X - 0.01f, 0.035f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK
            };

            var factionsLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left + spacingH, top),
                size: factionsPanel.Size - new Vector2(0.01f, 0.01f),
                text: MyTexts.GetString(MySpaceTexts.TerminalTab_Factions)
            );
            top += factionsLabel.Size.Y + spacingV;

            var factionsTable = new MyGuiControlTable()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionsPanel.Size.X, 0.15f),
                Name = "FactionsTable",
                ColumnsCount = 3,
                VisibleRowsCount = 14,
            };
            factionsTable.SetCustomColumnWidths(new float[] { 0.16f, 0.75f, 0.09f });
            factionsTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Tag));
            factionsTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Name));
            top += factionsTable.Size.Y + spacingV;

            var createBtn      = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top)) { Name = "buttonCreate" };
            var joinBtn        = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonJoin" };
            var joinCancelBtn  = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonCancelJoin" };
            var leaveBtn       = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left, top + buttonSize.Y + spacingV)) { Name = "buttonLeave" };
            var sendPeaceBtn   = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonSendPeace" };
            var cancelPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonCancelPeace" };
            var acceptPeaceBtn = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top)) { Name = "buttonAcceptPeace" };
            var enemyBtn       = new MyGuiControlButton(originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP, position: new Vector2(-0.065f, top + buttonSize.Y + spacingV)) { Name = "buttonEnemy" };

            page.Controls.Add(factionsComposite);
            page.Controls.Add(factionsPanel);
            page.Controls.Add(factionsLabel);
            page.Controls.Add(factionsTable);
            page.Controls.Add(createBtn);
            page.Controls.Add(joinBtn);
            page.Controls.Add(joinCancelBtn);
            page.Controls.Add(leaveBtn);
            page.Controls.Add(sendPeaceBtn);
            page.Controls.Add(cancelPeaceBtn);
            page.Controls.Add(acceptPeaceBtn);
            page.Controls.Add(enemyBtn);

            // Do the right side
            // reset left / top
            left = -0.0475f;
            top = -0.34f;

            var factionComposite = new MyGuiControlCompositePanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(-0.05f, top),
                Size = new Vector2(0.5f, 0.69f),
                Name = "compositeFaction"
            };
            left += spacingH;
            top += spacingV;

            var factionNamePanel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(factionComposite.Size.X - 0.012f, 0.035f),
                BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK,
                Name = "panelFactionName"
            };

            var factionName = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left + spacingH, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionName" };
            top += factionsLabel.Size.Y + (2f * spacingV);
            var size = factionNamePanel.Size - new Vector2(0.14f, 0.01f);

            var factionDescLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionDesc" };
            top += factionDescLabel.Size.Y + spacingV;

            var factionDesc = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE,
                position: new Vector2(left, top),
                size: new Vector2(size.X, 0.08f)
            )
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Name = "textFactionDesc",
            };
            top += factionDesc.Size.Y + 2f * spacingV;

            var factionPrivateLabel = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionPrivate" };
            top += factionPrivateLabel.Size.Y + spacingV;

            var factionPrivate = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.TOOL_TIP_TEXT_SCALE,
                position: new Vector2(left, top),
                size: new Vector2(size.X, 0.08f)
            )
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Name = "textFactionPrivate",
            };
            top += factionDesc.Size.Y + 0.0275f;

            var labelFactionMembers = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: factionNamePanel.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionMembers" };


            var checkAcceptEveryone = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
                position: new Vector2(factionNamePanel.Position.X + factionNamePanel.Size.X, top + spacingV)
            ) { Name = "checkFactionMembersAcceptEveryone" };

            var labelAcceptEveryone = new MyGuiControlLabel(
             originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
             position: new Vector2(checkAcceptEveryone.Position.X - checkAcceptEveryone.Size.X - spacingH, top),
             size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f)
         ) { Name = "labelFactionMembersAcceptEveryone" };


            var labelAcceptPeace = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2((17 * spacingH), top),
                size: labelFactionMembers.Size - new Vector2(0.01f, 0.01f)
            ) { Name = "labelFactionMembersAcceptPeace" };

            var checkAcceptPeace = new MyGuiControlCheckbox(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                position: new Vector2((47 * spacingH), top + spacingV)
            ) { Name = "checkFactionMembersAcceptPeace" };



            top += factionPrivateLabel.Size.Y + spacingV;

            var membersTable = new MyGuiControlTable()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(size.X, 0.15f),
                Name = "tableMembers",
                ColumnsCount = 2,
                VisibleRowsCount = 8,
                HeaderVisible = false
            };
            membersTable.SetCustomColumnWidths(new float[] { 0.7f, 0.3f });
            membersTable.SetColumnName(0, MyTexts.Get(MyCommonTexts.Name));
            membersTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Status));

            var btnSpacing = smallerBtn.Y + spacingV;
            var editBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, factionDesc.Position.Y)) { Name = "buttonEdit" };
            var promBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y)) { Name = "buttonPromote" };
            var kickBtn = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + btnSpacing)) { Name = "buttonKick" };
            var acceptJoin = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptJoin" };
            var demote = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 3f * btnSpacing)) { Name = "buttonDemote" };
            //var acceptPeace = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,    position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 2f * btnSpacing)) { Name = "buttonAcceptPeace" };
            var addNpcToFaction = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Rectangular, size: smallerBtn, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, position: new Vector2(left + membersTable.Size.X + spacingV, membersTable.Position.Y + 4f * btnSpacing)) { Name = "buttonAddNpc" };

            page.Controls.Add(factionComposite);
            page.Controls.Add(factionNamePanel);
            page.Controls.Add(factionName);
            page.Controls.Add(factionDescLabel);
            page.Controls.Add(factionDesc);
            page.Controls.Add(factionPrivateLabel);
            page.Controls.Add(factionPrivate);
            page.Controls.Add(labelFactionMembers);
            page.Controls.Add(labelAcceptEveryone);
            page.Controls.Add(labelAcceptPeace);
            page.Controls.Add(checkAcceptEveryone);
            page.Controls.Add(checkAcceptPeace);
            page.Controls.Add(membersTable);

            page.Controls.Add(editBtn);
            page.Controls.Add(promBtn);
            page.Controls.Add(kickBtn);
            page.Controls.Add(demote);
            page.Controls.Add(acceptJoin);
            page.Controls.Add(addNpcToFaction);
        }
Пример #7
0
        private void CreatePropertiesPageControls(MyGuiControlParent menuParent, MyGuiControlParent panelParent)
        {
            m_propertiesTableParent.Name = "PropertiesTable";
            m_propertiesTopMenuParent.Name = "PropertiesTopMenu";
            //Combobox on top of Terminal
            var shipsInRange = new MyGuiControlCombobox()
            {
                Position = new Vector2(0,0f),
                Size = new Vector2(0.25f, 0.10f),
                Name = "ShipsInRange",
                Visible = false,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            };

            var selectShipButton = new MyGuiControlButton()
            {
                Position = new Vector2(0.27f, 0.0f),
                Size = new Vector2(0.05f, 0.05f),
                Name = "SelectShip",
                Text = "...",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                VisualStyle = MyGuiControlButtonStyleEnum.Tiny,
            };
            selectShipButton.SetToolTip(MySpaceTexts.ScreenTerminal_ShipList);

            menuParent.Controls.Add(shipsInRange);
            menuParent.Controls.Add(selectShipButton);

            //The panel itself
            var shipsDataTable = new MyGuiControlTable()
            {
                Position = new Vector2(0.0f, 0.0f),
                Size = new Vector2(0.88f, 0.78f),
                Name = "ShipsData",
                ColumnsCount = 3,
                VisibleRowsCount = 16,
                HeaderVisible = true,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
            };

            shipsDataTable.SetCustomColumnWidths(new float[] { 0.40f, 0.20f, 0.28f });
            shipsDataTable.SetColumnName(0, new StringBuilder("Name"));
            shipsDataTable.SetColumnName(1, new StringBuilder("Distance"));
            shipsDataTable.SetColumnName(2, new StringBuilder("Status"));
            shipsDataTable.SetColumnComparison(0, (a, b) => (a.Text).CompareTo(b.Text));
            shipsDataTable.SetColumnComparison(1, (a, b) => ((float)a.UserData).CompareTo((float)b.UserData));
            shipsDataTable.SetColumnComparison(2, (a, b) => ((Int32)a.UserData).CompareTo((Int32)b.UserData));

            panelParent.Controls.Add(shipsDataTable);
            panelParent.Visible = false;
        }
Пример #8
0
        protected override Graphics.GUI.MyGuiControlTable CreateScenarioTable()
        {
            var scenarioTable = new MyGuiControlTable();
            scenarioTable.Position = new Vector2(-0.42f, -0.435f + MARGIN_TOP);
            scenarioTable.Size = new Vector2(0.38f, 1.8f);
            scenarioTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            scenarioTable.VisibleRowsCount = 18;
            scenarioTable.ColumnsCount = 2;
            scenarioTable.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
            scenarioTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Name));
            scenarioTable.ItemSelected += OnTableItemSelected;

            return scenarioTable;
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(50, 300, 300, 300, 300, 300, 50);
            layout.SetRowHeightsNormalized(50, 450, 70, 70, 70, 400, 70, 70, 50);

            //BRIEFING:
            MyGuiControlParent briefing = new MyGuiControlParent();
            var briefingScrollableArea = new MyGuiControlScrollablePanel(
                scrolledControl: briefing)
            {
                Name = "BriefingScrollableArea",
                ScrollbarVEnabled = true,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
                ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
            };
            layout.AddWithSize(briefingScrollableArea, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 4, colSpan: 3);
            //inside scrollable area:
            m_descriptionBox = new MyGuiControlMultilineText(
                position: new Vector2(-0.227f, 5f), 
                size: new Vector2(briefingScrollableArea.Size.X - 0.02f, 11f), 
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                selectable: false);
            briefing.Controls.Add(m_descriptionBox);

            m_connectedPlayers = new MyGuiControlTable();
            m_connectedPlayers.Size = new Vector2(490f, 150f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            m_connectedPlayers.VisibleRowsCount = 8;
            m_connectedPlayers.ColumnsCount = 2;
            m_connectedPlayers.SetCustomColumnWidths(new float[] { 0.7f, 0.3f });
            m_connectedPlayers.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiScenarioPlayerName));
            m_connectedPlayers.SetColumnName(1, MyTexts.Get(MySpaceTexts.GuiScenarioPlayerStatus));

            m_kickPlayerButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Kick), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnKick2Clicked);
            m_kickPlayerButton.Enabled = CanKick();

            m_timeoutLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.GuiScenarioTimeout), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            TimeoutCombo = new MyGuiControlCombobox();
            TimeoutCombo.ItemSelected += OnTimeoutSelected;
            TimeoutCombo.AddItem(3, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout3min));
            TimeoutCombo.AddItem(5, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout5min));
            TimeoutCombo.AddItem(10, MyTexts.Get(MySpaceTexts.GuiScenarioTimeout10min));
            TimeoutCombo.AddItem(-1, MyTexts.Get(MySpaceTexts.GuiScenarioTimeoutUnlimited));
            TimeoutCombo.SelectItemByIndex(0);
            TimeoutCombo.Enabled = Sync.IsServer;

            m_canJoinRunningLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScenarioSettings_CanJoinRunningShort), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            m_canJoinRunning = new MyGuiControlCheckbox();

            m_canJoinRunningLabel.Enabled = false;
            m_canJoinRunning.Enabled = false;

            m_startButton = new MyGuiControlButton(text: MyTexts.Get(MySpaceTexts.GuiScenarioStart), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(200, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnStartClicked);
            m_startButton.Enabled = Sync.IsServer;

            m_chatControl = new MyHudControlChat(
                MyHud.Chat,
                size: new Vector2(1400f, 300f) / MyGuiConstants.GUI_OPTIMAL_SIZE,
                font: MyFontEnum.DarkBlue,
                textScale: 0.7f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                backgroundColor: MyGuiConstants.THEMED_GUI_BACKGROUND_COLOR,
                contents: null,
                drawScrollbar: true,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_chatControl.BorderEnabled = true;
            m_chatControl.BorderColor = Color.CornflowerBlue;

            m_chatTextbox = new MyGuiControlTextbox(maxLength: ChatMessageBuffer.MAX_MESSAGE_SIZE);
            m_chatTextbox.Size = new Vector2(1400f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE;
            m_chatTextbox.TextScale = 0.8f;
            m_chatTextbox.VisualStyle = MyGuiControlTextboxStyleEnum.Default;
            m_chatTextbox.EnterPressed += ChatTextbox_EnterPressed;

            m_sendChatButton = new MyGuiControlButton(text: MyTexts.Get(MySpaceTexts.GuiScenarioSend), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnSendChatClicked);


            layout.AddWithSize(m_connectedPlayers, MyAlignH.Left, MyAlignV.Top, 1, 4, rowSpan: 2, colSpan: 2);

            layout.AddWithSize(m_kickPlayerButton, MyAlignH.Left, MyAlignV.Center, 2, 5);
            layout.AddWithSize(m_timeoutLabel, MyAlignH.Left, MyAlignV.Center, 3, 4);
            layout.AddWithSize(TimeoutCombo, MyAlignH.Left, MyAlignV.Center, 3, 5);

            layout.AddWithSize(m_canJoinRunningLabel, MyAlignH.Left, MyAlignV.Center, 4, 4);
            layout.AddWithSize(m_canJoinRunning, MyAlignH.Right, MyAlignV.Center, 4, 5);
            
            layout.AddWithSize(m_chatControl, MyAlignH.Left, MyAlignV.Top, 5, 1, rowSpan: 1, colSpan: 5);

            layout.AddWithSize(m_chatTextbox, MyAlignH.Left, MyAlignV.Top, 6, 1, rowSpan: 1, colSpan: 4);
            layout.AddWithSize(m_sendChatButton, MyAlignH.Right, MyAlignV.Top, 6, 5);

            layout.AddWithSize(m_startButton, MyAlignH.Left, MyAlignV.Top, 7, 2);
        }