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

C# GUI.MyGuiControlTextbox类代码示例

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

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



MyGuiControlTextbox类属于Sandbox.Graphics.GUI命名空间,在下文中一共展示了MyGuiControlTextbox类的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: RecreateControls

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

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select the amount and type of items to spawn in your inventory", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_amountTextbox = new MyGuiControlTextbox(new Vector2(-0.2f, 0.0f), null, 9, null, MyGuiConstants.DEFAULT_TEXT_SCALE, MyGuiControlTextboxType.DigitsOnly);
            m_items = new MyGuiControlCombobox(new Vector2(0.2f, 0.0f), new Vector2(0.3f, 0.05f), null, null, 10, null);
            m_confirmButton = new MyGuiControlButton(new Vector2(0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Confirm"));
            m_cancelButton = new MyGuiControlButton(new Vector2(-0.21f, 0.10f), MyGuiControlButtonStyleEnum.Default, new Vector2(0.2f, 0.05f), null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, null, new System.Text.StringBuilder("Cancel"));

            foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
            {
                var physicalItemDef = definition as MyPhysicalItemDefinition;
                if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                    continue;

                int key = m_physicalItemDefinitions.Count;
                m_physicalItemDefinitions.Add(physicalItemDef);
                m_items.AddItem(key, definition.DisplayNameText);
            }

            this.Controls.Add(m_amountTextbox);
            this.Controls.Add(m_items);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

            m_amountTextbox.Text = string.Format("{0}", m_lastAmount);
            m_items.SelectItemByIndex(m_lastSelectedItem);

            m_confirmButton.ButtonClicked += confirmButton_OnButtonClick;
            m_cancelButton.ButtonClicked += cancelButton_OnButtonClick;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:32,代码来源:MyTestersDebugInputComponent.cs


示例3: 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


示例4: 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


示例5: RecreateControls

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

            var caption = AddCaption(m_caption, VRageMath.Color.White.ToVector4());
            m_nameBox = new MyGuiControlTextbox(new Vector2(0f, 0f), maxLength: m_maxTextLength);
            m_nameBox.Text = m_defaultName;
            m_nameBox.Size = new Vector2(m_textBoxWidth, 0.2f);
            Controls.Add(m_nameBox);

            Createbuttons();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:12,代码来源:MyGuiBlueprintDialog.cs


示例6: OnLivesChanged

 public void OnLivesChanged(MyGuiControlTextbox sender)
 {
     int? lives = StrToInt(sender.Text);
     if (lives != null && lives>0)
     {
         sender.ColorMask = Vector4.One;
         m_okButton.Enabled = true;
     }
     else
     {
         sender.ColorMask = Color.Red.ToVector4();
         m_okButton.Enabled = false;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:14,代码来源:MyGuiScreenTriggerLives.cs


示例7: OnTimeChanged

 public void OnTimeChanged(MyGuiControlTextbox sender)
 {
     int? time = StrToInt(sender.Text);
     if (time != null && IsValid((int)time))
     {
         sender.ColorMask = Vector4.One;
         m_okButton.Enabled = true;
     }
     else
     {
         sender.ColorMask = Color.Red.ToVector4();
         m_okButton.Enabled = false;
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:14,代码来源:MyGuiScreenTriggerTime.cs


示例8: 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


示例9: Init

        public void Init(IMyGuiControlsParent controlsParent)
        {
            m_playerList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("PlayerListbox");
            m_factionList = (MyGuiControlListbox)controlsParent.Controls.GetControlByName("FactionListbox");

            m_chatHistory = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("ChatHistory");
            m_chatbox = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("Chatbox");

            m_playerList.ItemsSelected += m_playerList_ItemsSelected;
            m_playerList.MultiSelect = false;

            m_factionList.ItemsSelected += m_factionList_ItemsSelected;
            m_factionList.MultiSelect = false;

            m_sendButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("SendButton");
            m_sendButton.ButtonClicked += m_sendButton_ButtonClicked;

            m_chatbox.TextChanged += m_chatbox_TextChanged;
            m_chatbox.EnterPressed += m_chatbox_EnterPressed;

            if (MySession.Static.LocalCharacter != null)
            {
                MySession.Static.ChatSystem.PlayerMessageReceived += MyChatSystem_PlayerMessageReceived;
                MySession.Static.ChatSystem.FactionMessageReceived += MyChatSystem_FactionMessageReceived;
                MySession.Static.ChatSystem.GlobalMessageReceived += MyChatSystem_GlobalMessageReceived;

                MySession.Static.ChatSystem.FactionHistoryDeleted += ChatSystem_FactionHistoryDeleted;
                MySession.Static.ChatSystem.PlayerHistoryDeleted += ChatSystem_PlayerHistoryDeleted;
            }

            MySession.Static.Players.PlayersChanged += Players_PlayersChanged;
            
            RefreshLists();

            m_chatbox.SetText(m_emptyText);
            m_sendButton.Enabled = false;

            if (MyMultiplayer.Static != null)
            {
                MyMultiplayer.Static.ChatMessageReceived += Multiplayer_ChatMessageReceived;
            }


            m_closed = false;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:45,代码来源:MyTerminalChatController.cs


示例10: MyGuiScreenSaveAs

        public MyGuiScreenSaveAs(MyWorldInfo copyFrom, string sessionPath, List<string> existingSessionNames)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.5f, 0.35f))
        {
            EnabledBackgroundFade = true;

            AddCaption(MyCommonTexts.ScreenCaptionSaveAs);

            float textboxPositionY = -0.02f;

            m_nameTextbox = new MyGuiControlTextbox(
                position: new Vector2(0, textboxPositionY),
                defaultText: copyFrom.SessionName,
                maxLength: 75);

            m_okButton = new MyGuiControlButton(
                text: MyTexts.Get(MyCommonTexts.Ok),
                onButtonClick: OnOkButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(
                text: MyTexts.Get(MyCommonTexts.Cancel),
                onButtonClick: OnCancelButtonClick,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);

            Vector2 buttonOrigin = new Vector2(0f, Size.Value.Y * 0.4f);
            Vector2 buttonOffset = new Vector2(0.01f, 0f);

            m_okButton.Position     = buttonOrigin - buttonOffset;
            m_cancelButton.Position = buttonOrigin + buttonOffset;

            Controls.Add(m_nameTextbox);
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            m_nameTextbox.MoveCarriageToEnd();
            m_copyFrom = copyFrom;
            m_sessionPath = sessionPath;
            m_existingSessionNames = existingSessionNames;

            CloseButtonEnabled = true;
            CloseButtonOffset = new Vector2(-0.005f, 0.0035f);
            OnEnterCallback = OnEnterPressed;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:42,代码来源:MyGuiScreenSaveAs.cs


示例11: 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


示例12: m_chatbox_TextChanged

        void m_chatbox_TextChanged(MyGuiControlTextbox obj)
        {
            m_chatboxText.Clear();
            obj.GetText(m_chatboxText);
            if (m_chatboxText.Length == 0)
            {
                m_sendButton.Enabled = false;
            }
            else
            {
                if (MySession.Static.LocalCharacter != null)
                {
                    m_sendButton.Enabled = true;
                }

                if (m_chatboxText.Length > MyChatConstants.MAX_CHAT_STRING_LENGTH)
                {
                    m_chatboxText.Length = MyChatConstants.MAX_CHAT_STRING_LENGTH;
                    m_chatbox.SetText(m_chatboxText);
                }
            }
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:22,代码来源:MyTerminalChatController.cs


示例13: 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


示例14: MyGuiScreenChat

        public MyGuiScreenChat(Vector2 position)
            : base(position, MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            MySandboxGame.Log.WriteLine("MyGuiScreenChat.ctor START");

            EnabledBackgroundFade = false;
            m_isTopMostScreen = true;
            CanHideOthers = false;
            DrawMouseCursor = false;
            m_closeOnEsc = true;
            
            m_chatTextbox = new MyGuiControlTextbox(
                Vector2.Zero,
                null,
                ChatMessageBuffer.MAX_MESSAGE_SIZE);
            m_chatTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_chatTextbox.Size = new Vector2(0.4f, 0.05f);
            m_chatTextbox.TextScale = 0.8f;
            m_chatTextbox.VisualStyle = MyGuiControlTextboxStyleEnum.Default;

            Controls.Add(m_chatTextbox);

            MySandboxGame.Log.WriteLine("MyGuiScreenChat.ctor END");
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:24,代码来源:MyGuiScreenChat.cs


示例15: 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


示例16: OnAmountTextChanged

 private void OnAmountTextChanged(MyGuiControlTextbox textbox)
 {
     m_errorLabel.Visible = false;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:4,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例17: GetProceduralAsteroidSeed

        private int GetProceduralAsteroidSeed(MyGuiControlTextbox textbox)
        {
            int seed = 12345;
            if (!Int32.TryParse(textbox.Text, out seed))
            {
                //if user didn't passed right seed we will try to calculate it from string  : )
                String text = textbox.Text;

                HashAlgorithm algorithm = SHA1.Create();
                byte[] bytes = algorithm.ComputeHash(Encoding.UTF8.GetBytes(text));
                //hash is too big to store it in int, so we take only first four bytes - it's more than fine, though
                int shift = 0;
                for (int i = 0; i < 4 && i < bytes.Length; ++i)
                {
                    seed |= bytes[i] << shift;
                    shift += 8;
                }
            }
            return seed;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:20,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例18: CreateProceduralAsteroidsSpawnMenu

        private void CreateProceduralAsteroidsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSize), Vector4.One, m_scale);

            m_procAsteroidSize = new MyGuiControlSlider(
                position: m_currentPosition,
                width: 400f / MyGuiConstants.GUI_OPTIMAL_SIZE.X,
                minValue: 5.0f,
                maxValue: 500f,
                labelText: String.Empty,
                labelDecimalPlaces: 2,
                labelScale: 0.75f * m_scale,
                originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
                labelFont: MyFontEnum.Debug);
            m_procAsteroidSize.DebugScale = m_sliderDebugScale;
            m_procAsteroidSize.ColorMask = Color.White.ToVector4();
            Controls.Add(m_procAsteroidSize);

            MyGuiControlLabel label = new MyGuiControlLabel(
                position: m_currentPosition + new Vector2(m_procAsteroidSize.Size.X + 0.005f, m_procAsteroidSize.Size.Y / 2),
                text: String.Empty,
                colorMask: Color.White.ToVector4(),
                textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.8f * m_scale,
                font: MyFontEnum.Debug);
            label.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
            Controls.Add(label);
            m_procAsteroidSize.ValueChanged += (MyGuiControlSlider s) => { label.Text = MyValueFormatter.GetFormatedFloat(s.Value, 2) + "m"; m_procAsteroidSizeValue = s.Value; };

            m_procAsteroidSize.Value = m_procAsteroidSizeValue;

            m_currentPosition.Y += m_procAsteroidSize.Size.Y;
            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ProceduralSeed), Color.White.ToVector4(), m_scale);

            m_procAsteroidSeed = new MyGuiControlTextbox(m_currentPosition, m_procAsteroidSeedValue, 20, Color.White.ToVector4(), m_scale, MyGuiControlTextboxType.Normal);
            m_procAsteroidSeed.TextChanged += (MyGuiControlTextbox t) => { m_procAsteroidSeedValue = t.Text; };
            m_procAsteroidSeed.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            Controls.Add(m_procAsteroidSeed);
            m_currentPosition.Y += m_procAsteroidSize.Size.Y + separatorSize;

            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_GenerateSeed, generateSeedButton_OnButtonClick);
            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_AsteroidGenerationCanTakeLong), Color.Red.ToVector4(), m_scale);
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnAsteroid, OnSpawnProceduralAsteroid);

            m_currentPosition.Y += separatorSize;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:47,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例19: CreateObjectsSpawnMenu

        private void CreateObjectsSpawnMenu(float separatorSize, float usableWidth)
        {
            AddSubcaption(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_Items), Color.White.ToVector4(), new Vector2(-HIDDEN_PART_RIGHT, 0.0f));

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemType), Vector4.One, m_scale);
            m_physicalObjectCombobox = AddCombo();
            {
                foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions())
                {
                    if (!definition.Public)
                        continue;
                    var physicalItemDef = definition as MyPhysicalItemDefinition;
                    if (physicalItemDef == null || physicalItemDef.CanSpawnFromScreen == false)
                        continue;

                    int key = m_physicalItemDefinitions.Count;
                    m_physicalItemDefinitions.Add(physicalItemDef);
                    m_physicalObjectCombobox.AddItem(key, definition.DisplayNameText);
                }
                m_physicalObjectCombobox.SortItemsByValueText();
                m_physicalObjectCombobox.SelectItemByIndex(m_lastSelectedFloatingObjectIndex);
                m_physicalObjectCombobox.ItemSelected += OnPhysicalObjectCombobox_ItemSelected;
            }

            m_currentPosition.Y += separatorSize;

            AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_ItemAmount), Vector4.One, m_scale);
            m_amountTextbox = new MyGuiControlTextbox(m_currentPosition, m_amount.ToString(), 6, null, m_scale, MyGuiControlTextboxType.DigitsOnly);
            m_amountTextbox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
            m_amountTextbox.TextChanged += OnAmountTextChanged;
            Controls.Add(m_amountTextbox);

            m_currentPosition.Y += separatorSize + m_amountTextbox.Size.Y;
            m_errorLabel = AddLabel(MyTexts.GetString(MySpaceTexts.ScreenDebugSpawnMenu_InvalidAmount), Color.Red.ToVector4(), m_scale);
            m_errorLabel.Visible = false;
            CreateDebugButton(usableWidth, MySpaceTexts.ScreenDebugSpawnMenu_SpawnObject, OnSpawnPhysicalObject);

            m_currentPosition.Y += separatorSize;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:39,代码来源:MyGuiScreenDebugSpawnMenu.cs


示例20: blockSearch_TextChanged

 void blockSearch_TextChanged(MyGuiControlTextbox obj)
 {
     if (obj.Text != "")
     {
         String[] tmpSearch = obj.Text.Split(' ');
         foreach (var item in m_blockListbox.Items)
         {
             String tmpName = item.Text.ToString().ToLower();
             bool add = true;
             foreach (var search in tmpSearch)
                 if (!tmpName.Contains(search.ToLower()))
                 {
                     add = false;
                     break;
                 }
             if (add)
                 item.Visible = true;
             else
                 item.Visible = false;
         }
     }
     else
     {
         foreach (var item in m_blockListbox.Items)
             item.Visible = true;
     }
     //SelectBlocks();
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:28,代码来源:MyTerminalControlPanel.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Cards.Card类代码示例发布时间:2022-05-26
下一篇:
C# GUI.MyGuiControlTable类代码示例发布时间: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