public sealed override void RecreateControls(bool constructor)
        {
            Elements.Clear();

            this.m_backgroundTexture = MyGuiConstants.TEXTURE_MESSAGEBOX_BACKGROUND_INFO.Texture;
            this.m_backgroundColor   = new Vector4(0, 0, 0, 0.5f);     // Grey, half opacity
            this.m_size     = new Vector2(_screenScale, 0.5f);         // Half the screen, drop down from the top
            this.m_position = new Vector2(0.5f, 0.25f);                // HorizontalCenter / Quarter vertical

            base.RecreateControls(constructor);

            Vector4 value     = new Vector4(1f, 1f, 1f, 1f);
            float   textScale = 1f;

            _textBox             = new MyGuiControlTextbox(new Vector2?(new Vector2(0f, 0.25f)), null, 512, new Vector4?(value), 0.8f, MyGuiControlTextboxType.Normal, MyGuiControlTextboxStyleEnum.Default);
            _textBox.Position   -= new Vector2(0f, _textBox.Size.Y + _margin.Y / 2f);
            _textBox.Size        = new Vector2(_screenScale, _textBox.Size.Y) - 2f * _margin;
            _textBox.ColorMask   = new Vector4(0f, 0f, 0f, 0.5f);
            _textBox.VisualStyle = MyGuiControlTextboxStyleEnum.Default;
            _textBox.Name        = "HaE CMD";

            _displayScreen             = new MyGuiControlMultilineText(new Vector2?(new Vector2(-0.5f * _screenScale, -0.25f) + _margin), new Vector2?(new Vector2(_screenScale, 0.5f - _textBox.Size.Y) - 2f * _margin), null, "Debug", 0.8f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, null, true, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, null, true, false, null, null);
            _displayScreen.TextColor   = Color.White;
            _displayScreen.TextScale   = textScale;
            _displayScreen.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            _displayScreen.Text        = HaEConsole.Instance.displayScreen;
            _displayScreen.ColorMask   = new Vector4(0f, 0f, 0f, 0.5f);
            _displayScreen.Name        = "DisplayScreen";

            _logo = new MyGuiControlImage(new Vector2?(new Vector2(0.46f * _screenScale, -0.24f)), new Vector2?(new Vector2(0.05f, _screenScale * 0.05f)), null, null, new string[]
            {
                $"{HaEConstants.pluginFolder}\\Assets\\logo.png"
            }, null, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            _logo.ColorMask = new Vector4(1f, 1f, 1f, 0.5f);
            _logo.SetToolTip("HaE PluginCore");

            this.Controls.Add(_textBox);
            this.Controls.Add(_displayScreen);
            this.Controls.Add(_logo);
        }
Example #2
0
        private MyGuiControlTable.Cell CreateStatusIcons(CubeGridInfo gridInfo, bool isActive)
        {
            MyGuiControlTable.Cell cell = new MyGuiControlTable.Cell();
            float iconSize = m_shipsData.RowHeight * 0.7f;

            bool antIsActive, keyIsActive, remIsActive;

            antIsActive = keyIsActive = remIsActive = isActive;
            MyStringId antTooltip, remTooltip;

            antTooltip = remTooltip = MyStringId.NullOrEmpty;
            StringBuilder keyTooltip = new StringBuilder();

            MyGuiControlParent gr = new MyGuiControlParent();

            MyRefuseReason reasonT  = CanTakeTerminal(gridInfo);
            MyRefuseReason reasonRC = CanTakeRemoteControl(gridInfo);

            //Antenna icon
            switch (reasonT)
            {
            case MyRefuseReason.PlayerBroadcastOff:
                antIsActive = false;
                antTooltip  = MySpaceTexts.BroadcastScreen_TerminalButton_PlayerBroadcastOffToolTip;
                break;

            case MyRefuseReason.NoStableConnection:
                antIsActive = false;
                antTooltip  = MySpaceTexts.BroadcastScreen_TerminalButton_NoStableConnectionToolTip;
                break;

            case MyRefuseReason.NoOwner:
            case MyRefuseReason.NoProblem:
                antTooltip = MySpaceTexts.BroadcastScreen_TerminalButton_StableConnectionToolTip;
                break;
            }
            MyGuiControlImage antenna = new MyGuiControlImage(
                position: new Vector2(-2 * iconSize, 0),
                size: new Vector2(iconSize, iconSize),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                backgroundTexture: (antIsActive ? MyGuiConstants.BS_ANTENNA_ON : MyGuiConstants.BS_ANTENNA_OFF)
                );

            antenna.SetToolTip(antTooltip);
            gr.Controls.Add(antenna);

            //Remote Control icon
            switch (reasonRC)
            {
            case MyRefuseReason.NoRemoteControl:
                remTooltip  = MySpaceTexts.BroadcastScreen_TakeControlButton_NoRemoteToolTip;
                remIsActive = false;
                break;

            case MyRefuseReason.NoMainRemoteControl:
                remTooltip  = MySpaceTexts.BroadcastScreen_TakeControlButton_NoMainRemoteControl;
                remIsActive = false;
                break;

            case MyRefuseReason.NoOwner:
            case MyRefuseReason.NoProblem:
                remTooltip = MySpaceTexts.BroadcastScreen_TakeControlButton_RemoteToolTip;
                break;
            }
            MyGuiControlImage remote = new MyGuiControlImage(
                position: new Vector2(-1 * iconSize, 0),
                size: new Vector2(iconSize, iconSize),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                backgroundTexture: (remIsActive ? MyGuiConstants.BS_REMOTE_ON : MyGuiConstants.BS_REMOTE_OFF)
                );

            remote.SetToolTip(remTooltip);
            gr.Controls.Add(remote);

            //Key icon
            if ((reasonT == MyRefuseReason.NoStableConnection || reasonT == MyRefuseReason.PlayerBroadcastOff) && reasonRC == MyRefuseReason.NoRemoteControl)
            {
                keyTooltip.Append(MyTexts.Get(MySpaceTexts.BroadcastScreen_UnavailableControlButton));
                keyIsActive = false;
            }
            if (keyIsActive && (reasonT == MyRefuseReason.NoOwner || reasonRC == MyRefuseReason.NoOwner || reasonT == MyRefuseReason.NoStableConnection || reasonT == MyRefuseReason.PlayerBroadcastOff))
            {
                keyIsActive = false;
                keyTooltip.Append(MyTexts.Get(MySpaceTexts.BroadcastScreen_NoOwnership));
            }
            if (reasonT == MyRefuseReason.NoOwner)
            {
                keyTooltip.AppendLine();
                keyTooltip.Append(MyTexts.Get(MySpaceTexts.DisplayName_Block_Antenna));
            }
            if (reasonRC == MyRefuseReason.NoOwner)
            {
                keyTooltip.AppendLine();
                keyTooltip.Append(MyTexts.Get(MySpaceTexts.DisplayName_Block_RemoteControl));
            }
            if (keyIsActive)
            {
                keyTooltip.Append(MyTexts.Get(MySpaceTexts.BroadcastScreen_Ownership));
            }
            MyGuiControlImage key = new MyGuiControlImage(
                size: new Vector2(iconSize, iconSize),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                backgroundTexture: (keyIsActive ? MyGuiConstants.BS_KEY_ON : MyGuiConstants.BS_KEY_OFF)
                );

            key.SetToolTip(keyTooltip.ToString());
            gr.Controls.Add(key);


            cell.Control = gr;
            m_shipsData.Controls.Add(gr);
            return(cell);
        }