private MyNotification(int notificationTextId, string notificationString, MyGuiScreenGamePlayType LifeArea, float scale,
                                  MyGuiFont font,
                                  MyGuiDrawAlignEnum textAlign, int disapearTimeMs, MyEntity owner, bool showConfirmMessage = false,
                                  object[] textFormatArguments = null)
            {
                Owner = owner;
                m_originalText = notificationString;
                m_notificationText = notificationString;
                m_notificationTextID = (int)notificationTextId;
                m_isTextDirty = false;

                // always false:
                m_isDisappeared = false;

                m_actualScale = scale;                
                m_actualFont = font;
                m_actualTextAlign = textAlign;

                m_textFormatArguments = textFormatArguments;

                // timing:
                m_disappearTimeMs = disapearTimeMs;
                m_aliveTime = 0;

                // life space;
                m_lifeSpace = LifeArea;

                // show standart message?
                m_showConfirmMessage = showConfirmMessage;
            }
Example #2
0
 public MyNotification(String notificationText, MyGuiScreenGamePlayType LifeArea, float scale,
                       MyGuiFont font,
                       MyGuiDrawAlignEnum textAlign, int disapearTimeMs, MyEntity owner = null, bool showConfirmMessage = false,
                       object[] textFormatArguments = null)
     : this(0, notificationText, LifeArea, scale, font, textAlign, disapearTimeMs, owner, showConfirmMessage, textFormatArguments)
 {
 }
Example #3
0
        public static void SetByType(MyGuiScreenGamePlayType type)
        {
            switch (type)
            {
            // For normal resolution:
            case MyGuiScreenGamePlayType.EDITOR_MMO:
            case MyGuiScreenGamePlayType.EDITOR_SANDBOX:
            case MyGuiScreenGamePlayType.EDITOR_STORY:
            case MyGuiScreenGamePlayType.GAME_MMO:
            case MyGuiScreenGamePlayType.GAME_SANDBOX:
            case MyGuiScreenGamePlayType.GAME_STORY:
            case MyGuiScreenGamePlayType.INGAME_EDITOR:
                //SetNormalResolution();
            {
            }
            break;

            // For maximum resolution:
            case MyGuiScreenGamePlayType.CREDITS:
            case MyGuiScreenGamePlayType.MAIN_MENU:
            case MyGuiScreenGamePlayType.PURE_FLY_THROUGH:
                SetMaximalResolution();
                //SetMinimalResolutution();
                {
                }
                break;
            }
        }
 public MyNotification(String notificationText, MyGuiScreenGamePlayType LifeArea, float scale,
                       MyGuiFont font,
                       MyGuiDrawAlignEnum textAlign, int disapearTimeMs, MyEntity owner = null, bool showConfirmMessage = false,
                       object[] textFormatArguments = null)
     : this(0, notificationText, LifeArea, scale, font, textAlign, disapearTimeMs, owner, showConfirmMessage, textFormatArguments)
 {
 }
Example #5
0
            private MyNotification(int notificationTextId, string notificationString, MyGuiScreenGamePlayType LifeArea, float scale,
                                   MyGuiFont font,
                                   MyGuiDrawAlignEnum textAlign, int disapearTimeMs, MyEntity owner, bool showConfirmMessage = false,
                                   object[] textFormatArguments = null)
            {
                Owner                = owner;
                m_originalText       = notificationString;
                m_notificationText   = notificationString;
                m_notificationTextID = (int)notificationTextId;
                m_isTextDirty        = false;

                // always false:
                m_isDisappeared = false;

                m_actualScale     = scale;
                m_actualFont      = font;
                m_actualTextAlign = textAlign;

                m_textFormatArguments = textFormatArguments;

                // timing:
                m_disappearTimeMs = disapearTimeMs;
                m_aliveTime       = 0;

                // life space;
                m_lifeSpace = LifeArea;

                // show standart message?
                m_showConfirmMessage = showConfirmMessage;
            }
Example #6
0
        // Add notification to the end of the list:
        public static int AddNotification(MyNotification notification, MyGuiScreenGamePlayType currentScreen)
        {
            int currentScreenInt = (int)currentScreen;

            notification.ResetAliveTime();
            m_screenNotifications[currentScreenInt].Add(notification);
            return(m_screenNotifications[currentScreenInt].Count());
        }
Example #7
0
 // Flush all notifications for the game play type screen:
 public static void ClearNotifications(MyGuiScreenGamePlayType forScreen)
 {
     m_screenNotifications[(int)forScreen].Clear();
 }
Example #8
0
 // has notifications for the current screen:
 public static bool HasNotification(MyGuiScreenGamePlayType forScreen)
 {
     return(m_screenNotifications[(int)forScreen].Count() > 0);
 }
Example #9
0
 // Set current space - screen:
 public static void SetCurrentScreen(MyGuiScreenGamePlayType currentScreen = MyGuiScreenGamePlayType.GAME_STORY)
 {
     m_currentScreen = currentScreen;
 }
        public MyGuiScreenGamePlay(MyGuiScreenGamePlayType type, MyGuiScreenGamePlayType? previousType, MyMwcSectorIdentifier sectorIdentifier, int sectorVersion, MyMwcStartSessionRequestTypeEnum? sessionType)
            : base(Vector2.Zero, null, null)
        {
            MySystemTimer.SetByType(type);

            m_sessionType = sessionType;
            m_sectorIdentifier = sectorIdentifier;
            SectorVersion = sectorVersion;
            m_directionToSunNormalized = -MyMwcUtils.Normalize(GetPositionInMillionsOfKm());
            DrawMouseCursor = false;
            m_closeOnEsc = false;
            m_type = type;
            m_previousType = previousType;
            m_firstUpdateCall = true;
            m_firstDrawCall = FIRST_TOTAL_DELAY;
            m_drawEvenWithoutFocus = true;
            m_enableBackgroundFade = true;
            m_canShareInput = false;
            m_screenCanHide = false;

            m_isPreparedTextureForSectorLoadingScreen = false;
            m_prepareTextureForSectorLoadingScreen = false;

            MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ClearEvents();
            MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ShutdownNotification += new MinerWars.AppCode.Networking.SectorService.MySectorServerCallback.ShutdownHandler(MySectorServerCallback_ShutdownNotification);

            m_secondarySetup = new MyRender.MyRenderSetup();
            m_secondarySetup.EnabledModules = new HashSet<MyRenderModuleEnum>();
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Cockpit);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.CockpitGlass);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunGlareAndLensFlare);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.UpdateOcclusions);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.AnimatedParticlesPrepare);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TransparentGeometry);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.ParticlesDustField);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.VoxelHand);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DistantImpostors);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Decals);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.CockpitWeapons);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunGlow);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SectorBorder);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DrawSectorBBox);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DrawCoordSystem);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Explosions);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.BackgroundCube);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.GPS);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TestField);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.AnimatedParticles);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Lights);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.TransparentGeometryForward);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Projectiles);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.DebrisField);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.ThirdPerson);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.Editor);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SolarObjects);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SolarMapGrid);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PrunningStructure);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.SunWind);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.IceStormWind);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PrefabContainerManager);
            m_secondarySetup.EnabledModules.Add(MyRenderModuleEnum.PhysicsPrunningStructure);

            m_showGPSNotification = new MyHudNotification.MyNotification(MyTextsWrapperEnum.GPSReminder, MyHudConstants.MISSION_FONT, MyHudNotification.DONT_DISAPEAR, null, null);
            m_showGPSNotification.SetTextFormatArguments(new object[] { MyGuiManager.GetInput().GetGameControlTextEnum(MyGameControlEnums.GPS) });
        }
 // Add notification to the end of the list:
 public static int AddNotification(MyNotification notification, MyGuiScreenGamePlayType currentScreen)
 {
     int currentScreenInt = (int)currentScreen;
     notification.ResetAliveTime();
     m_screenNotifications[currentScreenInt].Add(notification);
     return m_screenNotifications[currentScreenInt].Count();
 }
Example #12
0
        public static void SetByType(MyGuiScreenGamePlayType type)
        {
            switch (type)
            {
                // For normal resolution:
                case MyGuiScreenGamePlayType.EDITOR_MMO:
                case MyGuiScreenGamePlayType.EDITOR_SANDBOX:
                case MyGuiScreenGamePlayType.EDITOR_STORY:
                case MyGuiScreenGamePlayType.GAME_MMO:
                case MyGuiScreenGamePlayType.GAME_SANDBOX:
                case MyGuiScreenGamePlayType.GAME_STORY:
                case MyGuiScreenGamePlayType.INGAME_EDITOR:
                    //SetNormalResolution();
                    {
                    }
                    break;

                // For maximum resolution:
                case MyGuiScreenGamePlayType.CREDITS:
                case MyGuiScreenGamePlayType.MAIN_MENU:
                case MyGuiScreenGamePlayType.PURE_FLY_THROUGH:
                    SetMaximalResolution();
                    //SetMinimalResolutution();
                    {
                    }
                    break;
            }
        }
 private bool IsTypeEditorGodMode(MyGuiScreenGamePlayType? type)
 {
     if (type == null)
         return false;
     switch (type.Value)
     {
         case MyGuiScreenGamePlayType.EDITOR_STORY:
         case MyGuiScreenGamePlayType.EDITOR_MMO:
         case MyGuiScreenGamePlayType.EDITOR_SANDBOX:
             return true;
             break;
     }
     return false;
 }
 public static void SetNotificationsPosition(MyGuiScreenGamePlayType screen, Vector2 position)
 {
     m_screenNotifications[(int) screen].Position = position;
 }
 // Flush all notifications for the game play type screen:
 public static void ClearNotifications(MyGuiScreenGamePlayType forScreen)
 {
     m_screenNotifications[(int) forScreen].Clear();
 }
 // has notifications for the current screen:
 public static bool HasNotification(MyGuiScreenGamePlayType forScreen)
 {
     return m_screenNotifications[(int) forScreen].Count() > 0;
 }
Example #17
0
 public static void SetNotificationsPosition(MyGuiScreenGamePlayType screen, Vector2 position)
 {
     m_screenNotifications[(int)screen].Position = position;
 }
        public static MyGuiScreenLoading ReloadGameplayScreen(MyMwcObjectBuilder_Checkpoint checkpoint, MyMwcStartSessionRequestTypeEnum? sessionType = null, MyGuiScreenGamePlayType? gameplayType = null, MyMissionID? startMission = null, MyMwcTravelTypeEnum? travelType = null)
        {
            if (MyMultiplayerGameplay.IsRunning)
                MyMultiplayerGameplay.Static.Suspend();

            if (checkpoint.SectorObjectBuilder != null)
            {
                MySession.Static.Is2DSector = MyMwcSectorIdentifier.Is25DSector(checkpoint.SectorObjectBuilder.Name);
            }

            Debug.Assert((gameplayType != null && sessionType != null) || MyGuiScreenGamePlay.Static != null, "Set gameplay type and session type, there's no previous gameplay screen");
            MyGuiScreenGamePlayType newGameplayType = gameplayType.HasValue ? gameplayType.Value : MyGuiScreenGamePlay.Static.GetGameType();
            MyMwcStartSessionRequestTypeEnum? newSessionType = sessionType.HasValue ? sessionType.Value : MyGuiScreenGamePlay.Static.GetSessionType();
            MyGuiScreenGamePlayType? previousGameplaytype = MyGuiScreenGamePlay.Static != null ? MyGuiScreenGamePlay.Static.GetPreviousGameType() : (MyGuiScreenGamePlayType?)null;
            MyMissionID? previousMissionToStart = MyGuiScreenGamePlay.Static != null ? MyGuiScreenGamePlay.Static.m_missionToStart : (MyMissionID?)null;

            var newGameplayScreen = new MyGuiScreenGamePlay(newGameplayType, previousGameplaytype, checkpoint.CurrentSector, checkpoint.SectorObjectBuilder.Version, newSessionType);
            newGameplayScreen.m_missionToStart = previousMissionToStart;
            if (travelType.HasValue)
                newGameplayScreen.m_travelReason = travelType.Value;


            var loadScreen = new MyGuiScreenLoading(newGameplayScreen, MyGuiScreenGamePlay.Static);
            loadScreen.AddEnterSectorResponse(checkpoint, startMission);

            /*
            if (MyConfig.NeedShowPerfWarning)
            {
                MyGuiScreenPerformanceWarning perfWarningScreen = new MyGuiScreenPerformanceWarning(loadScreen);

                perfWarningScreen.Closed += delegate
                {
                    MyGuiManager.AddScreen(loadScreen);
                };

                MyGuiManager.AddScreen(perfWarningScreen);
            }
            else*/
            {
                MyGuiManager.AddScreen(loadScreen);
            }

            return loadScreen;
        }
        public void TrySwitchBetweenGameAndEditor()
        {
            //from game -> to god editor
            if (IsGameActive() && IsTypeEditorGodMode(m_previousType))
            {
                MySpectator.Position = MySession.PlayerShip.GetPosition() + (50 * MySession.PlayerShip.WorldMatrix.Up);
                MySpectator.Target = MySession.PlayerShip.GetPosition();
                MyDialogues.Stop();
                MyAudio.Stop();//stop all 3d sounds
                CameraAttachedTo = MyCameraAttachedToEnum.Spectator;
                MyCamera.SetViewMatrix(MySpectator.GetViewMatrix());
                m_type = m_previousType.Value;
                m_previousType = null;
                MyEditor.Static.SetActive(true);
                EditorControls.AddEditorControlsToList(Controls);

                // Reset spawnpoints, delete their bots from scene
                foreach (var spawnpoint in MyEntities.GetEntities().OfType<MySpawnPoint>().ToArray())
                {
                    spawnpoint.Reset();
                }

                //MyEditor.DisablePhysicsAndResetStatesOnAllObjectsInSector();// also ensure we stop all updates and all objects newly inserted into sector are with phyisics defaultly off
                if (MyHudSectorBorder.Enabled != m_hudSectorBorderInEditor)
                    MyHudSectorBorder.SwitchSectorBorderVisibility();

                m_wheelControlMenu.HideScreenIfPossible();
                MyCamera.Zoom.ResetZoom();
            }
            else if (IsTypeEditorGodMode(m_type) && m_previousType == null)
            {
                //from god-editor to -> gameplay
                //we need to enable physics
                //be sure we dont entry in game with any objects in collision                
                //because when you have selected entities, then they are not colliding, so we must clear selection and handle colliding entities now
                List<MyEntity> tempSelectedEntities = MyEditorGizmo.SelectedEntities.ToList();
                MyEditorGizmo.ClearSelection();
                if (MyEditor.Static.CollidingElements.Count == 0)
                {
                    m_previousType = m_type;
                    m_type = MyGuiScreenGamePlayType.GAME_SANDBOX;
                    CameraAttachedTo = MySession.PlayerShip != null ? MySession.PlayerShip.Config.ViewMode.GetCameraMode() : MyCameraAttachedToEnum.PlayerMinerShip;
                    MyEditor.Static.SetActive(false);
                    EditorControls.RemoveEditorControlsFromList(Controls);

                    //MyEditor.EnablePhysicsOnAllActiveObjectsInSector();
                    // sector borders disabled by default in gameplay
                    m_hudSectorBorderInEditor = MyHudSectorBorder.Enabled;
                    if (MyHudSectorBorder.Enabled == true)
                        MyHudSectorBorder.SwitchSectorBorderVisibility();

                    m_wheelControlMenu.HideScreenIfPossible();

                    if (MyVideoModeManager.IsHardwareCursorUsed())
                        MyGuiInput.SetMouseToScreenCenter();

                    MyCamera.Zoom.ResetZoom();

                    // Reset spawnpoints, delete their bots from scene
                    foreach (var spawnpoint in MyEntities.GetEntities().OfType<MySpawnPoint>().ToArray())
                    {
                        spawnpoint.ResetBotsSpawnTime();
                    }
                }
                else
                {
                    MyEditorGizmo.AddEntitiesToSelection(tempSelectedEntities);
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.FixCollisions, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                }
            }
            else if (m_type != MyGuiScreenGamePlayType.INGAME_EDITOR)
            {
                // 0006155: Disable builder mode (press 0 when you close to mother ship)
                if (!MyFakes.ENABLE_BUILDER_MODE)
                {
                    return;
                }

                // from normal game to ingame editor
                MySmallShip playersSmallShip = MySession.PlayerShip as MySmallShip;
                if (playersSmallShip == null)
                {
                    return;
                }
                MyPrefabFoundationFactory foundationFactory = null;
                MyEntity detectedPrefabContainer = playersSmallShip.BuildDetector.GetNearestEntity();
                if (detectedPrefabContainer != null)
                {
                    MyPrefabContainer prefabContainer = detectedPrefabContainer as MyPrefabContainer;
                    if (prefabContainer.ContainsPrefab(PrefabTypesFlagEnum.FoundationFactory))
                    {
                        foundationFactory = prefabContainer.GetPrefabs(CategoryTypesEnum.FOUNDATION_FACTORY)[0] as MyPrefabFoundationFactory;
                    }
                }
                if (foundationFactory == null)
                {
                    if (FoundationFactoryDropEnabled)
                    {
                        m_invokeGameEditorSwitch = false;
                        return;
                    }

                    bool addFoundationFactoryResult;
                    foundationFactory = MyPrefabFoundationFactory.TryCreateFoundationFactory(MySession.Static.Player, out addFoundationFactoryResult);
                    if (!addFoundationFactoryResult)
                    {
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.NotificationYouHaveNoFoundationFactory, MyTextsWrapperEnum.TitleYouCantBuild, MyTextsWrapperEnum.Ok, null));
                        m_invokeGameEditorSwitch = false;
                        return;
                    }
                }

                MySmallShip playerShip = MySession.PlayerShip;

                MySpectator.Position = playerShip.GetPosition() + (50 * playerShip.WorldMatrix.Up);
                MySpectator.Target = playerShip.GetPosition();
                CameraAttachedTo = MyCameraAttachedToEnum.Spectator;
                MyCamera.SetViewMatrix(MySpectator.GetViewMatrix());
                MyAudio.Stop();//stop all 3d sounds
                m_previousType = m_type;
                m_type = MyGuiScreenGamePlayType.INGAME_EDITOR;
                MyEditor.Static.SetActive(true);
                //EditorControls.AddEditorControlsToList(ref Controls);
                //FoundationFactoryControls.AddEditorControlsToList(ref Controls);
                EditorControls.AddEditorControlsToList(Controls);

                MyEditor.Static.EnterInGameEditMode(foundationFactory);// this will enter my own container and lock it                 

                // sector borders enabled by default in editor
                if (MyHudSectorBorder.Enabled == false)
                    MyHudSectorBorder.SwitchSectorBorderVisibility();

                m_wheelControlMenu.HideScreenIfPossible();
                MyCamera.Zoom.ResetZoom();
            }
            else
            {
                //from ingame editor back to the game
                //beause when you have selected entities, then they are not colliding, so we must clear selection and handle colliding entities now
                List<MyEntity> tempSelectedEntities = MyEditorGizmo.SelectedEntities.ToList();
                MyEditorGizmo.ClearSelection();
                if (MyEditor.Static.CollidingElements.Count == 0)
                {

                    m_type = m_previousType.Value;
                    m_previousType = null;
                    CameraAttachedTo = MySession.PlayerShip != null ? MySession.PlayerShip.Config.ViewMode.GetCameraMode() : MyCameraAttachedToEnum.PlayerMinerShip;
                    MyEditor.Static.SetActive(false);
                    //EditorControls.RemoveEditorControlsFromList(ref Controls);
                    //FoundationFactoryControls.RemoveEditorControlsFromList(ref Controls);
                    EditorControls.RemoveEditorControlsFromList(Controls);
                    MyEditor.Static.ExitInGameEditMode();

                    // sector borders disabled by default in gameplay
                    if (MyHudSectorBorder.Enabled == true)
                        MyHudSectorBorder.SwitchSectorBorderVisibility();

                    m_wheelControlMenu.HideScreenIfPossible();
                    MyCamera.Zoom.ResetZoom();

                    if (MyVideoModeManager.IsHardwareCursorUsed())
                        MyGuiInput.SetMouseToScreenCenter();
                }
                else
                {
                    MyEditorGizmo.AddEntitiesToSelection(tempSelectedEntities);
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.FixCollisions, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
                }
            }

            m_invokeGameEditorSwitch = false;
        }
 // Set current space - screen:
 public static void SetCurrentScreen(MyGuiScreenGamePlayType currentScreen = MyGuiScreenGamePlayType.GAME_STORY)
 {
     m_currentScreen = currentScreen;
 }