void LoadControls()
        {
            // Background texture unloaded in base
            m_wheelTexture = MyGuiConstants.LOADING_TEXTURE;

            m_size = new Vector2(598 / 1600f, 368 / 1200f);
            m_progressTextLabel = new MyGuiControlLabel(
                position: new Vector2(0.0f, -0.07f),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.86f,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            m_progressTextLabel.TextEnum = m_progressText;
            Controls.Add(m_progressTextLabel);

            float deltaX = 0;// (m_enableCancel) ? 0.08f : 0.0f;
            float deltaY = 0.015f;

            m_rotatingWheel = new MyGuiControlRotatingWheel(new Vector2(-deltaX, deltaY), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_wheelTexture);

            Controls.Add(m_rotatingWheel);

            //  Sometimes we don't want to allow user to cancel pending progress screen
            if (m_cancelText.HasValue)
            {
                var cancelButton = new MyGuiControlButton(
                    position: new Vector2(deltaX, deltaY + 0.09f),
                    size: MyGuiConstants.BACK_BUTTON_SIZE,
                    text: MyTexts.Get(m_cancelText.Value),
                    visualStyle: Common.ObjectBuilders.Gui.MyGuiControlButtonStyleEnum.ControlSetting,
                    onButtonClick: OnCancelClick);
                Controls.Add(cancelButton);
            }
            m_controlsCreated = true;
        }
Ejemplo n.º 2
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 loadingTextSize = MyGuiManager.MeasureString(m_fontId,
                MyTexts.Get(MyCommonTexts.LoadingPleaseWaitUppercase), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE);
            m_wheel = new MyGuiControlRotatingWheel(
                MyGuiConstants.LOADING_PLEASE_WAIT_POSITION - new Vector2(0, 0.06f + loadingTextSize.Y),
                MyGuiConstants.ROTATING_WHEEL_COLOR,
                MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                m_rotatingWheelTexture,
                false,
                MyPerGameSettings.GUI.MultipleSpinningWheels);

            StringBuilder contents;

            if(!string.IsNullOrEmpty(m_customTextFromConstructor))
                contents = new StringBuilder(m_customTextFromConstructor);
            else
                contents = MyTexts.Get(m_currentQuote.Text);

            m_quoteTextControl = new MyGuiControlMultilineText(
                position: Vector2.One * 0.5f,
                size: new Vector2(0.9f, 0.2f),
                backgroundColor: Vector4.One,
                font: m_fontId,
                textScale: 1.0f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                contents: contents,
                drawScrollbar: false);
            m_quoteTextControl.BorderEnabled = false;
            m_quoteTextControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
            m_quoteTextControl.TextBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;

            Controls.Add(m_wheel);
            RefreshQuote();
        }
Ejemplo n.º 3
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_toolbarControl = new MyGuiControlToolbar();
            m_toolbarControl.Position = new Vector2(0.5f, 0.99f);
            m_toolbarControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
            m_toolbarControl.IsActiveControl = false;
            Elements.Add(m_toolbarControl);
            m_textScale = MyGuiConstants.HUD_TEXT_SCALE * MyGuiManager.LanguageTextScale;

            var style = new MyGuiControlBlockInfo.MyControlBlockInfoStyle()
            {
                BlockNameLabelFont = MyFontEnum.White,
                EnableBlockTypeLabel = true,
                ComponentsLabelText = MySpaceTexts.HudBlockInfo_Components,
                ComponentsLabelFont = MyFontEnum.Blue,
                InstalledRequiredLabelText = MySpaceTexts.HudBlockInfo_Installed_Required,
                InstalledRequiredLabelFont = MyFontEnum.Blue,
                RequiredLabelText = MyCommonTexts.HudBlockInfo_Required,
                IntegrityLabelFont = MyFontEnum.White,
                IntegrityBackgroundColor = new Vector4(78 / 255.0f, 116 / 255.0f, 137 / 255.0f, 1.0f),
                IntegrityForegroundColor = new Vector4(0.5f, 0.1f, 0.1f, 1),
                IntegrityForegroundColorOverCritical = new Vector4(118 / 255.0f, 166 / 255.0f, 192 / 255.0f, 1.0f),
                LeftColumnBackgroundColor = new Vector4(46 / 255.0f, 76 / 255.0f, 94 / 255.0f, 1.0f),
                TitleBackgroundColor = new Vector4(72 / 255.0f, 109 / 255.0f, 130 / 255.0f, 1.0f),
                ComponentLineMissingFont = MyFontEnum.Red,
                ComponentLineAllMountedFont = MyFontEnum.White,
                ComponentLineAllInstalledFont = MyFontEnum.Blue,
                ComponentLineDefaultFont = MyFontEnum.White,
                ComponentLineDefaultColor = new Vector4(0.6f, 0.6f, 0.6f, 1f),
                ShowAvailableComponents = false,
                EnableBlockTypePanel = true,
            };
            m_blockInfo = new MyGuiControlBlockInfo(style);
            m_blockInfo.IsActiveControl = false;
            Controls.Add(m_blockInfo);

            m_questlogControl = new MyGuiControlQuestlog(new Vector2(20f, 20f));
            m_questlogControl.IsActiveControl = false;
            m_questlogControl.RecreateControls();
            Controls.Add(m_questlogControl);

            m_chatControl = new MyHudControlChat(MyHud.Chat, Vector2.Zero, new Vector2(0.4f, 0.28f), visibleLinesCount: 12);
            Elements.Add(m_chatControl);

            m_cameraInfoMultilineControl = new MyGuiControlMultilineText(
                position: Vector2.Zero,
                size: new Vector2(0.4f, 0.25f),
                backgroundColor: null,
                font: MyFontEnum.White,
                textScale: 0.7f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                contents: null,
                drawScrollbar: false,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cameraInfoMultilineControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            Elements.Add(m_cameraInfoMultilineControl);

            m_rotatingWheelControl = new MyGuiControlRotatingWheel(position: new Vector2(0.5f, 0.85f));

            Controls.Add(m_rotatingWheelControl);

            Vector2 buildModePosition = new Vector2(0.5f, 0.02f);
            buildModePosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref buildModePosition);
            m_buildModeLabel = new MyGuiControlLabel(
                position: buildModePosition,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                font: MyFontEnum.White,
                text: MyTexts.GetString(MyCommonTexts.Hud_BuildMode));
            Controls.Add(m_buildModeLabel);

            m_blocksLeft = new MyGuiControlLabel(
                position: new Vector2(0.238f, 0.89f),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                font: MyFontEnum.White,
                text: MyHud.BlocksLeft.GetStringBuilder().ToString()
                );
            Controls.Add(m_blocksLeft);

            m_relayNotification = new MyGuiControlLabel(new Vector2(1, 0), font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_relayNotification.TextEnum = MyCommonTexts.Multiplayer_IndirectConnection;
            m_relayNotification.Visible = false;
            Controls.Add(m_relayNotification);
            var offset = new Vector2(0, m_relayNotification.Size.Y);
            m_noMsgSentNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Debug, text: MyTexts.GetString(MyCommonTexts.Multiplayer_LastMsg), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_noMsgSentNotification.Visible = false;
            Controls.Add(m_noMsgSentNotification);
            offset += new Vector2(0, m_noMsgSentNotification.Size.Y);
            m_noConnectionNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Red, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_noConnectionNotification.TextEnum = MyCommonTexts.Multiplayer_NoConnection;
            m_noConnectionNotification.Visible = false;
            Controls.Add(m_noConnectionNotification);

            m_serverSavingNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_serverSavingNotification.TextEnum = MyCommonTexts.SavingPleaseWait;
            m_serverSavingNotification.Visible = false;
            Controls.Add(m_serverSavingNotification);

            MyHud.ReloadTexts();
        }
Ejemplo n.º 4
0
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            MyAnalyticsHelper.ReportActivityStart(null, "show_blueprints", string.Empty, "gui", string.Empty);

            Vector2 searchPosition = new Vector2(0f, SCREEN_SIZE.Y - 1.58f);

            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            var searchBoxLabel = MakeLabel("Search:", searchPosition + new Vector2(-0.175f, -0.015f), m_textScale);
            m_searchBox = new MyGuiControlTextbox(searchPosition);
            m_searchBox.Size = new Vector2(0.2f, 0.2f);

            m_searchClear = new MyGuiControlButton()
            {
                Position = searchPosition + new Vector2(0.077f, 0f),
                Size = new Vector2(0.045f, 0.05666667f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle = MyGuiControlButtonStyleEnum.Close,
				ActivateOnMouseRelease = true,
            };
            m_searchClear.ButtonClicked += OnSearchClear;

            m_blueprintList.Position = new Vector2(0f, -0.03f);
            m_blueprintList.VisibleRowsCount = 17;
            m_blueprintList.MultiSelect = false;

            var caption = AddCaption("Blueprints screen", VRageMath.Color.White.ToVector4(), m_controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));
            Controls.Add(searchBoxLabel);
            Controls.Add(m_searchBox);
            Controls.Add(m_searchClear);
            Controls.Add(m_blueprintList);

            RefreshThumbnail();
            Controls.Add(m_thumbnailImage);

            CreateButtons();

            var texture = MyGuiConstants.LOADING_TEXTURE;

            m_wheel = new MyGuiControlRotatingWheel(
                searchPosition + new Vector2(0.127f, 0f),
                MyGuiConstants.ROTATING_WHEEL_COLOR,
                0.28f,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                texture,
                true,
                multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);
            Controls.Add(m_wheel);
            m_wheel.Visible = false;
        }
Ejemplo n.º 5
0
        public MyGuiControlNews():
            base(isActiveControl: true,
            canHaveFocus: false,
            allowFocusingElements: true)
        {
            m_news = new List<MyNewsEntry>();

            m_labelTitle = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP) {
                Name = "Title"
            };
            m_labelDate = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP) {
                Name = "Date"
            };
            m_separator = new MyGuiControlSeparatorList() {
                Name = "Separator",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER
            };
            m_textNewsEntry = new MyGuiControlMultilineText(
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f,
                drawScrollbar: true)
            {
                Name = "NewsEntry",
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
            };
            m_textNewsEntry.OnLinkClicked += OnLinkClicked;
            m_bottomPanel = new MyGuiControlPanel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_PAGING_BACKGROUND,
                Name = "BottomPanel",
            };
            m_labelPages = new MyGuiControlLabel(
                text: new StringBuilder("{0}/{1}  ").ToString(),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM) {
                Name = "Pages"
            };
            m_buttonPrev = new MyGuiControlButton(
                visualStyle: MyGuiControlButtonStyleEnum.ArrowLeft,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                onButtonClick: (b) => UpdateCurrentEntryIndex(-1)) {
                Name = "Previous"
            };
            m_buttonNext = new MyGuiControlButton(
                visualStyle: MyGuiControlButtonStyleEnum.ArrowRight,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM,
                onButtonClick: (b) => UpdateCurrentEntryIndex(+1)) {
                Name = "Next"
            };
            m_textError = new MyGuiControlMultilineText(
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                font: MyFontEnum.Red) {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                Name = "Error"
            };
            m_backgroundPanel = new MyGuiControlCompositePanel()
            {
                ColorMask = new Vector4(1f, 1f, 1f, 0.69f),
                BackgroundTexture = MyGuiConstants.TEXTURE_NEWS_BACKGROUND
            };

            m_wheelLoading = new MyGuiControlRotatingWheel(multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);

            Elements.Add(m_backgroundPanel);
            Elements.Add(m_labelTitle);
            Elements.Add(m_labelDate);
            Elements.Add(m_separator);
            Elements.Add(m_textNewsEntry);
            Elements.Add(m_bottomPanel);
            Elements.Add(m_labelPages);
            Elements.Add(m_buttonPrev);
            Elements.Add(m_buttonNext);
            Elements.Add(m_textError);
            Elements.Add(m_wheelLoading);

            if (false)
            {
                m_textNewsEntry.BorderEnabled = true;
                m_labelPages.BorderEnabled = true;
                m_bottomPanel.BorderEnabled = true;
                m_buttonPrev.BorderEnabled = true;
                m_buttonNext.BorderEnabled = true;
                m_textError.BorderEnabled = true;
                m_wheelLoading.BorderEnabled = true;
            }

            RefreshState();
            UpdatePositionsAndSizes();
            RefreshShownEntry();

            try
            {
                m_newsSerializer = new XmlSerializer(typeof(MyNews));
            }
            finally
            {
                DownloadNews();   
            }
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            Vector2 searchPosition = new Vector2(-0.025f, SCREEN_SIZE.Y - 1.59f);

            float hiddenPartTop = (SCREEN_SIZE.Y - 1.0f) / 2.0f;

            var searchBoxLabel = MakeLabel(MyTexts.GetString(MySpaceTexts.ScreenCubeBuilderBlockSearch), searchPosition + new Vector2(-0.129f, -0.015f), m_textScale);
            m_searchBox = new MyGuiControlTextbox(searchPosition);
            m_searchBox.Size = new Vector2(0.15f, 0.2f);

            m_searchClear = new MyGuiControlButton()
            {
                Position = searchPosition + new Vector2(0.078f, 0f),
                Size = new Vector2(0.045f, 0.05666667f),
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                VisualStyle = MyGuiControlButtonStyleEnum.Close
            };
            m_searchClear.ButtonClicked += OnSearchClear;

            m_scriptList.Size -= new Vector2(0.1f,0f);
            m_scriptList.Position = new Vector2(-0.015f, -0.07f);
            m_scriptList.VisibleRowsCount = 17;
            m_scriptList.MultiSelect = false;

            var caption = AddCaption(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_ScriptsScreenTitle), VRageMath.Color.White.ToVector4(), m_controlPadding + new Vector2(-HIDDEN_PART_RIGHT, hiddenPartTop));
            Controls.Add(searchBoxLabel);
            Controls.Add(m_searchBox);
            Controls.Add(m_searchClear);
            Controls.Add(m_scriptList);

            CreateButtons();

            var texture = MyGuiConstants.LOADING_TEXTURE;

            m_wheel = new MyGuiControlRotatingWheel(
                searchPosition + new Vector2(0.123f, 0f),
                MyGuiConstants.ROTATING_WHEEL_COLOR,
                0.28f,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                texture,
                true,
                multipleSpinningWheels: MyPerGameSettings.GUI.MultipleSpinningWheels);
            Controls.Add(m_wheel);
            m_wheel.Visible = false;
        }
        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);

            m_toolbarControl = new MyGuiControlToolbar();
            m_toolbarControl.Position = new Vector2(0.5f, 0.99f);
            m_toolbarControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM;
            m_toolbarControl.IsActiveControl = false;
            Elements.Add(m_toolbarControl);
            m_textScale = MyGuiConstants.HUD_TEXT_SCALE * MyGuiManager.LanguageTextScale;

            m_blockInfo = new MyGuiControlBlockInfo();
            m_blockInfo.IsActiveControl = false;
            Controls.Add(m_blockInfo);

            m_chatControl = new MyHudControlChat(Vector2.Zero, new Vector2(0.4f, 0.25f));
            Elements.Add(m_chatControl);

            m_cameraInfoMultilineControl = new MyGuiControlMultilineText(
                position: Vector2.Zero,
                size: new Vector2(0.4f, 0.25f),
                backgroundColor: null,
                font: MyFontEnum.White,
                textScale: 0.7f,
                textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM,
                contents: null,
                drawScrollbar: false,
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cameraInfoMultilineControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM;
            Elements.Add(m_cameraInfoMultilineControl);

            m_rotatingWheelControl = new MyGuiControlRotatingWheel(position: new Vector2(0.5f, 0.85f));

            Controls.Add(m_rotatingWheelControl);

            Vector2 buildModePosition = new Vector2(0.5f, 0.02f);
            buildModePosition = MyGuiScreenHudBase.ConvertHudToNormalizedGuiPosition(ref buildModePosition);
            m_buildModeLabel = new MyGuiControlLabel(
                position: buildModePosition,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                font: MyFontEnum.White,
                text: MyTexts.GetString(MySpaceTexts.Hud_BuildMode));
            Controls.Add(m_buildModeLabel);

            m_relayNotification = new MyGuiControlLabel(new Vector2(1, 0), font: MyFontEnum.White, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_relayNotification.TextEnum = MySpaceTexts.Multiplayer_IndirectConnection;
            m_relayNotification.Visible = false;
            Controls.Add(m_relayNotification);
            var offset = new Vector2(0, m_relayNotification.Size.Y);
            m_noMsgSentNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset,font: MyFontEnum.Debug, text: MyTexts.GetString(MySpaceTexts.Multiplayer_LastMsg), originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_noMsgSentNotification.Visible = false;
            Controls.Add(m_noMsgSentNotification);
            offset += new Vector2(0, m_noMsgSentNotification.Size.Y);
            m_noConnectionNotification = new MyGuiControlLabel(new Vector2(1, 0) + offset, font: MyFontEnum.Red , originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP);
            m_noConnectionNotification.TextEnum = MySpaceTexts.Multiplayer_NoConnection;
            m_noConnectionNotification.Visible = false;
            Controls.Add(m_noConnectionNotification);
            MyHud.ReloadTexts();
        }