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);
        }
예제 #2
0
        public MyGuiScreenGameChat(bool sendToTeam)
            : base(Vector2.Zero, null, null)
        {
            m_closeOnEsc           = true;
            m_enableBackgroundFade = true;
            m_teamOnly             = sendToTeam;

            m_positionOffset = new Vector2(MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate_FULLSCREEN(new Vector2(0, 0)).X - 920 / 1920f / 2 - 0.04f, -0.2f);

            m_panelTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ChatBackground", flags: TextureFlags.IgnoreQuality);

            MyGuiControlPanel panel = new MyGuiControlPanel(this, new Vector2(0.5f, 0.85f) + m_positionOffset, new Vector2(920 / 1920f, 388 / 1200f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, m_panelTexture, null, null, null, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);

            Controls.Add(panel);

            Vector2 menuPositionOrigin = new Vector2(0.423f, 0.939f) + m_positionOffset;
            Vector2 delta = new Vector2(0.17f, 0f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            m_textbox = new MyGuiControlTextbox(this, menuPositionOrigin, MyGuiControlPreDefinedSize.MEDIUM, "", MyGuiConstants.CHAT_WINDOW_MAX_MESSAGE_LENGTH, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.75f, MyGuiControlTextboxType.NORMAL, true, false);
            Controls.Add(m_textbox);

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + delta,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE * new Vector2(0.41f, 0.78f), MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\ButtonChatEnter", flags: TextureFlags.IgnoreQuality), null, null,
                                                sendToTeam ? MyTextsWrapperEnum.SendToTeam : MyTextsWrapperEnum.SendToAll, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE * 0.65f,
                                                menuButtonTextAlignement, OnSendClick, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
                                                true, true, MyGuiControlHighlightType.WHEN_ACTIVE));
        }
        public MyGuiScreenMultiplayerEnterGameRequest(MyGuiScreenGamePlay.MyJoinGameRequest request)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 600 / 1200f), false, MyGuiManager.GetSandboxBackgoround())
        {
            m_enableBackgroundFade = true;
            m_backgroundFadeColor  = new Vector4(0.0f, 0.0f, 0.0f, 0.5f);

            m_request = request;
            AddCaption(MyTextsWrapperEnum.JoinRequestTitle);

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

            Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, null, new StringBuilder(MyTextsWrapper.GetFormatString(MyTextsWrapperEnum.JoinRequest, request.Message.PlayerInfo.DisplayName)), MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyGuiConstants.DEFAULT_CONTROL_FONT));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.AllowEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnAllowEnter, 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.DenyEnter, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnDenyEnter, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            MyGuiControlLabel lblRememberSetting = new MyGuiControlLabel(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA - new Vector2(0.03f, 0), null, MyTextsWrapperEnum.Remember, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);

            Controls.Add(lblRememberSetting);

            m_chkRememberSetting = new MyGuiControlCheckbox(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA + new Vector2(0.05f, 0), false, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, lblRememberSetting);
            Controls.Add(m_chkRememberSetting);
        }
예제 #4
0
        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);
        }
예제 #5
0
 //  Image constructor
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture,
                           MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment,
                           OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType)
     : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, null, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null /*, null, null*/)
 {
     Text            = MyTextsWrapper.Get(textEnum);
     m_textColor     = textColor;
     m_textAlignment = textAlignment;
     m_textScale     = textScale;
 }
예제 #6
0
 //  Text constructor with delegate for indexed onButtonClick
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, StringBuilder text,
                           Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignement, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, StringBuilder tooltip, bool implementedFeature)
     : this(parent, position, size, backgroundColor, onIndexedButtonClick, buttonIndex, canHandleKeyboardInput, align, tooltip, implementedFeature, true)
 {
     m_textColor     = textColor;
     Text            = text;
     m_textScale     = textScale;
     m_textAlignment = textAlignement;
 }
예제 #7
0
 //  Text constructor
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, StringBuilder text, StringBuilder tooltip,
                           Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, bool implementedFeature)
     : this(parent, position, size, backgroundColor, null, null, null, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, true, MyGuiControlHighlightType.WHEN_ACTIVE, null, null /*, null, null*/)
 {
     m_textColor     = textColor;
     Text            = text;
     m_textScale     = textScale;
     m_textAlignment = textAlignment;
 }
        public MyGuiScreenHostGame(MyGuiScreenBase closeAfterSuccessfulEnter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 695 / 1200f), false, MyGuiManager.GetSandboxBackgoround())
        {
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_enableBackgroundFade      = true;
            AddCaption(MyTextsWrapperEnum.HostGame, new Vector2(0, 0.005f));

            Debug.Assert(m_size != null, "m_size != null");
            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.146f);
            const MyGuiControlButtonTextAlignment menuButtonTextAlignement = MyGuiControlButtonTextAlignment.CENTERED;

            MyTextsWrapperEnum?officialSectorsForbidden = null;
            MyTextsWrapperEnum?buttonsForbidden         = null;
            MyTextsWrapperEnum?friendsSectorsForbidden  = null;

            if (MyClientServer.LoggedPlayer != null)
            {
                if ((MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanSave() == false))
                {
                    officialSectorsForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                    buttonsForbidden         = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                    friendsSectorsForbidden  = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                }
                else if (MyClientServer.LoggedPlayer.IsDemoUser())
                {
                    friendsSectorsForbidden = MyTextsWrapperEnum.NotAvailableInDemoMode;
                }
            }

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.SandboxSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnSandboxSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, officialSectorsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.YourSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnMySectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, buttonsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.FriendsSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnFriendsSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, friendsSectorsForbidden));

            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);
        }
예제 #9
0
        public MyGuiScreenProfile()
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f / 1600f, 850 / 1200f))
        {
            m_enableBackgroundFade = true;
            bool displayLogoutButton = !(MyGuiScreenGamePlay.Static != null && (MyGuiScreenGamePlay.Static.IsGameActive() || MyGuiScreenGamePlay.Static.IsEditorActive()));

            displayLogoutButton = displayLogoutButton && !MySteam.IsActive && (MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetUserId() != MyPlayerLocal.OFFLINE_MODE_USERID);

            m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ProfileBackground", flags: TextureFlags.IgnoreQuality);

            if (displayLogoutButton)
            {
                m_size += new Vector2(0, MyGuiConstants.BACK_BUTTON_SIZE.Y);
            }

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

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

            float positionMultiplierY = 0;

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

            if (displayLogoutButton)
            {
                //  Don't display LOGOUT button while player is in active game - because I don't know what to do after logout in this case and it's not needed there
                Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + positionMultiplierY * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                    MyTextsWrapperEnum.Logout, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnLogoutClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
                positionMultiplierY++;
            }

            var backButton = new MyGuiControlButton(this, new Vector2(0, 0.2695f), 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);
        }
예제 #10
0
        public override void LoadContent()
        {
            base.LoadContent();

            Vector2 menuPositionOrigin = new Vector2(0.0f, -m_size.Value.Y / 2.0f + 0.125f);
            Vector2 buttonDelta        = new Vector2(0.1f, 0);
            const 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.PlayStory, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPlayStoryClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyFakes.PLAY_STORY_BUTTON_IMPLEMENTED));

            // MMO is now disabled
            //Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
            //    MyTextsWrapperEnum.PlayMMO, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPlayMMOClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyFakes.PLAY_MMO_BUTTON_IMPLEMENTED));
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + index++ *MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.PlaySandbox, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnPlaySandboxClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, MyFakes.PLAY_SANDBOX_BUTTON_IMPLEMENTED));

            Controls.Add(new MyGuiControlButton(this, new Vector2(0.00f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
        }
예제 #11
0
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture,
                           MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment,
                           OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, bool useBackground, bool drawCrossTextureWhenDisabled = true)
     : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, textEnum, textColor, textScale, textAlignment, onButtonClick,
            canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, MyGuiControlHighlightType.WHEN_ACTIVE)
 {
     m_useBackground = useBackground;
 }
예제 #12
0
 // with delegate for indexed onButtonClick
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
     Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
     MyGuiDrawAlignEnum align, bool implementedFeature)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), textColor, textScale, onIndexedButtonClick, buttonIndex,
     textAlignment, canHandleKeyboardInput, align, null, implementedFeature)
 {
 }
        public MyGuiScreenJoinGame(MyGuiScreenBase closeAfterSuccessfulEnter, MyGameTypes gameTypeFilter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f))
        {
            m_size = new Vector2(0.95f, 0.85f);
            m_serverDisconnectedHandler = new ConnectionHandler(Static_ServerDisconnected);

            m_gameTypeFilter    = gameTypeFilter;
            m_backgroundTexture = MyTextureManager.GetTexture <MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);

            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_enableBackgroundFade      = true;
            m_games = new List <MyGameExtendedInfo>();
            AddCaption(MyTextsWrapperEnum.JoinGame, new Vector2(0, 0.0075f));

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

            Controls.Add(new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.SearchGameToJoin, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER));

            m_searchTextbox              = new MyGuiControlTextbox(this, menuPositionOrigin + buttonDelta, MyGuiControlPreDefinedSize.LARGE, "", 40, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            m_searchTextbox.TextChanged += OnSearchTextChanged;
            Controls.Add(m_searchTextbox);

            menuPositionOrigin += new Vector2(0.395f, 0);

            var refreshButton = new MyGuiControlButton(
                this,
                menuPositionOrigin + buttonDelta,
                MyGuiConstants.BACK_BUTTON_SIZE,
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyTextsWrapperEnum.Refresh,
                MyGuiConstants.BUTTON_TEXT_COLOR,
                MyGuiConstants.BUTTON_TEXT_SCALE,
                OnRefreshButtonClick,
                menuButtonTextAlignement,
                true,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true);

            Controls.Add(refreshButton);

            menuPositionOrigin.Y += 0.052f;
            menuPositionOrigin.X  = -0.33f;

            var storyLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Story, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(storyLabel);

            menuPositionOrigin.X = -0.35f;
            m_storyCheck         = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null);
            m_storyCheck.OnCheck = CheckChanged;
            Controls.Add(m_storyCheck);

            menuPositionOrigin.X = -0.2f;
            var deathLabel = new MyGuiControlLabel(this, menuPositionOrigin, null, MyTextsWrapperEnum.Deathmatch, Vector4.One, 1.0f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);

            Controls.Add(deathLabel);

            menuPositionOrigin.X = -0.22f;
            m_deathCheck         = new MyGuiControlCheckbox(this, menuPositionOrigin, true, Vector4.One, null);
            m_deathCheck.OnCheck = CheckChanged;
            Controls.Add(m_deathCheck);

            //var storyButton = new MyGuiControlButton(this, menuPositionOrigin, null, Vector4.One, MyTextsWrapperEnum.Story, Vector4.One, 1.0f,

            menuPositionOrigin.Y += 0.25f;
            menuPositionOrigin.X  = 0;
            m_gameList            = new MyGuiControlListbox(this,
                                                            menuPositionOrigin,
                                                            new Vector2(0.22f, 0.04f),
                                                            MyGuiConstants.LISTBOX_BACKGROUND_COLOR,
                                                            MyTextsWrapper.Get(MyTextsWrapperEnum.JoinGame),
                                                            MyGuiConstants.LABEL_TEXT_SCALE,
                                                            HeaderCount, 10, HeaderCount,
                                                            true, true, false,
                                                            null, null, MyGuiManager.GetScrollbarSlider(), MyGuiManager.GetHorizontalScrollbarSlider(), 2, 1, MyGuiConstants.LISTBOX_BACKGROUND_COLOR_BLUE, 0f, 0f, 0f, 0f, 0, 0, -0.01f, -0.01f, -0.02f, 0.02f);
            m_gameList.ItemSelect       += OnGamesItemSelect;
            m_gameList.DisplayHighlight  = true;
            m_gameList.MultipleSelection = true;
            m_gameList.ItemDoubleClick  += GameListOnItemDoubleClick;
            m_gameList.HighlightHeadline = true;
            m_gameList.EnableAllRowHighlightWhileMouseOver(true, true);
            m_gameList.SetCustomCollumnsWidths(new List <float>()
            {
                0.15f, 0.30f, 0.15f, 0.10f
            });
            Controls.Add(m_gameList);

            buttonDelta = new Vector2(0.1f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f - 0.06f);
            Controls.Add(new MyGuiControlButton(this, new Vector2(-buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                                                MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Ok, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnOkClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
            Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X, buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE,
                                                MyGuiConstants.BUTTON_BACKGROUND_COLOR, MyTextsWrapperEnum.Cancel, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnCancelClick, MyGuiControlButtonTextAlignment.CENTERED, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));

            AddHeaders();
        }
예제 #14
0
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
                           Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum?accessForbiddenReason)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment,
            canHandleKeyboardInput, align, implementedFeature)
 {
     m_accessForbiddenReason           = accessForbiddenReason;
     m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null;
 }
예제 #15
0
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
     Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
     MyGuiDrawAlignEnum align, bool implementedFeature, MyTextsWrapperEnum? accessForbiddenReason)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), null, textColor, textScale, onButtonClick, textAlignment,
     canHandleKeyboardInput, align, implementedFeature)
 {
     m_accessForbiddenReason = accessForbiddenReason;
     m_canHandleKeyboardActiveControl &= m_accessForbiddenReason == null;
 }
예제 #16
0
        protected MyGuiControlButton AddButton(StringBuilder text, MyGuiControlButton.OnButtonClick onClick, List <MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4?textColor = null, Vector2?size = null)
        {
            MyGuiControlButton button = new MyGuiControlButton(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), size ?? new Vector2(0.20f, 0.03f), Vector4.One, text, null, textColor ?? m_defaultColor, MyGuiConstants.LABEL_TEXT_SCALE * MyGuiConstants.DEBUG_BUTTON_TEXT_SCALE * m_scale, onClick, textAlign, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true);

            Controls.Add(button);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
            {
                controlGroup.Add(button);
            }

            return(button);
        }
예제 #17
0
 //  Image constructor
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture, 
     MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment,
     OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, MyGuiControlHighlightType highlightType)
     : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, onButtonClick, canHandleKeyboardInput, align, null, implementedFeature, canHandleKeyboardActiveControl, highlightType, null, null/*, null, null*/)
 {
     Text = MyTextsWrapper.Get(textEnum);
     m_textColor = textColor;
     m_textAlignment = textAlignment;
     m_textScale = textScale;
 }        
예제 #18
0
        protected MyGuiControlCombobox AddCombo(List <MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4?textColor = null, Vector2?size = null)
        {
            MyGuiControlCombobox combo = new MyGuiControlCombobox(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), MyGuiControlPreDefinedSize.MEDIUM, Vector4.One, 0.7f);

            Controls.Add(combo);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
            {
                controlGroup.Add(combo);
            }

            return(combo);
        }
예제 #19
0
        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);
        }
예제 #20
0
        protected MyGuiControlButton AddButton(StringBuilder text, MyGuiControlButton.OnButtonClick onClick, List<MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4? textColor = null, Vector2? size = null)
        {
            MyGuiControlButton button = new MyGuiControlButton(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), size ?? new Vector2(0.20f, 0.03f), Vector4.One, text, null, textColor ?? m_defaultColor, MyGuiConstants.LABEL_TEXT_SCALE * MyGuiConstants.DEBUG_BUTTON_TEXT_SCALE * m_scale, onClick, textAlign, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true);

            Controls.Add(button);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
                controlGroup.Add(button);

            return button;
        }
예제 #21
0
        //  Buttons must be created here because in this screen's constructor we might have not been logged in
        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;

            MyTextsWrapperEnum?yourSectorsButtonForbidden   = null;
            MyTextsWrapperEnum?storySectorsButtonsForbidden = null;
            MyTextsWrapperEnum?mmoSectorsButtonsForbidden   = null;

            if (MyClientServer.LoggedPlayer != null)
            {
                //if (true/*(MyClientServer.LoggedPlayer.GetCanAccessDemo() == false) && (MyClientServer.LoggedPlayer.GetCanAccessStory() == false)*/)
                //{
                //    yourSectorsButtonForbidden = MyTextsWrapperEnum.NotAccessRightsToTestBuild;
                //}

                if (!MyClientServer.LoggedPlayer.GetCanAccessEditorForStory())
                {
                    storySectorsButtonsForbidden = MyTextsWrapperEnum.AvailableOnlyForAdministrators;
                }

                if (true /*MyClientServer.LoggedPlayer.GetCanAccessEditorForMMO() == false*/)
                {
                    mmoSectorsButtonsForbidden = MyTextsWrapperEnum.AvailableOnlyForAdministrators;
                }
            }

            //  Buttons My Sectors and Friends Sectors
            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.SandboxSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnSandboxSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, storySectorsButtonsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.YourSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnYourSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, yourSectorsButtonForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.StorySectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnStorySectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, storySectorsButtonsForbidden));

            Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA,
                                                MyGuiConstants.MAIN_MENU_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                                                MyTextsWrapperEnum.MmoSectors, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE,
                                                OnMmoSectorsClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                                                true, mmoSectorsButtonsForbidden));
            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);


            /*
             *
             * Controls.Add(new MyGuiControlButton(this, menuPositionOrigin + 3.5f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE, MyGuiConstants.BUTTON_BACKGROUND_COLOR,
             *  MyTextsWrapperEnum.Back, MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, OnBackClick, menuButtonTextAlignement, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true));
             * */
        }
예제 #22
0
 //  Text constructor
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, StringBuilder text, StringBuilder tooltip,
     Vector4 textColor, float textScale, OnButtonClick onButtonClick, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
     MyGuiDrawAlignEnum align, bool implementedFeature)
     : this(parent, position, size, backgroundColor, null, null, null, onButtonClick, canHandleKeyboardInput, align, tooltip, implementedFeature, true, MyGuiControlHighlightType.WHEN_ACTIVE, null, null/*, null, null*/)
 {
     m_textColor = textColor;
     Text = text;
     m_textScale = textScale;
     m_textAlignment = textAlignment;
 }
예제 #23
0
 //  Text constructor with delegate for indexed onButtonClick
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, StringBuilder text,
     Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignement, bool canHandleKeyboardInput,
     MyGuiDrawAlignEnum align, StringBuilder tooltip, bool implementedFeature)
     : this(parent, position, size, backgroundColor, onIndexedButtonClick, buttonIndex, canHandleKeyboardInput, align, tooltip, implementedFeature, true)
 {
     m_textColor = textColor;
     Text = text;
     m_textScale = textScale;
     m_textAlignment = textAlignement;
 }
예제 #24
0
        protected MyGuiControlCombobox AddCombo(List<MyGuiControlBase> controlGroup = null, MyGuiControlButtonTextAlignment textAlign = MyGuiControlButtonTextAlignment.CENTERED, Vector4? textColor = null, Vector2? size = null)
        {
            MyGuiControlCombobox combo = new MyGuiControlCombobox(this, new Vector2(m_buttonXOffset, m_currentPosition.Y), MyGuiControlPreDefinedSize.MEDIUM, Vector4.One, 0.7f);
            Controls.Add(combo);

            m_currentPosition.Y += 0.04f * m_scale;

            if (controlGroup != null)
                controlGroup.Add(combo);

            return combo;
        }
예제 #25
0
     public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor, MyTexture2D buttonTexture, MyTexture2D hoverButtonTexture, MyTexture2D pressedButtonTexture,
 MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiControlButtonTextAlignment textAlignment,
 OnButtonClick onButtonClick, bool canHandleKeyboardInput, MyGuiDrawAlignEnum align, bool implementedFeature, bool canHandleKeyboardActiveControl, bool useBackground, bool drawCrossTextureWhenDisabled = true)
         : this(parent, position, size, backgroundColor, buttonTexture, hoverButtonTexture, pressedButtonTexture, textEnum, textColor, textScale, textAlignment, onButtonClick,
         canHandleKeyboardInput, align, implementedFeature, canHandleKeyboardActiveControl, MyGuiControlHighlightType.WHEN_ACTIVE)
     {
         m_useBackground = useBackground;       
     }
예제 #26
0
        void AddProfileButton(MyGuiControlButtonTextAlignment menuButtonTextAlignment, Vector2 position)
        {
            //if (MySectorServiceClient.IsConnected && !(MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.LoggedUsingSteam))
            //position += new Vector2(0, -0.02f);

            MyTextsWrapperEnum text = MyTextsWrapperEnum.Profile;
            if (!MySteam.IsActive && !MyClientServer.IsMwAccount)
            {
                // When demo and in-game, don't show profile/login button
                if (!(MyGuiScreenGamePlay.Static == null || MyGuiScreenGamePlay.Static.IsMainMenuActive()))
                {
                    return;
                }

                text = MyTextsWrapperEnum.Login;
            }

            Controls.Add(
                new MyGuiControlButton(
                    this,
                    position,
                    MyGuiConstants.BACK_BUTTON_SIZE,
                    MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    text,
                    MyGuiConstants.BUTTON_TEXT_COLOR,
                    MyGuiConstants.BUTTON_TEXT_SCALE,
                    OnProfileClick,
                    menuButtonTextAlignment,
                    true,
                    MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                    MyFakes.PROFILE_BUTTON_IMPLEMENTED));
        }
예제 #27
0
 // with delegate for indexed onButtonClick
 public MyGuiControlButton(IMyGuiControlsParent parent, Vector2 position, Vector2?size, Vector4 backgroundColor, MyTextsWrapperEnum textEnum,
                           Vector4 textColor, float textScale, OnIndexedButtonClick onIndexedButtonClick, int buttonIndex, MyGuiControlButtonTextAlignment textAlignment, bool canHandleKeyboardInput,
                           MyGuiDrawAlignEnum align, bool implementedFeature)
     : this(parent, position, size, backgroundColor, MyTextsWrapper.Get(textEnum), textColor, textScale, onIndexedButtonClick, buttonIndex,
            textAlignment, canHandleKeyboardInput, align, null, implementedFeature)
 {
 }