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


C# MyGuiControlButton.GetPosition方法代碼示例

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


在下文中一共展示了MyGuiControlButton.GetPosition方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddControls

        private void AddControls()
        {
            Controls.Clear();

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

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

            MyTextsWrapperEnum? otherButtonsForbidden = null;
            MyTextsWrapperEnum? newGameForbidden = null;
            //MyTextsWrapperEnum newGameText = MyTextsWrapperEnum.StartDemo;
            int buttonPositionCounter = 0;

            if (MyClientServer.LoggedPlayer != null)
            {
                if ((MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanSave() == false))
                {
                    //Uncomment when other buttons functionality implemented
                    newGameForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode;
                    //otherButtonsForbidden = newGameForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                }
                else if (MyClientServer.LoggedPlayer.IsDemoUser())
                {
                    //Uncomment when other buttons functionality implemented
                    newGameForbidden = null;
                    otherButtonsForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode;
                }
                else if (MyClientServer.LoggedPlayer.GetCanSave() == true)
                {
                    //newGameText = MyTextsWrapperEnum.NewGame;
                    newGameForbidden = null;
                }

                ParallelTasks.Parallel.Start(CheckCheckpointAndChapter);
            }

            //  New Game / Start Demo
            var newGameButton = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.NewGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnNewGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, newGameForbidden);

            //  Continue last game
            m_continueLastGame = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.ContinueLastGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnLoadLastCheckpointClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                MyFakes.LOAD_LAST_CHECKPOINT_ENABLED, otherButtonsForbidden);
            m_continueLastGame.DrawRedTextureWhenDisabled = false;

            // Show load checkpoint first (it's unknown whether checkpoint exists
            var tmp = newGameButton.GetPosition();
            newGameButton.SetPosition(m_continueLastGame.GetPosition());
            m_continueLastGame.SetPosition(tmp);

            Controls.Add(m_continueLastGame);
            Controls.Add(newGameButton);

            m_continueLastGame.Enabled = false;

            //  Load Chapter
            m_loadChapter = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.LoadChapter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnLoadChapterClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                //MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory()
                true
                /* && !otherButtonsForbidden.HasValue*/, otherButtonsForbidden);
            m_loadChapter.DrawRedTextureWhenDisabled = false;
            Controls.Add(m_loadChapter);

            m_loadChapter.Enabled = false;

            //  Load Checkpoint
            //var loadCheckpoint = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
            //    MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
            //    MyTextsWrapperEnum.LoadCheckpoint, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
            //    OnLoadCheckpointClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            //    MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory()/* && !otherButtonsForbidden.HasValue*/, otherButtonsForbidden);
            //loadCheckpoint.DrawRedTextureWhenDisabled = false;
            //Controls.Add(loadCheckpoint);

            //  Join friend’s game - Coop mode
            var join = new MyGuiControlButton(this, menuPositionOrigin + buttonPositionCounter++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.JoinFriendGame, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                OnJoinFriendGameClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true, otherButtonsForbidden);
            join.DrawRedTextureWhenDisabled = false;
            Controls.Add(join);

            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,代碼行數:100,代碼來源:MyGuiScreenSelectStory.cs


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