当前位置: 首页>>代码示例>>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;未经允许,请勿转载。