• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GUI.MyGuiControlLabel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlLabel的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlLabel类的具体用法?C# MyGuiControlLabel怎么用?C# MyGuiControlLabel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyGuiControlLabel类属于Sandbox.Graphics.GUI命名空间,在下文中一共展示了MyGuiControlLabel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MyGuiScreenTriggerLives

        public MyGuiScreenTriggerLives(MyTrigger trg)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelLives = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.01f, 0.035f),
                text: MyTexts.Get(MySpaceTexts.GuiTriggersLives).ToString()
            );
            left += m_labelLives.Size.X + spacingH;
            m_lives = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2((WINSIZEX - spacingH) / 3 - 2 * spacingH - m_labelLives.Size.X, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "lives"
            };
            m_lives.TextChanged += OnLivesChanged;

            AddCaption(MySpaceTexts.GuiTriggerCaptionLives);
            Controls.Add(m_labelLives);
            Controls.Add(m_lives);

            m_lives.Text = ((MyTriggerLives)trg).LivesLeft.ToString();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:28,代码来源:MyGuiScreenTriggerLives.cs


示例2: WarningLine

            public WarningLine(MySimpleProfiler.PerformanceWarning warning, MyGuiScreenPerformanceWarnings screen)
            {
                Parent = new MyGuiControlParent();
                m_name = new MyGuiControlLabel(text: Truncate(warning.Block.DisplayName), position: new Vector2(-0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, font: VRage.Game.MyFontEnum.Red);
                m_description = new MyGuiControlLabel
                    (
                    text: String.IsNullOrEmpty(warning.Block.Description.String) ? MyTexts.GetString(MyCommonTexts.PerformanceWarningTooManyBlocks) : MyTexts.GetString(warning.Block.Description), 
                    position: new Vector2(-0.24f, 0), 
                    originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER
                    );
                m_separator = new MyGuiControlSeparatorList();
                Parent.Size = new Vector2(Parent.Size.X, m_description.Size.Y);
                m_separator.AddVertical(new Vector2(-0.25f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f);
                m_separator.AddVertical(new Vector2(0.35f, -Parent.Size.Y / 2 - 0.006f), Parent.Size.Y + 0.016f);
                m_time = new MyGuiControlLabel(position: new Vector2(0.43f, 0), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);

                switch (warning.Block.type)
                {
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.GRAPHICS:
                        screen.m_areaTitleGraphics.Warnings.Add(this);
                        break;
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.BLOCK:
                        screen.m_areaTitleBlocks.Warnings.Add(this);
                        break;
                    case MySimpleProfiler.MySimpleProfilingBlock.ProfilingBlockType.OTHER:
                        screen.m_areaTitleOther.Warnings.Add(this);
                        break;
                }
                this.Warning = warning;
            }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGuiScreenPerformanceWarnings.cs


示例3: LoadControls

        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;
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:34,代码来源:MyGuiScreenProgressBase.cs


示例4: MyGuiScreenTriggerTime

        public MyGuiScreenTriggerTime(MyTrigger trg, MyStringId labelText)
            : base(trg, new Vector2(WINSIZEX + 0.1f, WINSIZEY))
        {
            float left = m_textboxMessage.Position.X-m_textboxMessage.Size.X/2;
            float top = -WINSIZEY / 2f + MIDDLE_PART_ORIGIN.Y;
            m_labelTime = new MyGuiControlLabel(
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                position: new Vector2(left, top),
                size: new Vector2(0.013f, 0.035f),
                text: MyTexts.Get(labelText).ToString()//text: MyTexts.Get(MySpaceTexts.GuiTriggerTimeLimit).ToString()
            );
            left += m_labelTime.Size.X + spacingH;
            m_textboxTime = new MyGuiControlTextbox()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Position = new Vector2(left, top),
                Size = new Vector2(0.05f, 0.035f),
                Type = MyGuiControlTextboxType.DigitsOnly,
                Name = "time"
            };
            m_textboxTime.TextChanged += OnTimeChanged;

            Controls.Add(m_labelTime);
            Controls.Add(m_textboxTime);

        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:26,代码来源:MyGuiScreenTriggerTime.cs


示例5: RecreateControls

        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogAmount");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            Sandbox.Common.ObjectBuilders.Serializer.MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_amountTextbox = (MyGuiControlTextbox)Controls.GetControlByName("AmountTextbox");
            m_increaseButton = (MyGuiControlButton)Controls.GetControlByName("IncreaseButton");
            m_decreaseButton = (MyGuiControlButton)Controls.GetControlByName("DecreaseButton");
            m_confirmButton  = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton   = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_errorLabel     = (MyGuiControlLabel)Controls.GetControlByName("ErrorLabel");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_errorLabel.Visible = false;

            m_amountTextbox.TextChanged    += amountTextbox_TextChanged;
            m_increaseButton.ButtonClicked += increaseButton_OnButtonClick;
            m_decreaseButton.ButtonClicked += decreaseButton_OnButtonClick;
            m_confirmButton.ButtonClicked  += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked   += cancelButton_OnButtonClick;

            RefreshAmountTextbox();
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:31,代码来源:MyGuiScreenDialogAmount.cs


示例6: MyGuiControlItem

            public MyGuiControlItem(MyAbstractControlMenuItem item, Vector2? size = null)
                : base(size: size)
            {
                m_item = item;
                m_item.UpdateValue();
                m_label = new MyGuiControlLabel(text: item.ControlLabel, textScale: 0.8f);
                m_value = new MyGuiControlLabel(text: item.CurrentValue, textScale: 0.8f);

                MyLayoutVertical layout = new MyLayoutVertical(this, 28);
                layout.Add(m_label, m_value);
            }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:11,代码来源:MyGuiScreenControlMenu.cs


示例7: ComponentLineControl

            public ComponentLineControl(Vector2 size, float iconSize)
                : base(size: size, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
            {
                var m_iconSize = new Vector2(iconSize) * new Vector2(0.75f, 1);
                var middleLeft = new Vector2(-this.Size.X / 2, 0);
                var middleRight = new Vector2(this.Size.X / 2, 0);
                var iconPos = middleLeft - new Vector2(0, m_iconSize.Y / 2);

                //IconPanel = new MyGuiControlPanel();
                //IconPanelBackground = new MyGuiControlPanel();
                IconImage = new MyGuiControlImage();
                IconPanelProgress = new MyGuiControlPanel();
                NameLabel = new MyGuiControlLabel(text: String.Empty);
                NumbersLabel = new MyGuiControlLabel(text: String.Empty);
                
                //IconPanel.Size = m_iconSize;
                //IconPanel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                //IconPanel.Position = iconPos;

                //IconPanelBackground.Size = m_iconSize;
                //IconPanelBackground.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                //IconPanelBackground.Position = iconPos;
                //IconPanelBackground.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);

                IconImage.Size = m_iconSize;
                IconImage.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                IconImage.Position = iconPos;
                IconImage.BackgroundTexture = new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_MEDIUM_DEFAULT.Texture);

                IconPanelProgress.Size = m_iconSize;
                IconPanelProgress.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                IconPanelProgress.Position = iconPos;
                IconPanelProgress.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
                float gray = 0.1f;
                IconPanelProgress.ColorMask = new Vector4(gray, gray, gray, 0.5f);

                NameLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
                NameLabel.Position = middleLeft + new Vector2(m_iconSize.X + 0.01225f, 0);

                NameLabel.AutoEllipsis = true;

                NumbersLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
                NumbersLabel.Position = middleRight + new Vector2(-0.033f, 0); //topRight + new Vector2(-0.02f, 0.004f);

                //Elements.Add(IconPanelBackground);
                //Elements.Add(IconPanel);
                Elements.Add(IconImage);
                Elements.Add(IconPanelProgress);
                Elements.Add(NameLabel);
                Elements.Add(NumbersLabel);
            }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:51,代码来源:MyGuiControlBlockInfo.cs


示例8: MyGuiControlComponentList

        public MyGuiControlComponentList():
            base(isActiveControl: false)
        {
            m_padding = new MyGuiBorderThickness(0.02f, 0.008f);

            m_valuesLabel = new MyGuiControlLabel()
            {
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
                Text = "Required / Available",
                TextScale = 0.75f * MyGuiConstants.DEFAULT_TEXT_SCALE,
            };
            Elements.Add(m_valuesLabel);
            UpdatePositions();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:14,代码来源:MyGuiControlComponentList.cs


示例9: MyGuiControlVoxelHandSettings

        public MyGuiControlVoxelHandSettings()
            : base(size: new Vector2(0.25f, 0.4f),
                   backgroundTexture: new MyGuiCompositeTexture(MyGuiConstants.TEXTURE_HUD_BG_LARGE_DEFAULT.Texture),
                   originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP)
        {
            m_labelSettings = new MyGuiControlLabel()
            {
                Position = new Vector2(-0.1f, -0.1875f),
                TextEnum = MyCommonTexts.VoxelHandSettingScreen_ShapeSettings,
                OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                Font = MyFontEnum.ScreenCaption,
            };

            OKButton = new MyGuiControlButton() { Position = new Vector2(0f, 0.19f), TextEnum = MyCommonTexts.Ok, OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM };
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:15,代码来源:MyGuiControlVoxelHandSettings.cs


示例10: MyGuiControlBlockProperty

        public MyGuiControlBlockProperty(String title, String tooltip, MyGuiControlBase propertyControl,
            MyGuiControlBlockPropertyLayoutEnum layout = MyGuiControlBlockPropertyLayoutEnum.Vertical, bool showExtraInfo = true)
            : base(toolTip: tooltip, canHaveFocus: true, isActiveControl: false, allowFocusingElements: true)
        {
            const float LABEL_TEXT_SCALE = MyGuiConstants.DEFAULT_TEXT_SCALE * 0.95f;
            m_title = new MyGuiControlLabel(text: title, textScale: LABEL_TEXT_SCALE);
            if (title.Length > 0)
            {
                Elements.Add(m_title);
            }
            
            m_extraInfo = new MyGuiControlLabel(textScale: LABEL_TEXT_SCALE);
            if (showExtraInfo)
            {
                Elements.Add(m_extraInfo);
            }

            m_propertyControl = propertyControl;
            Elements.Add(m_propertyControl);

            titleHeight = title.Length > 0 || showExtraInfo ? m_title.Size.Y : 0;

            m_layout = layout;
            switch (layout)
            {
                case MyGuiControlBlockPropertyLayoutEnum.Horizontal:                    
                    MinSize = new Vector2(m_propertyControl.Size.X + m_title.Size.X * 1.1f, Math.Max(m_propertyControl.Size.Y, 2.1f * titleHeight));
                    Size = MinSize;

                    m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
                    m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    break;
                case MyGuiControlBlockPropertyLayoutEnum.Vertical:
                    MinSize = new Vector2(Math.Max(m_propertyControl.Size.X, m_title.Size.X), m_propertyControl.Size.Y + titleHeight * 1.1f);
                    Size = MinSize;

                    m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
                    m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
                    break;
            }

            RefreshPositionsAndSizes();

            m_extraInfo.Text = "";
            m_extraInfo.Visible = false;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:48,代码来源:MyGuiControlBlockProperty.cs


示例11: MyGuiScreenTriggerBlockDestroyed

        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);

        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:46,代码来源:MyGuiScreenTriggerBlockDestroyed.cs


示例12: MyGuiControlScenarioButton

 public MyGuiControlScenarioButton(MyScenarioDefinition scenario):
     base(key: MyDefinitionManager.Static.GetScenarioDefinitions().IndexOf(scenario))
 {
     VisualStyle = MyGuiControlRadioButtonStyleEnum.ScenarioButton;
     OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
     Scenario = scenario;
     m_titleLabel = new MyGuiControlLabel(text: scenario.DisplayNameText, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
     m_previewPanel = new MyGuiControlPanel(texture: scenario.Icon, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
     MyGuiSizedTexture image = new MyGuiSizedTexture() { SizePx = new Vector2(229f, 128f), };
     m_previewPanel.Size = image.SizeGui;
     m_previewPanel.BorderEnabled = true;
     m_previewPanel.BorderColor = MyGuiConstants.THEMED_GUI_LINE_COLOR.ToVector4();
     SetToolTip(scenario.DescriptionText);
     Size = new Vector2(Math.Max(m_titleLabel.Size.X, m_previewPanel.Size.X),
                        m_titleLabel.Size.Y + m_previewPanel.Size.Y);
     Elements.Add(m_titleLabel);
     Elements.Add(m_previewPanel);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:18,代码来源:MyGuiControlScenarioButton.cs


示例13: RecreateControls

        public override void RecreateControls(bool constructor)
        {
            base.RecreateControls(constructor);
            var layout = new MyLayoutTable(this);
            layout.SetColumnWidthsNormalized(50, 250, 150, 250, 50);
            layout.SetRowHeightsNormalized(50, 450, 30, 50);

            m_mainLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.GuiScenarioDescription), originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
            layout.AddWithSize(m_mainLabel, MyAlignH.Left, MyAlignV.Center, 0, 1, colSpan: 3);
            //BRIEFING:
            m_descriptionBox = new MyGuiControlMultilineText(
                position: new Vector2(0.0f, 0.0f),
                size: new Vector2(0.2f, 0.2f),
                textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                selectable: false);
            layout.AddWithSize(m_descriptionBox, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);

            m_okButton = new MyGuiControlButton(text: MyTexts.Get(MyCommonTexts.Ok), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(200, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnOkClicked);
            layout.AddWithSize(m_okButton, MyAlignH.Left, MyAlignV.Top, 2, 2);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:21,代码来源:MyGuiScreenBriefing.cs


示例14: MyGuiControlInventoryOwner

        public MyGuiControlInventoryOwner(IMyInventoryOwner owner, Vector4 labelColorMask)
            : base(backgroundTexture: new MyGuiCompositeTexture() { Center = new MyGuiSizedTexture() { Texture = @"Textures\GUI\Controls\item_highlight_dark.dds" } },
                    canHaveFocus: true,
                    allowFocusingElements: true,
                    isActiveControl: false)
        {
            Debug.Assert(owner != null);

            m_nameLabel = MakeLabel();
            m_nameLabel.ColorMask = labelColorMask;
            m_massLabels = new List<MyGuiControlLabel>();
            m_volumeLabels = new List<MyGuiControlLabel>();
            m_inventoryGrids = new List<MyGuiControlGrid>();
            ShowTooltipWhenDisabled = true;

            m_nameLabel.Name = "NameLabel";

            Elements.Add(m_nameLabel);

            InventoryOwner = owner;
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:21,代码来源:MyGuiControlInventoryOwner.cs


示例15: MyGuiScreenTrigger

        public MyGuiScreenTrigger(MyTrigger trg, Vector2 size)
            : base(size, MyGuiConstants.SCREEN_BACKGROUND_COLOR, size)
        {
            Vector2 m_itemPos=new Vector2();
            m_itemPos.Y = - size.Y / 2 + 0.1f;
            m_textboxName=new MyGuiControlLabel(
                position: m_itemPos,
                text: MyTexts.Get(MySpaceTexts.GuiTriggerMessage).ToString()
                );
            m_itemPos.Y += m_textboxName.Size.Y + VERTICAL_OFFSET;

            m_trigger = trg;
            m_textbox = new MyGuiControlTextbox(
                position: m_itemPos,
                defaultText: trg.Message,
                maxLength: 85);
            m_itemPos.Y += m_textbox.Size.Y + VERTICAL_OFFSET + 0.2f;
            //line to the left of textbox
            m_textboxName.Position = m_textboxName.Position-new Vector2(m_textbox.Size.X / 2 , 0);

            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.4f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f); 
            
            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_okButton.Position = buttonOrigin - buttonOffset;

            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MySpaceTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_textboxName);
            Controls.Add(m_textbox);
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:40,代码来源:MyGuiScreenTrigger.cs


示例16: RecreateControls

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

            AddCaption(MyStringId.GetOrCompute("Waiting for other players"));

            var label = new MyGuiControlLabel(text: "Game will start when all players join the world", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            m_timeOutLabel = new MyGuiControlLabel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            m_leaveButton = new MyGuiControlButton(text: new StringBuilder("Leave"), visualStyle: MyGuiControlButtonStyleEnum.Rectangular, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE,
                size: new Vector2(190f, 48f) / MyGuiConstants.GUI_OPTIMAL_SIZE, onButtonClick: OnLeaveClicked);

            const float colMargin = 60f;
            const float rowHeight = 65f;
            var layout = new MyLayoutTable(this);
            layout.SetColumnWidths(colMargin, 680, colMargin);
            layout.SetRowHeights(110, rowHeight, rowHeight, rowHeight, rowHeight, rowHeight);

            layout.Add(label, MyAlignH.Center, MyAlignV.Center, 1, 1);
            layout.Add(m_timeOutLabel, MyAlignH.Center, MyAlignV.Center, 2, 1);
            layout.Add(m_leaveButton, MyAlignH.Center, MyAlignV.Center, 3, 1);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:22,代码来源:MyGuiScreenScenarioWaitForPlayers.cs


示例17: RecreateControls

        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogText");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_valueTextbox = (MyGuiControlTextbox)Controls.GetControlByName("ValueTextbox");
            m_confirmButton  = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton   = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_confirmButton.ButtonClicked  += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked   += cancelButton_OnButtonClick;

            m_valueTextbox.Text = m_value;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:23,代码来源:MyGuiScreenDialogText.cs


示例18: RecreateControls

        public override void RecreateControls(bool constructor) 
        {
            base.RecreateControls(constructor);
            m_openWorkshopButton = new MyGuiControlButton(position: new Vector2(0.384f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ScreenLoadSubscribedWorldBrowseWorkshop), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_BrowseWorkshop_Tooltip), onButtonClick: OpenWorkshopButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_openWorkshopButton);

            m_okButton.Position = new Vector2(-0.016f, 0.4f);
            m_okButton.SetToolTip(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_CodeEditor_SaveExit_Tooltip));

            m_saveChanges = new MyGuiControlButton(position: new Vector2(0.184f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_RememberCode), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_RememberCode_Tooltip), onButtonClick: SaveCodeButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_saveChanges);

            m_checkCodeButton = new MyGuiControlButton(position: new Vector2(-0.216f, 0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_CheckCode), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_CheckCode_Tooltip), onButtonClick: CheckCodeButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_checkCodeButton);

            m_help = new MyGuiControlButton(position: new Vector2(0.384f, -0.4f), size: MyGuiConstants.BACK_BUTTON_SIZE, text: MyTexts.Get(MySpaceTexts.ProgrammableBlock_Editor_Help), toolTip: MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_HelpTooltip), onButtonClick: HelpButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
            Controls.Add(m_help);

            m_descriptionBox.Position = Vector2.Zero;
            m_descriptionBackgroundPanel.Size *= new Vector2(1.01f, 1.01f);
            m_descriptionBackgroundPanel.Position  = new Vector2(-0.48f,-0.37f);


            m_titleLabel.Position = new Vector2(0.0f, -0.4f);


            m_lineCounter = new MyGuiControlLabel(new Vector2(-0.479f, 0.4f), null, string.Format(MyTexts.GetString(MySpaceTexts.ProgrammableBlock_Editor_LineNo), 1, m_editorWindow.GetTotalNumLines()));
            Elements.Add(m_lineCounter);
            m_LetterCounter = new MyGuiControlLabel(new Vector2(-0.479f, -0.4f));
            Elements.Add(m_LetterCounter);
            m_TextTooLongMessage = new MyGuiControlLabel(new Vector2(-0.34f, -0.4f), font: MyFontEnum.Red);
            Elements.Add(m_TextTooLongMessage);

            EnableButtons();
            FocusedControl = m_descriptionBox;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:36,代码来源:MyGuiScreenEditor.cs


示例19: RecreateControls

        public override void RecreateControls(bool contructor)
        {
            base.RecreateControls(contructor);

            var fileName = MakeScreenFilepath("DialogAmount");
            var fsPath = Path.Combine(MyFileSystem.ContentPath, fileName);

            MyObjectBuilder_GuiScreen objectBuilder;
            MyObjectBuilderSerializer.DeserializeXML<MyObjectBuilder_GuiScreen>(fsPath, out objectBuilder);
            Init(objectBuilder);

            m_amountTextbox = (MyGuiControlTextbox)Controls.GetControlByName("AmountTextbox");
            m_increaseButton = (MyGuiControlButton)Controls.GetControlByName("IncreaseButton");
            m_decreaseButton = (MyGuiControlButton)Controls.GetControlByName("DecreaseButton");
            m_confirmButton = (MyGuiControlButton)Controls.GetControlByName("ConfirmButton");
            m_cancelButton = (MyGuiControlButton)Controls.GetControlByName("CancelButton");
            m_errorLabel = (MyGuiControlLabel)Controls.GetControlByName("ErrorLabel");
            m_captionLabel = (MyGuiControlLabel)Controls.GetControlByName("CaptionLabel");
            m_captionLabel.Text = null;
            m_captionLabel.TextEnum = m_caption;

            m_errorLabel.Visible = false;

            m_amountTextbox.TextChanged += amountTextbox_TextChanged;
            m_increaseButton.ButtonClicked += increaseButton_OnButtonClick;
            m_decreaseButton.ButtonClicked += decreaseButton_OnButtonClick;
            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked += cancelButton_OnButtonClick;

            m_confirmButton.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;
            m_cancelButton.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;

            RefreshAmountTextbox();
            //GR: in int have all text selected
            m_amountTextbox.SelectAll();
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:36,代码来源:MyGuiScreenDialogAmount.cs


示例20: MyGuiControlOnOffSwitch

        // mk:TODO Modify MyGuiControlList to allow different alignments and remove scale from this control.
        public MyGuiControlOnOffSwitch(
            bool initialValue = false,
            String onText = null,
            String offText = null)
        : base(canHaveFocus: true)
        {
            m_onButton = new MyGuiControlCheckbox(
                visualStyle: MyGuiControlCheckboxStyleEnum.SwitchOnOffLeft,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);

            m_offButton = new MyGuiControlCheckbox(
                visualStyle: MyGuiControlCheckboxStyleEnum.SwitchOnOffRight,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            m_onLabel = new MyGuiControlLabel(
                position: new Vector2(m_onButton.Size.X * -0.5f, 0.0f),
                text: onText ?? MyTexts.GetString(MySpaceTexts.SwitchText_On),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            m_offLabel = new MyGuiControlLabel(
                position: new Vector2(m_onButton.Size.X * 0.5f, 0.0f),
                text: offText ?? MyTexts.GetString(MySpaceTexts.SwitchText_Off),
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            // Set the size to contain the 2 buttons and space between them.
            // Buttons should not overlap, otherwise this will give us wrong results.
            Size = new Vector2(m_onButton.Size.X + m_offButton.Size.X, Math.Max(m_onButton.Size.Y, m_offButton.Size.Y));

            Elements.Add(m_onButton);
            Elements.Add(m_offButton);
            Elements.Add(m_onLabel);
            Elements.Add(m_offLabel);

            m_value = initialValue;
            UpdateButtonState();
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:37,代码来源:MyGuiControlOnOffSwitch.cs



注:本文中的Sandbox.Graphics.GUI.MyGuiControlLabel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GUI.MyGuiControlList类代码示例发布时间:2022-05-26
下一篇:
C# GUI.MyGuiControlGrid类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap