当前位置: 首页>>代码示例>>C#>>正文


C# GUI.MyGuiControlButton类代码示例

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


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

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

示例2: RecreateControls

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

            this.Controls.Add(new MyGuiControlLabel(new Vector2(0.0f, -0.10f), text: "Select gps you want to reach. (Dont use for grids with subgrids.)", originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));
            m_prefabs = 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"));

            List<IMyGps> outlist = new List<IMyGps>();
            MySession.Static.Gpss.GetGpsList(MySession.Static.LocalPlayerId, outlist);
            foreach (var prefab in outlist)
            {
                int key = m_prefabDefinitions.Count;
                m_prefabDefinitions.Add(prefab);
                m_prefabs.AddItem(key, prefab.Name);
            }

            this.Controls.Add(m_prefabs);
            this.Controls.Add(m_confirmButton);
            this.Controls.Add(m_cancelButton);

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

示例3: OnStartClicked

 protected override void OnStartClicked(MyGuiControlButton sender)
 {
     Debug.Assert(!Sync.IsServer);
     //joining into running game:
     MySyncScenario.OnPrepareScenarioFromLobby(-1);
     CloseScreen();
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MyGuiScreenScenarioMpClient.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: BuildControls

        public void BuildControls()
        {
            MyGuiControlParent parent = new MyGuiControlParent(size: new Vector2(Size.Value.X - 0.05f, Size.Value.Y-0.1f));
            MyGuiControlScrollablePanel scrollPanel = new MyGuiControlScrollablePanel(parent);
            scrollPanel.ScrollbarVEnabled = true;
            scrollPanel.Size = new Vector2(Size.Value.X - 0.05f, 0.8f);
            Controls.Add(scrollPanel);

            Vector2 buttonSize = MyGuiConstants.BACK_BUTTON_SIZE;
            Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f);

            //AddCaption(MySpaceTexts.ScreenCaptionAdvancedSettings);
            // Ok/Cancel
            m_okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
            m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: CancelButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
            Controls.Add(m_okButton);
            Controls.Add(m_cancelButton);

            float buttonsOffset = 0.055f;

            var canJoinrunningLabel = MakeLabel(MySpaceTexts.ScenarioSettings_CanJoinRunning);
            m_canJoinRunning = new MyGuiControlCheckbox();
            m_canJoinRunning.Position = new Vector2(-scrollPanel.Size.X / 2 + buttonsOffset, -scrollPanel.Size.Y / 2 + buttonsOffset);
            canJoinrunningLabel.Position = new Vector2(m_canJoinRunning.Position.X + buttonsOffset, m_canJoinRunning.Position.Y);
            m_canJoinRunning.IsChecked = MySession.Static.Settings.CanJoinRunning;
            parent.Controls.Add(m_canJoinRunning);
            parent.Controls.Add(canJoinrunningLabel);

            CloseButtonEnabled = true;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGuiScreenAdvancedScenarioSettings.cs

示例6: RecreateControls

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

            AddCaption(MySpaceTexts.ScreenCaptionNewWorld);

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.147f);
            if (MyPerGameSettings.EnableScenarios)
            {
                menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.11f);
            }

            Vector2 buttonDelta = new Vector2(0.15f, 0);

            //MyStringId? otherButtonsForbidden = null;
            //MyStringId newGameText = MySpaceTexts.StartDemo;
            int buttonPositionCounter = 0;

            //  Quickstart
            var quickstartButton = new MyGuiControlButton(
                position: menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                text: MyTexts.Get(MySpaceTexts.ScreenNewWorldButtonQuickstart),
                toolTip: MyTexts.GetString(MySpaceTexts.ToolTipNewWorldQuickstart),
                onButtonClick: OnQuickstartClick);

            //  Custom Game
            var customGameButton = new MyGuiControlButton(
                position: menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                text: MyTexts.Get(MySpaceTexts.ScreenNewWorldButtonCustomWorld),
                toolTip: MyTexts.GetString(MySpaceTexts.ToolTipNewWorldCustomWorld),
                onButtonClick: OnCustomGameClick);          
            Controls.Add(quickstartButton);
            Controls.Add(customGameButton);

            if (MyPerGameSettings.EnableScenarios)
            {
                //  scenarios
                var scenarioButton = new MyGuiControlButton(
                    position: menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                    text: MyTexts.Get(MySpaceTexts.ScreenCaptionScenario),
                    //toolTip: MyTexts.GetString(MySpaceTexts.ToolTipNewWorldCustomWorld),
                    onButtonClick: OnScenarioGameClick);

                Controls.Add(scenarioButton);
            }

            if (MyFakes.ENABLE_BATTLE_SYSTEM)
            {
                var battleButton = new MyGuiControlButton(
                    position: menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                    text: MyTexts.Get(MySpaceTexts.ScreenButtonBattle),
                    //toolTip: MyTexts.GetString(MySpaceTexts.ToolTipNewWorldCustomWorld),
                    onButtonClick: OnBattleClick);

                Controls.Add(battleButton);

            }

            CloseButtonEnabled = true;
        }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:60,代码来源:MyGuiScreenStartSandbox.cs

示例7: OKButton_Clicked

        private void OKButton_Clicked(MyGuiControlButton sender)
        {
            bool itemSet = false;
            for (int i = 0; i < MyToolbarComponent.CurrentToolbar.SlotCount; ++i)
            {
                var item = MyToolbarComponent.CurrentToolbar.GetSlotItem(i);
                if (item != null && item.Equals(Item))
                {
                    MyToolbarComponent.CurrentToolbar.SetItemAtIndex(i, Item);
                    if (item.WantsToBeActivated)
                        MyToolbarComponent.CurrentToolbar.ActivateItemAtSlot(i);
                    itemSet = true;
                    break;
                }
            }

            if (itemSet)
                return;

            for (int i = 0; i < MyToolbarComponent.CurrentToolbar.SlotCount; ++i)
            {
                if (MyToolbarComponent.CurrentToolbar.GetSlotItem(i) == null)
                { 
                    MyToolbarComponent.CurrentToolbar.SetItemAtIndex(i, Item);
                    if (Item.WantsToBeActivated)
                        MyToolbarComponent.CurrentToolbar.ActivateItemAtSlot(i);
                    break;
                }
            }
        }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGuiControlVoxelHandSettings.cs

示例8: OnDx9VideoClick

        public void OnDx9VideoClick(MyGuiControlButton sender)
        {
            MySandboxGame.Log.WriteLine("MyGuiScreenOptions.OnVideoClick START");

            MyGuiSandbox.AddScreen(new MyGuiScreenOptionsVideoSpace());

            MySandboxGame.Log.WriteLine("MyGuiScreenOptions.OnVideoClick END");
        }
开发者ID:mittens,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGuiScreenOptionsSpace.cs

示例9: OnOkButtonClick

 protected override void OnOkButtonClick(MyGuiControlButton sender)
 {
     int? seconds = StrToInt(m_textboxTime.Text);
     Debug.Assert(seconds != null, "incorrect value of time");
     if (seconds != null)
         ((MyTriggerNoSpawn)m_trigger).LimitInSeconds = (int)seconds;
     base.OnOkButtonClick(sender);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGuiScreenTriggerNoSpawn.cs

示例10: OnOkButtonClick

 protected override void OnOkButtonClick(MyGuiControlButton sender)
 {
     int? lives = StrToInt(m_lives.Text);
     Debug.Assert(lives!=null,"incorrect value of lives");
     if (lives != null)
         ((MyTriggerLives)m_trigger).LivesLeft = (int)lives;
     base.OnOkButtonClick(sender);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGuiScreenTriggerLives.cs

示例11: OnOkButtonClick

 protected override void OnOkButtonClick(MyGuiControlButton sender)
 {
     int? minutes = StrToInt(m_textboxTime.Text);
     Debug.Assert(minutes!=null,"incorrect value of time");
     if (minutes != null)
         ((MyTriggerTimeLimit)m_trigger).LimitInMinutes = (int)minutes;
     base.OnOkButtonClick(sender);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:8,代码来源:MyGuiScreenTriggerTimeLimit.cs

示例12: OnClick_SetMinBuildLevel

 private void OnClick_SetMinBuildLevel(MyGuiControlButton button)
 {
     var ship = GetTargetShip();
     foreach (var block in ship.GetBlocks())
     {
         block.SetToConstructionSite();
         block.UpdateVisual();
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyGuiScreenDebugShipLargeProperties.cs

示例13: OnClick_UpgradeBuildLevel

 private void OnClick_UpgradeBuildLevel(MyGuiControlButton button)
 {
     var ship = GetTargetShip();
     foreach (var block in ship.GetBlocks())
     {
         block.UpgradeBuildLevel();
         block.UpdateVisual();
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyGuiScreenDebugShipLargeProperties.cs

示例14: OnOkButtonClick

 protected override void OnOkButtonClick(MyGuiControlButton sender)
 {
     double? radius = StrToDouble(m_radius.Text);
     if (radius!=null)
         ((MyTriggerPositionReached)m_trigger).Radius = (double)radius;
     if (m_coordsChanged)
         ((MyTriggerPositionReached)m_trigger).TargetPos = m_coords;
     base.OnOkButtonClick(sender);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:9,代码来源:MyGuiScreenTriggerPositionReached.cs

示例15: OnStartClicked

        protected override void OnStartClicked(MyGuiControlButton sender)
        {
            Debug.Assert(Sync.IsServer);

            MySession.Static.Settings.CanJoinRunning = false;
            if (!MySession.Static.Settings.CanJoinRunning)
                MyMultiplayer.Static.SetLobbyType(SteamSDK.LobbyTypeEnum.Private);
            MyScenarioSystem.Static.PrepareForStart();
            CloseScreen();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:10,代码来源:MyGuiScreenScenarioMpServer.cs


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