public static MyGuiScreenStartSessionProgress CurrentScreen = null;    //  This is always filled with reference to actual instance of this scree. If there isn't, it's null.


        public MyGuiScreenStartSessionProgress(MyMwcStartSessionRequestTypeEnum sessionType,  MyTextsWrapperEnum progressText, MyMwcSectorIdentifier? sectorIdentifier, MyGameplayDifficultyEnum difficulty, string checkpointName, MyGuiScreenBase closeAfter) : 
            base(progressText, false)
        {
            // TODO: Not ready yet
            //Debug.Assert(sessionType != MyMwcStartSessionRequestTypeEnum.NEW_STORY && sessionType != MyMwcStartSessionRequestTypeEnum.LOAD_CHECKPOINT, "Invalid operation, call OndrejP");

            m_sectorIdentifier = sectorIdentifier;
            m_sessionType = sessionType;
            m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
            m_closeAfter = closeAfter;
            m_difficulty = difficulty;
            m_checkpointName = checkpointName;
            CurrentScreen = this;

            OnSuccessEnter = new Action<MyGuiScreenGamePlayType, MyMwcStartSessionRequestTypeEnum, MyMwcObjectBuilder_Checkpoint>((screenType, sessType, checkpoint) =>
            {
                var newGameplayScreen = new MyGuiScreenGamePlay(screenType, null, checkpoint.CurrentSector, checkpoint.SectorObjectBuilder.Version, sessType);
                var loadScreen = new MyGuiScreenLoading(newGameplayScreen, MyGuiScreenGamePlay.Static);

                if (sessType == MyMwcStartSessionRequestTypeEnum.NEW_STORY)
                    loadScreen.AddEnterSectorResponse(checkpoint, MyMissionID.EAC_SURVEY_SITE);
                else
                    loadScreen.AddEnterSectorResponse(checkpoint, null);

                MyGuiManager.AddScreen(loadScreen);
            });
        }
 public MyGuiScreenChoosePlay(MyGuiScreenBase closeAfterSuccessfulEnter)
     : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.25f, 0.35f))
 {
     m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
     m_enableBackgroundFade = true;
     AddCaption(MyTextsWrapperEnum.ChooseGameType, new Vector2(0, 0.005f));
 }
        public MyGuiScreenSelectStory(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;

            AddControls();
        }
        public MyGuiScreenSelectEditor(MyGuiScreenBase closeAfterSuccessfulEnter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(574f/1600f, 695/1200f), false, MyGuiManager.GetSelectEditorBackground())
        {
            m_enableBackgroundFade = true;
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;

            AddCaption(MyTextsWrapperEnum.Editor, new Vector2(0, 0.005f));
        }
        protected bool IsMouseOverOrKeyboardActive()
        {
            MyGuiScreenBase topMostParentScreen = GetTopMostParentScreen();

            return((topMostParentScreen is MyGuiScreenBase &&
                    ((MyGuiScreenBase)topMostParentScreen).GetState() == MyGuiScreenState.OPENED) &&
                   ((m_isMouseOver) || (m_hasKeyboardActiveControl && m_canHandleKeyboardActiveControl)));
        }
        public static MyGuiScreenSelectSandboxProgress CurrentScreen = null;    //  This is always filled with reference to actual instance of this scree. If there isn't, it's null.


        public MyGuiScreenSelectSandboxProgress(MyMwcSelectSectorRequestTypeEnum selectSandboxType, MyTextsWrapperEnum progressText, MyGuiScreenBase openAfterSuccessfulEnter, string findPlayerName, AddResponseDelegate responseHandler) : 
            base(progressText, false)
        {
            m_selectSandboxType = selectSandboxType;
            m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN;
            m_openAfterSuccessfulEnter = openAfterSuccessfulEnter;
            m_findPlayerName = findPlayerName;
            CurrentScreen = this;
            m_responseHandler = responseHandler;
        }
        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);

        }
        public MyGuiScreenEnterFriendSectorMap(MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText, MyGuiScreenBase closeAfterSuccesfullEnter)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(700f / 1600f, 700 / 1200f))
        {
            m_startSessionType = startSessionType;
            m_startSessionProgressText = startSessionProgressText;
            m_enableBackgroundFade = true;
            m_sectorIdentifiers = null;
            m_closeAfterSuccessfulEnter = closeAfterSuccesfullEnter;
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ConfigWheelBackground", flags: TextureFlags.IgnoreQuality);
            RecreateControls();

        }
        public MyGuiScreenRegisterProgress(string playerName, string password, string email, bool sendMeNewsletters, MyGuiScreenBase openAfterSuccesfullRegistration, MyGuiScreenBase parentScreen)
            : base(MyTextsWrapperEnum.RegistrationInProgressPleaseWait, true)
        {
            CurrentScreen = this;
            m_playerName = playerName;
            m_password = password;
            m_email = email;
            m_sendMeNewsletters = sendMeNewsletters;
            m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration;
            m_parentScreen = parentScreen;

            m_phase = MyGuiScreenRegisterProgressPhases.NOTHING;
            m_lastTimeMessage = MyMinerGame.TotalTimeInMilliseconds;
        }
        public MyGuiScreenChooseDifficulty(MyGuiScreenBase closeAfterSuccessfulEnter, string checkpointName)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR,  new Vector2(574f/1600f, 640/1200f), false, MyGuiManager.GetSelectEditorBackground())
        
        {
            m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter;
            m_checkpointName = checkpointName;

            m_enableBackgroundFade = true;
            m_canHaveFocus = true;
            m_closeOnEsc = true;
            m_isTopMostScreen = true;
            m_drawEvenWithoutFocus = true;

            AddCaption(MyTextsWrapperEnum.DifficultyCaption, new Vector2(0, 0.005f));
        }
        public MyGuiScreenUnloading(MyGuiScreenGamePlay screenToUnload, MyGuiScreenBase screenToShowAfter)
            : base(Vector2.Zero, null, null)
        {
            m_screenToUnload = screenToUnload;
            m_closeOnEsc = false;
            DrawMouseCursor = false;
            m_loadInDrawFinished = false;
            m_drawEvenWithoutFocus = true;
            m_currentQuoteOfTheDay = MyQuoteOfTheDay.GetRandomQuote();
            
            Vector2 loadingTextSize = MyGuiManager.GetNormalizedSize(MyGuiManager.GetFontMinerWarsBlue(),
                MyTextsWrapper.Get(MyTextsWrapperEnum.LoadingPleaseWait), MyGuiConstants.LOADING_PLEASE_WAIT_SCALE);
            m_rotatingWheelTexture = MyGuiManager.GetLoadingTexture();
            Controls.Add(new MyGuiControlRotatingWheel(this, MyGuiConstants.LOADING_PLEASE_WAIT_POSITION - new Vector2(0, 0.075f + loadingTextSize.Y),
                MyGuiConstants.ROTATING_WHEEL_COLOR, MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, m_rotatingWheelTexture));

            m_loadFinished = false;

            MyMinerGame.IsGameReady = false;
            m_screenToShowAfter = screenToShowAfter;
        }
示例#12
0
        void UpdateTransition()
        {
            if (m_state == MyGuiScreenState.OPENING || m_state == MyGuiScreenState.UNHIDING)
            {
                int deltaTime = MyMinerGame.TotalTimeInMilliseconds - m_lastTransitionTime;

                // Play opening sound
                if (m_state == MyGuiScreenState.OPENING && m_openingCueEnum != null && m_openingCue == null)
                {
                    m_openingCue = MyAudio.AddCue2D(m_openingCueEnum.Value);
                }

                if (deltaTime >= GetTransitionOpeningTime())
                {
                    //  Opening phase finished, we are now in active state
                    m_state           = MyGuiScreenState.OPENED;
                    m_transitionAlpha = MyGuiConstants.TRANSITION_ALPHA_MAX;
                    m_openingCue      = null;

                    OnShow();
                }
                else
                {
                    m_transitionAlpha = MathHelper.Lerp(MyGuiConstants.TRANSITION_ALPHA_MIN, MyGuiConstants.TRANSITION_ALPHA_MAX, MathHelper.Clamp((float)deltaTime / (float)GetTransitionOpeningTime(), 0, 1));
                }
            }
            else if (m_state == MyGuiScreenState.CLOSING || m_state == MyGuiScreenState.HIDING)
            {
                int deltaTime = MyMinerGame.TotalTimeInMilliseconds - m_lastTransitionTime;

                if (deltaTime >= GetTransitionClosingTime())
                {
                    m_transitionAlpha = MyGuiConstants.TRANSITION_ALPHA_MIN;

                    //  Closing phase finished, we are now in close state
                    if (m_state == MyGuiScreenState.CLOSING)
                    {
                        CloseScreenNow();
                    }
                    else if (m_state == MyGuiScreenState.HIDING)
                    {
                        m_state = MyGuiScreenState.HIDDEN;

                        OnHide();
                    }
                }
                else
                {
                    //  While closing this screen, check if there is some screen that should unhide now, so that alpha transition goes in parallel with this screen
                    if (m_state == MyGuiScreenState.CLOSING && MyGuiManager.IsAnyScreenOpening() == false && m_transitionAlpha == 1.0f)
                    {
                        MyGuiScreenBase topHiddenScreen = MyGuiManager.GetTopHiddenScreen();
                        if (topHiddenScreen != null)
                        {
                            topHiddenScreen.UnhideScreen();
                        }
                    }
                    m_transitionAlpha = MathHelper.Lerp(MyGuiConstants.TRANSITION_ALPHA_MAX, MyGuiConstants.TRANSITION_ALPHA_MIN, MathHelper.Clamp((float)deltaTime / (float)GetTransitionClosingTime(), 0, 1));
                }
            }
        }
        public MyGuiScreenSolarSystemMap(MyGuiScreenBase parent, MyMwcSectorIdentifier currentSector)
            : base(new Vector2(0.5f, 0.5f), null, Vector2.One)
        {
            m_parent = parent;
            m_enableBackgroundFade = false;
            DrawMouseCursor = true;
            m_currentSector = currentSector;
            m_closeOnEsc = true;

            Static = this;

            MySolarSystemGenerator generator = new MySolarSystemGenerator(UNIVERSE_SEED);
            generator.Generate(1024);

            m_data = generator.SolarSystemData;
            m_solarMapRender = new MySolarMapRenderer();
            m_solarMapRender.PlayerSector = currentSector.Position;

            //MyMinerGame.SwitchPause();
            m_particlesEnabled = TransparentGeometry.Particles.MyParticlesManager.Enabled;
            TransparentGeometry.Particles.MyParticlesManager.Enabled = false;

            //AddCaption(MyTextsWrapperEnum.SolarSystemMap);

            MySolarSystemMapNavigationMark playerNavigationMark =
                new MySolarSystemMapNavigationMark(
                    currentSector.Position,
                    "",
                    null,
                    MyHudConstants.SOLAR_MAP_PLAYER_MARKER_COLOR,
                    MyTransparentMaterialEnum.SolarMapPlayer)
                    {
                        VerticalLineColor = MyHudConstants.SOLAR_MAP_PLAYER_MARKER_COLOR.ToVector4(),
                        DirectionalTexture = MyHudTexturesEnum.DirectionIndicator_green,
                        Offset = new Vector3(0, 0.0f, 0),
                        Text = MyClientServer.LoggedPlayer.GetDisplayName().ToString(),
                        Importance = 50
                    };
            m_data.NavigationMarks.Add(playerNavigationMark);

            if (MyGuiScreenGamePlay.Static.IsEditorStoryActive() || MyGuiScreenGamePlay.Static.GetPreviousGameType() == MyGuiScreenGamePlayType.EDITOR_STORY)
            {
                // Loads all marks, we want it for editor
                LoadMarks(false);
            }
            else
            {
                // Load only active marks
                MyMissions.AddSolarMapMarks(m_data);
            }

            if (MyMissions.ActiveMission != null)
            {
                MyMissions.ActiveMission.AddSolarMapMarks(m_data);
            }

            m_travelButton = new MyGuiControlButton(this, new Vector2(0.0f, 0.40f),
                new Vector2(650f / 1600f, 120f / 1200f),
                MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                MyGuiManager.GetTravelButtonTexture(),
                MyGuiManager.GetTravelButtonTexture(),
                MyGuiManager.GetTravelButtonTexture(),
                MyTextsWrapperEnum.Travel,
                MyGuiConstants.BACK_BUTTON_TEXT_COLOR,
                MyGuiConstants.BACK_BUTTON_TEXT_SCALE,
                MyGuiControlButtonTextAlignment.CENTERED,
                OnTravelClick,
                false,
                MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
                true,
                false);
            m_travelButton.TextOffset = new Vector2(0, -0.0030f);
            m_travelButton.Visible = false;
            Controls.Add(m_travelButton);

            // target sector 0, 0, 0
            // distance is 1.7 sectors from camera
            Vector3 sector;

            var mostImportantMark = m_data.NavigationMarks.GetMostImportant();
            if (mostImportantMark != null) {
                sector = new Vector3(mostImportantMark.Sector.X, mostImportantMark.Sector.Y, mostImportantMark.Sector.Z);
            } else {
                sector = new Vector3(currentSector.Position.X, currentSector.Position.Y, currentSector.Position.Z);
            }

            sector.Y = 0;

            m_camera = new MySolarSystemMapCamera(sector * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS, 10000000.0f * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS);
            m_camera.MinDistanceToTarget = 1.7f * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS;
            m_camera.MaxDistanceToTarget = 1.2f * MySolarSystemUtils.MillionKmToSectors(MyBgrCubeConsts.NEPTUNE_POSITION.Length()) * MySolarSystemMapCamera.SECTOR_SIZE_GAMEUNITS;
            m_camera.MaxSector = MySolarSystemUtils.MillionKmToSectors(MyBgrCubeConsts.NEPTUNE_POSITION.Length());

            MyGuiManager.FullscreenHudEnabled = true;
        }
        void OnLoadFinished(MyGuiScreenBase screen)
        {

        }
示例#15
0
 void InventoryScreenClosed(MyGuiScreenBase screen)
 {
     if (m_isLooted)
     {
         m_isLooted = false;
         m_lastLootTime = MyMinerGame.TotalGamePlayTimeInMilliseconds;
     }
 }
        public override bool CloseScreen()
        {
            bool ret = base.CloseScreen();

            if (ret == true && m_screenToShowAfter != null)
            {
                //  Screen is loaded so now we can add it to other thread
                MyGuiManager.AddScreen(m_screenToShowAfter);
                m_screenToShowAfter = null;
            }

            return ret;
        }
 public static void AddLoginScreenDrmFree(MyGuiScreenBase openAfterSuccessfulLogin)
 {
     AddLoginScreenDrmFree(GetAction(openAfterSuccessfulLogin));
 }
 public MyGuiScreenEnterSectorMap(MyGuiScreenBase closeAfterSuccessfulEnter, MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText)
     : this(closeAfterSuccessfulEnter, startSessionType, startSessionProgressText, null)
 {
 }
        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();
        }
示例#20
0
        public static void LoadContent(MyGuiScreenBase parent)
        {     
            MyMwcLog.WriteLine("MyHud.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyHud::LoadContent");

            MyUtils.LoadTextureAtlas(MyEnumsToStrings.HudTextures, "Textures\\HUD\\", MyMinerGame.Static.RootDirectory + "\\Textures\\HUD\\HudAtlas.tai", out m_texture, out m_textureCoords);
            Debug.Assert(m_texture.LevelCount > 1, "HudAtlas does not have mip maps geneated");

            m_texts = new MyObjectsPoolSimple<MyHudText>(MyHudConstants.MAX_HUD_TEXTS_COUNT);
            m_vertices = new MyVertexFormatPositionTextureColor[MyHudConstants.MAX_HUD_QUADS_COUNT * MyHudConstants.VERTEXES_PER_HUD_QUAD];

            Vector2 size = new Vector2(0.4f, 0.25f);
            Vector2 origin = MyGuiManager.GetNormalizedCoordinateFromScreenCoordinate(new Vector2(MyMinerGame.ScreenSize.X, 0f))
                + new Vector2(-size.X / 2f, size.Y / 2f);
            m_missionDescriptions = new StringBuilder();
            new MyGuiControlMultilineText(parent, origin, size, MyGuiConstants.MULTILINE_LABEL_BACKGROUND_COLOR,
                                          MyGuiManager.GetFontMinerWarsWhite(), 0.6f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, m_missionDescriptions);

            m_dialogueTextAreaControl = new MyGuiControlMultilineText(parent, MyHudConstants.DIALOGUE_TEXTAREA_POSITION, MyHudConstants.DIALOGUE_TEXTAREA_SIZE,
                Vector4.Zero, MyGuiManager.GetFontMinerWarsBlue(), MyHudConstants.DIALOGUE_TEXTAREA_FONT_SIZE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder(), false, false);

            m_dialogueActorNameControl = new MyGuiControlMultilineText(parent, MyHudConstants.DIALOGUE_ACTORNAME_POSITION, MyHudConstants.DIALOGUE_ACTORNAME_SIZE,
                Vector4.Zero, MyGuiManager.GetFontMinerWarsBlue(), MyHudConstants.DIALOGUE_ACTORNAME_FONT_SIZE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder(), false, false);


            for (int i = 0; i < DamageIndicators.Length; i++)
            {
                DamageIndicators[i].Used = false;
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyHud.LoadContent() - END");       
        }
        public MyGuiScreenRegister(MyGuiScreenBase openAfterSuccesfullRegistration, string login, string password)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_enableBackgroundFade = true;
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\VideoBackground", flags: TextureFlags.IgnoreQuality);

            m_size = new Vector2(1030f / 1600f, 897f / 1200f);

            m_openAfterSuccesfullRegistration = openAfterSuccesfullRegistration;
            //  If user presses enter in any control, we call this method. It's default ENTER.
            this.OnEnterCallback = delegate { OnOkClick(null); };

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.32f, -m_size.Value.Y / 2.0f + 0.125f + 0.018f );
            Vector2 checkboxControlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.35f, -m_size.Value.Y / 2.0f + 0.125f);

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

            // Choose a username
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChooseUsername, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_usernameTextbox);            

            // Choose a password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.ChoosePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD);
            Controls.Add(m_passwordTextbox);

            // Retype password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RetypePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_retypePasswordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 2.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.PASSWORD);
            Controls.Add(m_retypePasswordTextbox);

            // Email address
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.EmailAddress, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_emailTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 3.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, "", MyMwcValidationConstants.EMAIL_LENGTH_MAX, MyGuiConstants.TEXTBOX_BACKGROUND_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_emailTextbox);            

            // Send me newsletters
            Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f,0) + controlsOriginLeft) + 5.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.SendNewsletters, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this,
             controlsOriginLeft + 5.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
             MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
             MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
             true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);


            //m_sendNewslettersCheckbox = new MyGuiControlCheckbox(this, controlsOriginLeft + 6f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_sendNewslettersCheckbox);

            bool remember = MyConfig.RememberUsernameAndPassword;

            // Remember me
            Controls.Add(new MyGuiControlLabel(this, (new Vector2(0.05f, 0) + controlsOriginLeft) + 6.5f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_rememberCheckbox = new MyGuiControlCheckbox(this,
                 controlsOriginLeft + 6.5f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                 MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                 remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            Controls.Add(m_rememberCheckbox);
            /*
            // Buttons APPLY and BACK
            Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y / 2.0f);
            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));
            */

            var okButton = new MyGuiControlButton(this, new Vector2(-0.1379f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE,
                       MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                       MyGuiManager.GetInventoryScreenButtonTexture(), null, null, MyTextsWrapperEnum.Ok,
                       MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                       true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);

            Controls.Add(okButton);

            var cancelButton = new MyGuiControlButton(this, new Vector2(0.1418f, 0.2558f), MyGuiConstants.OK_BUTTON_SIZE,
           MyGuiConstants.BUTTON_BACKGROUND_COLOR,
           MyGuiManager.GetInventoryScreenButtonTexture(), 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);


            if (login != null) 
            {
                m_usernameTextbox.Text = login;
            }
            if (password != null) 
            {
                m_passwordTextbox.Text = password;
                m_retypePasswordTextbox.Text = password;
            }
        }
        void progressScreen_Closed(MyGuiScreenBase source)
        {
            MyGuiManager.CloseAllScreensNowExcept(MyGuiScreenGamePlay.Static);

            MyEntityIdentifier.Reset();

            MyGuiManager.AddScreen(new MyGuiScreenStartSessionProgress(MyMwcStartSessionRequestTypeEnum.EDITOR_STORY, MyTextsWrapperEnum.LoadingPleaseWait,
                    m_sectorIdentifier,
                    CommonLIB.AppCode.ObjectBuilders.MyGameplayDifficultyEnum.EASY,
                    null,
                    null));
        }
 void saveSector(MyGuiScreenBase source)
 {
     var progressScreen = MyEditor.Static.SaveSector();
     progressScreen.Closed += new ScreenHandler(progressScreen_Closed);
 }
        private void ShowRetryDialog(Exception exception)
        {
            var messageBoxCaption = MyTextsWrapper.Get(RetryCaptionText);
            var messageBoxMessage = MyTextsWrapper.Get(RetryMessageText);

            Vector2 buttonSize = new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2.4f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);
            m_retryScreen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyMessageBoxButtonsType.YES_NO, messageBoxMessage, messageBoxCaption, null, RetryButtonText,
                    RetryCancelText, (callbackReturn) => MessageBoxCallback(exception, callbackReturn), false, buttonSize);

            MyGuiManager.AddScreen(m_retryScreen);
        }
示例#25
0
        public MyGuiScreenLogin(string username, string password, MyGuiScreenBase openAfterSuccessfulLogin, bool simple = false)
            : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, null)
        {
            m_simple = simple;
            m_enableBackgroundFade = true;
            m_openAfterSuccessfulLogin = openAfterSuccessfulLogin;
            m_size = new Vector2(1030f / 1600f, 674 / 1200f);
            m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\LoginBackground", flags: TextureFlags.IgnoreQuality);
            //  If user presses enter in any control, we call this method. It's default ENTER.
            this.OnEnterCallback = delegate { OnOkClick(null); };

            Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.07f, -m_size.Value.Y / 2.0f + 0.149f);
            Vector2 controlsOriginRight = new Vector2(-m_size.Value.X / 2.0f + 0.25f, -m_size.Value.Y / 2.0f + 0.149f);

            AddCaption(MyTextsWrapperEnum.Login);

            //  Player name
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 0 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.PlayerName, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            m_usernameTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 0 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, username, MyMwcValidationConstants.USERNAME_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_usernameTextbox);

            //  Password
            Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 1 * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Password, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
            //m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_WIDTH / 2.0f, 0), true, MyGuiConstants.LABEL_TEXT_COLOR);
            m_passwordTextbox = new MyGuiControlTextbox(this, controlsOriginRight + 1 * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.TEXTBOX_MEDIUM_SIZE.X / 2.0f, 0), MyGuiControlPreDefinedSize.MEDIUM, password, MyMwcValidationConstants.PASSWORD_LENGTH_MAX, MyGuiConstants.DEFAULT_CONTROL_NONACTIVE_COLOR/*TEXTBOX_BACKGROUND_COLOR*/, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiControlTextboxType.NORMAL);
            Controls.Add(m_passwordTextbox);

            bool remember = MyConfig.RememberUsernameAndPassword;
            bool autologin = MyConfig.Autologin;


            m_hidePasswordCheckbox = new MyGuiControlCheckbox(this,
                  new Vector2(0.1950f,-0.0793f), 
                  MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                 MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                 true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            //m_hidePasswordCheckbox = new MyGuiControlCheckbox(this, controlsOriginRight - 0.025f * Vector2.UnitX + MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_SIZE.X / 2.0f, 0), true, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR);
            Controls.Add(m_hidePasswordCheckbox);
            m_hidePasswordCheckbox.OnCheck = OnChangePasswordType;
            OnChangePasswordType(m_hidePasswordCheckbox);



            //  Remember
            m_rememberCheckbox = new MyGuiControlCheckbox(this,
                     controlsOriginRight + 2.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                     MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                     MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                     remember, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);

            if (!m_simple)
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 2.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.RememberMe, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_rememberCheckbox);
            }

            //  Auto-login
            m_autologinCheckbox = new MyGuiControlCheckbox(this,
                     controlsOriginRight + 3.25f * MyGuiConstants.CONTROLS_DELTA + new Vector2(MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE.X / 2.0f, 0),
                     MyGuiConstants.CHECKBOX_WITH_GLOW_SIZE,
                     MyGuiManager.GetCheckboxOffTexture(), MyGuiManager.GetCheckboxOnTexture(), null,
                     autologin, MyGuiConstants.CHECKBOX_BACKGROUND_COLOR, true, null);
            
            if (!m_simple)
            {
                Controls.Add(new MyGuiControlLabel(this, controlsOriginLeft + 3.25f * MyGuiConstants.CONTROLS_DELTA, null, MyTextsWrapperEnum.Autologin, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));
                Controls.Add(m_autologinCheckbox);
            }


            //  Buttons APPLY and BACK
            Vector2 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);


            var okButton = new MyGuiControlButton(this, new Vector2(-0.1861f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                Vector4.One,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Ok,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnOkClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            var cancelButton = new MyGuiControlButton(this, new Vector2(-0.0461f, 0.1611f), 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);

            var registerButton = new MyGuiControlButton(this, new Vector2(0.1924f, 0.1611f), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                Vector4.One,
                MyGuiManager.GetConfirmButton(), null, null, MyTextsWrapperEnum.Register,
                MyGuiConstants.BUTTON_TEXT_COLOR, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnRegisterClick,
                true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
            Controls.Add(okButton);
            Controls.Add(cancelButton);

            if (!m_simple)
            {
                Controls.Add(registerButton);
            }

            //  Hide password
            Controls.Add(new MyGuiControlLabel(this, new Vector2(0.2164f,-0.0793f),  null, MyTextsWrapperEnum.HidePassword, MyGuiConstants.LABEL_TEXT_COLOR, MyGuiConstants.LABEL_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER));


        }
        private void MessageBoxCallback(Exception exception, MyGuiScreenMessageBoxCallbackEnum callbackReturn)
        {
            m_retryScreen.CloseScreenNow();
            m_retryScreen = null;

            // retry
            if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES)
            {
                Retry();
            }
            // continue without saving
            else if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.NO)
            {
                RaiseActionFailed(exception);
                CloseScreen();
            }
        }
 void ParentScreenClosed(MyGuiScreenBase screen) 
 {
     MyMultiplayerGameplay.Static.Lock(PrefabLargeWeapon, false);
 }
        private static void OnInventoryScreenClosed(MyGuiScreenBase screen)
        {
            Clear();

            if (InventoryScreenClosed != null)
            {
                InventoryScreenClosed(screen);
            }
        }
示例#29
0
 public MyGuiControlContextMenu(MyGuiScreenBase parentScreen, Vector2 position, Vector2?size)
     : base(parentScreen, position, size, null, null)
 {
     m_enabled = false;
     LoadText();
 }
 private static Action GetAction(MyGuiScreenBase openAfterSuccessfulLogin)
 {
     var action = new Action(delegate() { if (openAfterSuccessfulLogin != null) MyGuiManager.AddScreen(openAfterSuccessfulLogin); });
     return action;
 }
        public MyGuiEditorControlsBase(MyGuiScreenBase parentScreen)
        {
            m_parentScreen = parentScreen;
            m_editorControls = new List<MyGuiControlBase>(10);
            m_toolbarButtons = new MyGuiControlButton[Enum.GetValues(typeof(EditorToolBarButtonType)).Length];

            m_isDemoUser = MyClientServer.LoggedPlayer == null || MyClientServer.LoggedPlayer.IsDemoUser();
            m_canAccessStoryEditor = MyClientServer.LoggedPlayer != null && MyClientServer.LoggedPlayer.GetCanAccessEditorForStory();
        }
        public MyGuiGodEditorControls(MyGuiScreenBase parentScreen) : base(parentScreen)
        {
            m_rightTopCorner_sb = new StringBuilder[Enum.GetValues(typeof(MyEditorTopTextInfoPropertiesEnum)).Length];
            m_rightBottomCorner_sb = new StringBuilder[Enum.GetValues(typeof(MyEditorBottomTextInfoPropertiesEnum)).Length];

            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.PLAYER_START_POSITION] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SECTOR_IDENTIFIER] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_TYPE] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_HUD_LABEL_TEXT] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_POSITION] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_SIZE_IN_METERS] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_ORIENTATION_FORWARD] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_ORIENTATION_UP] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_VOXEL_MAP_REMAINING_EXPLOSIONS_FOR_SAVE] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.NUMBER_OF_ASTEROIDS_IN_SECTOR] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.NUMBER_OF_OBJECTS_IN_SECTOR] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_CONTAINER_OBJECT_PREFABS_LIMIT] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.NUMBER_OF_EDITALE_OBJECTS] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SESSION_TYPE] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.OBJECT_AXIS_ROTATION_AMOUNT] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_OBJECT_COLLISION_OBJECTS] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.SELECTED_VOXEL_HAND_SHAPES_INFO] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.WORLD_COLLIDING_OBJECTS] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.NUMBER_OF_ALL_VOXEL_SHAPES_IN_SECTOR] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.VOXEL_FILE] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.VOXEL_MATERIAL] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.VOXEL_POSITION_INT] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.ENTITY_ID] = new StringBuilder();
            m_rightTopCorner_sb[(int)MyEditorTopTextInfoPropertiesEnum.TRANSFORM_LOCKED] = new StringBuilder();

            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.SPECTATOR_POSITION] = new StringBuilder();
            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.SPECTATOR_SPEED_INDICATOR] = new StringBuilder();
            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.GRID_SCALE_INDICATOR] = new StringBuilder();
            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.GIZMO_SPACE] = new StringBuilder();
            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.GRID_SNAP] = new StringBuilder();
            m_rightBottomCorner_sb[(int)MyEditorBottomTextInfoPropertiesEnum.ROTATE_SNAP] = new StringBuilder();

            m_prefabContainerEditingActiveText = MyTextsWrapper.Get(MyTextsWrapperEnum.EditingActiveContainer);
            m_editingWayPointConnectionsText = MyTextsWrapper.Get(MyTextsWrapperEnum.EditingWayPointConnections);
            m_editingWayPointConnectionsPathSelectedText = MyTextsWrapper.Get(MyTextsWrapperEnum.EditingWayPointConnectionsPathSelected);
        }
 private void ParentScreenClosed(MyGuiScreenBase screen) 
 {
     MyMultiplayerGameplay.Static.Lock(PrefabCamera, false);
 }