當前位置: 首頁>>代碼示例>>C#>>正文


C# Core.MyGuiControlButton類代碼示例

本文整理匯總了C#中MinerWars.AppCode.Game.GUI.Core.MyGuiControlButton的典型用法代碼示例。如果您正苦於以下問題:C# MyGuiControlButton類的具體用法?C# MyGuiControlButton怎麽用?C# MyGuiControlButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MyGuiControlButton類屬於MinerWars.AppCode.Game.GUI.Core命名空間,在下文中一共展示了MyGuiControlButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnOkClick

        protected override void OnOkClick(MyGuiControlButton sender)
        {
            MyMwcSectorTypeEnum sectorType = string.IsNullOrEmpty(m_playerName.Text) ? MyMwcSectorTypeEnum.STORY : MyMwcSectorTypeEnum.SANDBOX;
            bool namedSector = !string.IsNullOrEmpty(m_sector_name.Text);
            MyMwcSectorIdentifier sectorIdentifier;
            if (namedSector)
            {
                sectorIdentifier = new MyMwcSectorIdentifier(sectorType, null, new MyMwcVector3Int(0, 0, 0), m_sector_name.Text);
            }
            else
            {
                int x, y, z;
                if (!int.TryParse(m_sectorIdentifierX.Text, out x) ||
                    !int.TryParse(m_sectorIdentifierY.Text, out y) ||
                    !int.TryParse(m_sectorIdentifierZ.Text, out z))
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, 
                        MyTextsWrapperEnum.BadSectorIdentifierInput, MyTextsWrapperEnum.MessageBoxCaptionError,
                        MyTextsWrapperEnum.Ok, null));
                    return;
                }

                sectorIdentifier = new MyMwcSectorIdentifier(sectorType, null, new MyMwcVector3Int(x, y, z), null);
            }

            // This screen will be closed on successfull load from progress screen
            MyGuiManager.AddScreen(new MyGuiScreenEditorLoadSectorObjectsProgress(
                this, MyTextsWrapperEnum.LoadingPleaseWait, m_playerName.Text, sectorIdentifier));
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:29,代碼來源:MyGuiScreenEditorCopyToolSelectSector.cs

示例2: LoadControls

        void LoadControls()
        {
            // Background texture unloaded in base
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProgressBackground", flags: TextureFlags.IgnoreQuality);
            m_wheelTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\Loading", flags: TextureFlags.IgnoreQuality);

            m_size = new Vector2(598 / 1600f, 368 / 1200f);
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.0f, -0.05f), null, m_progressText, MyGuiConstants.LABEL_TEXT_COLOR,
                MyGuiConstants.LABEL_TEXT_SCALE * 0.86f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            float deltaX = (m_enableCancel) ? 0.08f : 0.0f;
            float deltaY = 0.035f;

            Controls.Add(new MyGuiControlRotatingWheel(this, new Vector2(-deltaX, deltaY), MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_wheelTexture));

            //  Sometimes we don't want to allow user to cancel pending progress screen
            if (m_enableCancel)
            {
                var cancelButton = new MyGuiControlButton(this, new Vector2(deltaX, deltaY), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                        Vector4.One,
                        MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Cancel,
                        MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnCancelClick,
                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(cancelButton);
            }
            m_controlsCreated = true;
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:28,代碼來源:MyGuiScreenProgressBase.cs

示例3: LoadControls

        protected override void LoadControls()
        {
            Vector2 position = GetNextControlPosition() + new Vector2(0.38f, 0);

            m_onButton = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.On, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_onButton);
            m_onButton.DrawRedTextureWhenDisabled = false;
            m_onButton.UseSwitchMode = true;

            position.X -= 0.04f;

            m_offButon = new MyGuiControlButton(this, position, new Vector2(0.051f, 0.061f), Vector4.One, MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\ButtonOnOff", flags: TextureFlags.IgnoreQuality), null, null,
                MyTextsWrapperEnum.Off, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE_SMALLER,
                MyGuiControlButtonTextAlignment.CENTERED, OnOnOffClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true, MyGuiControlHighlightType.WHEN_ACTIVE);
            Controls.Add(m_offButon);
            m_offButon.DrawRedTextureWhenDisabled = false;
            m_offButon.UseSwitchMode = true;

            position.X -= 0.11f;

            m_unpoweredLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.Unpowered, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            m_remoteControlledLabel = new MyGuiControlLabel(this, position, null, MyTextsWrapperEnum.MP_RemoteControlled, MyGuiConstants.LABEL_TEXT_COLOR, 1.5f, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiManager.GetFontMinerWarsBlue());
            Controls.Add(m_unpoweredLabel);
            Controls.Add(m_remoteControlledLabel);

            m_isPrefabElectrified = !Prefab.IsElectrified();
            UpdateVisibility();
            UpdateEnabledState();
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:31,代碼來源:MyGuiControlPrefabUse.cs

示例4: OnOkClick

 protected override void OnOkClick(MyGuiControlButton sender)
 {
     base.OnOkClick(sender);
     
     MyGuiScreenGamePlay.Static.SetSectorName(m_nameTextbox.Text);
     MyEditor.Static.PerformContextMenuAction(MyGuiContextMenuItemActionType.SAVE_SECTOR);            
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:7,代碼來源:MyGuiScreenSaveSector.cs

示例5: LoadContent

        public override void LoadContent()
        {
            base.LoadContent();

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.145f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;


            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyEasy, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnEasyClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyNormal, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnNormalClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.DifficultyHard, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnHardClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var exitButton = new MyGuiControlButton(this, new Vector2(0, 0.1460f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(exitButton);


            SetControlIndex(2);
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:25,代碼來源:MyGuiScreenChooseDifficulty.cs

示例6: RecreateControls

        public override void RecreateControls(bool contructor)
        {
            Controls.Clear();

            AddCaption(MyTextsWrapperEnum.Options, new Vector2(0, 0.005f));

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            int index = 0;

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Game, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Video, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnVideoClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, m_showVideoOption ? (MyTextsWrapperEnum?)null : MyTextsWrapperEnum.FeatureAccessibleOnlyFromMainMenu));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Audio, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAudioClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Controls, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnControlsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            var backButton = new MyGuiControlButton(this, new Vector2(0, 0.178f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Back,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, menuButtonTextAlignement, OnBackClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(backButton);

        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:30,代碼來源:MyGuiScreenOptions.cs

示例7: OnCancelClick

 protected override void OnCancelClick(MyGuiControlButton sender)
 {
     if (m_waypointPath != null)
         if (m_newlyAdded)
             MyWayPointGraph.RemovePath(MyWayPointGraph.SelectedPath);
     CloseScreen();
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:7,代碼來源:MyGuiScreenEditorWayPointPath.cs

示例8: OnOkClick

 public override void OnOkClick(MyGuiControlButton sender)
 {
     base.OnOkClick(sender);
     foreach (var v in m_waypoints)
         v.IsSecret = m_secretCheckbox.Checked;
     MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:7,代碼來源:MyGuiScreenEditorWaypoint.cs

示例9: OnAcquireControlClick

        void OnAcquireControlClick(MyGuiControlButton sender)
        {
            Debug.Assert(PrefabLargeWeapon.EntityId.HasValue, "EntityID cannot be null");

            if (MyMultiplayerGameplay.IsRunning)
            {
                MyMultiplayerGameplay.Static.LockReponse = (e, success) =>
                {
                    MyMultiplayerGameplay.Static.LockReponse = null;
                    if (PrefabLargeWeapon != e)
                    {
                        Debug.Fail("Something went wrong, locked different entity");
                        MyMultiplayerGameplay.Static.Lock(e, false);
                        return;
                    }

                    if (success)
                    {
                        ParentScreen.Closed += ParentScreenClosed;

                        MyGuiScreenGamePlay.Static.TakeControlOfLargeWeapon(PrefabLargeWeapon);
                        HideHUBScreen();
                    }
                };
                MyMultiplayerGameplay.Static.Lock(PrefabLargeWeapon, true);
            }
            else
            {
                MyGuiScreenGamePlay.Static.TakeControlOfLargeWeapon(PrefabLargeWeapon);
                HideHUBScreen();
            }
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:32,代碼來源:MyGuiControlPrefabLargeWeaponUse.cs

示例10: OnVideoClick

        public void OnVideoClick(MyGuiControlButton sender)
        {
            MyMwcLog.WriteLine("MyGuiScreenOptions.OnVideoClick START");

            MyGuiManager.AddScreen(new MyGuiScreenOptionsVideo());

            MyMwcLog.WriteLine("MyGuiScreenOptions.OnVideoClick END");
        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:8,代碼來源:MyGuiScreenOptions.cs

示例11: OnDeleteClick

 private void OnDeleteClick(MyGuiControlButton sender) 
 {
     int? selectedPrefabId = m_connectedPrefabIdsListbox.GetSelectedItemKey();
     if (selectedPrefabId != null) 
     {
         PrefabSecurityControlHUB.DisconnetEntity((uint)selectedPrefabId.Value);
         m_connectedPrefabIdsListbox.RemoveItem(selectedPrefabId.Value);
     }
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:9,代碼來源:MyGuiScreenEditorSecurityControlHUB.cs

示例12: OnOkClick

        public override void OnOkClick(MyGuiControlButton sender)
        {
            base.OnOkClick(sender);

            PrefabContainer.AlarmOn = m_alarmOn.Checked;
            PrefabContainer.Activate(m_activatedCheckbox.Checked, false);

            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);

        }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:10,代碼來源:MyGuiScreenEditorPrefabContainer.cs

示例13: OnAllowEnter

 public void OnAllowEnter(MyGuiControlButton sender)
 {
     MyMultiplayerGameplay.Static.AllowEnter(ref m_request.Message);
     if (m_chkRememberSetting.Checked)
     {
         MyMultiplayerGameplay.Static.JoinMode = MyJoinMode.Open;
         MyMultiplayerGameplay.Static.UpdateGameInfo();
     }
     CloseScreen();
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:10,代碼來源:MyGuiScreenMultiplayerEnterGameRequest.cs

示例14: OnSelectAllNone

 void OnSelectAllNone(MyGuiControlButton sender)
 {
     if (m_objectList.GetSelectedItems().Count > 0)
     {
         m_objectList.DeselectAll();
     }
     else
     {
         m_objectList.SelectAll();
     }
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:11,代碼來源:MyGuiScreenEditorCopyTool.cs

示例15: OnOkClick

 protected override void OnOkClick(MyGuiControlButton sender)
 {
     if (!string.IsNullOrEmpty(m_nameTextbox.Text) && m_myGuiScreenEditorGroups.ChangeGroupName(m_group, m_nameTextbox.Text))
     {
         base.OnOkClick(sender);
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.EditorGroupsNameUsedText, MyTextsWrapperEnum.EditorGroupsNameUsedCaption, MyTextsWrapperEnum.Ok, null));
     }
 }
開發者ID:Bunni,項目名稱:Miner-Wars-2081,代碼行數:11,代碼來源:MyGuiScreenEditorRenameGroup.cs


注:本文中的MinerWars.AppCode.Game.GUI.Core.MyGuiControlButton類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。