Beispiel #1
0
        // Obtain sector type based on the session type parameter
        public static MyMwcSectorTypeEnum GetSectorTypeFromSessionType(MyMwcStartSessionRequestTypeEnum sessionType)
        {
            MyMwcSectorTypeEnum?sectorType = null;

            if ((sessionType == MyMwcStartSessionRequestTypeEnum.EDITOR_SANDBOX) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.SANDBOX_FRIENDS) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.SANDBOX_OWN) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.SANDBOX_RANDOM))
            {
                sectorType = MyMwcSectorTypeEnum.SANDBOX;
            }
            else if (
                (sessionType == MyMwcStartSessionRequestTypeEnum.EDITOR_STORY) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.NEW_STORY) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.LOAD_CHECKPOINT))
            {
                sectorType = MyMwcSectorTypeEnum.STORY;
            }
            else if (
                (sessionType == MyMwcStartSessionRequestTypeEnum.EDITOR_MMO) ||
                (sessionType == MyMwcStartSessionRequestTypeEnum.MMO))
            {
                sectorType = MyMwcSectorTypeEnum.MMO;
            }

            MyCommonDebugUtils.AssertDebug(sectorType.HasValue);

            return(sectorType.Value);
        }
        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);
            });
        }
Beispiel #3
0
        //  TODO: This is just temporary method that launches editor. Later must be differentiate according to what user picked
        void Run(MyMwcStartSessionRequestTypeEnum sessionRequestType, bool global)
        {
            MyMwcSectorTypeEnum sectorType = MyMwcClientServer.GetSectorTypeFromSessionType(sessionRequestType);

            MyGuiManager.AddScreen(new MyGuiScreenLoadSectorIdentifiersProgress(sectorType, global, new MyGuiScreenEnterSectorMap(m_closeAfterSuccessfulEnter,
                                                                                                                                  sessionRequestType, MyTextsWrapperEnum.StartEditorInProgressPleaseWait, MyConfig.LastSandboxSector)));
        }
        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 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 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();

        }
        void ChooseSandbox(MyMwcStartSessionRequestTypeEnum sessionRequestType, bool global)
        {
            MyMwcSectorTypeEnum sectorType = MyMwcClientServer.GetSectorTypeFromSessionType(sessionRequestType);

            var selectSectorScreen = new MyGuiScreenEnterSectorMap(m_closeAfterSuccessfulEnter, sessionRequestType, MyTextsWrapperEnum.StartGameInProgressPleaseWait, MyConfig.LastSandboxSector);
            selectSectorScreen.CustomLoadAction = StartSandbox;

            bool isOfficialSandbox = sessionRequestType == MyMwcStartSessionRequestTypeEnum.SANDBOX_FRIENDS && global;

            if (isOfficialSandbox)
            {
                selectSectorScreen.SetSectorSourceAction(MyLocalCache.GetOfficialMultiplayerSectorIdentifiers);
                MyGuiManager.AddScreen(selectSectorScreen);
            }
            else
            {
                MyGuiScreenMainMenu.AddLoginScreen(new MyGuiScreenLoadSectorIdentifiersProgress(sectorType, global, selectSectorScreen));
            }
        }
        void ChooseSandbox(MyMwcStartSessionRequestTypeEnum sessionRequestType, bool global)
        {
            MyMwcSectorTypeEnum sectorType = MyMwcClientServer.GetSectorTypeFromSessionType(sessionRequestType);

            var selectSectorScreen = new MyGuiScreenEnterSectorMap(m_closeAfterSuccessfulEnter, sessionRequestType, MyTextsWrapperEnum.StartGameInProgressPleaseWait, MyConfig.LastSandboxSector);

            selectSectorScreen.CustomLoadAction = StartSandbox;

            bool isOfficialSandbox = sessionRequestType == MyMwcStartSessionRequestTypeEnum.SANDBOX_FRIENDS && global;

            if (isOfficialSandbox)
            {
                selectSectorScreen.SetSectorSourceAction(MyLocalCache.GetOfficialMultiplayerSectorIdentifiers);
                MyGuiManager.AddScreen(selectSectorScreen);
            }
            else
            {
                MyGuiScreenMainMenu.AddLoginScreen(new MyGuiScreenLoadSectorIdentifiersProgress(sectorType, global, selectSectorScreen));
            }
        }
Beispiel #9
0
        private MyServerAction LoadSandbox(MyMwcVector3Int position, int?userId, MyMissionID?startMission)
        {
            var sectorId = new MyMwcSectorIdentifier(MyMwcSectorTypeEnum.SANDBOX, userId, position, null);
            var sector   = MyLocalCache.LoadSector(sectorId);
            int?version  = sector != null ? (int?)sector.Version : null;

            MyMwcStartSessionRequestTypeEnum startSessionType = userId == MyClientServer.LoggedPlayer.GetUserId() ? MyMwcStartSessionRequestTypeEnum.SANDBOX_OWN : MyMwcStartSessionRequestTypeEnum.SANDBOX_FRIENDS;

            if (userId != null)
            {
                MyServerAction loadAction = new MyServerAction(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, TimeSpan.FromSeconds(360));
                loadAction.BeginAction = c => c.BeginLoadSandbox(position, userId, version, null, c);
                loadAction.EndAction   = (c, r) => SandboxSectorLoaded(position, MyMwcObjectBuilder_Base.FromBytes <MyMwcObjectBuilder_Checkpoint>(c.EndLoadSandbox(r)), sector, startSessionType, startMission);
                loadAction.Start();
                return(loadAction);
            }
            else if (sector != null)
            {
                var checkpoint = MyLocalCache.MultiplayerCheckpoint();
                if (checkpoint == null)
                {
                    throw new MyDataCorruptedException("Cannot load MP checkpoint");
                }

                if (!MySteam.IsActive && MyClientServer.IsMwAccount)
                {
                    checkpoint.PlayerObjectBuilder.Money = (float)MySectorServiceClient.GetCheckedInstance().GetGameMoney();
                    MySectorServiceClient.SafeClose();
                }

                checkpoint.SectorObjectBuilder = sector;
                SandboxSectorLoaded(position, checkpoint, sector, startSessionType, startMission);
                return(null);
            }
            else
            {
                throw new MyDataCorruptedException("Cannot load sandbox/MP sector");
            }
        }
 public MyGuiScreenEnterSectorMap(MyGuiScreenBase closeAfterSuccessfulEnter, MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText)
     : this(closeAfterSuccessfulEnter, startSessionType, startSessionProgressText, null)
 {
 }
        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) });
        }
        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;
        }
Beispiel #13
0
 public MyGuiScreenEnterSectorMap(MyGuiScreenBase closeAfterSuccessfulEnter, MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText)
     : this(closeAfterSuccessfulEnter, startSessionType, startSessionProgressText, null)
 {
 }
Beispiel #14
0
        private void SandboxSectorLoaded(MyMwcVector3Int targetSector, MyMwcObjectBuilder_Checkpoint checkpoint, MyMwcObjectBuilder_Sector cachedSector, MyMwcStartSessionRequestTypeEnum startSessionType, MyMissionID? startMission)
        {
            if (checkpoint.SectorObjectBuilder == null) // Server said, use cache
            {
                checkpoint.SectorObjectBuilder = cachedSector;
            }
            else
            {
                MyLocalCache.SaveCheckpoint(checkpoint);
            }

            MyGuiScreenGamePlay.ReloadGameplayScreen(checkpoint, startSessionType, MyGuiScreenGamePlayType.GAME_SANDBOX, startMission);
        }
Beispiel #15
0
        private void SandboxSectorLoaded(MyMwcVector3Int targetSector, MyMwcObjectBuilder_Checkpoint checkpoint, MyMwcObjectBuilder_Sector cachedSector, MyMwcStartSessionRequestTypeEnum startSessionType, MyMissionID?startMission)
        {
            if (checkpoint.SectorObjectBuilder == null) // Server said, use cache
            {
                checkpoint.SectorObjectBuilder = cachedSector;
            }
            else
            {
                MyLocalCache.SaveCheckpoint(checkpoint);
            }

            MyGuiScreenGamePlay.ReloadGameplayScreen(checkpoint, startSessionType, MyGuiScreenGamePlayType.GAME_SANDBOX, startMission);
        }
 //  TODO: This is just temporary method that launches editor. Later must be differentiate according to what user picked
 void Run(MyMwcStartSessionRequestTypeEnum sessionRequestType, bool global)
 {
     MyMwcSectorTypeEnum sectorType = MyMwcClientServer.GetSectorTypeFromSessionType(sessionRequestType);
     MyGuiManager.AddScreen(new MyGuiScreenLoadSectorIdentifiersProgress(sectorType, global, new MyGuiScreenEnterSectorMap(m_closeAfterSuccessfulEnter,
         sessionRequestType, MyTextsWrapperEnum.StartEditorInProgressPleaseWait, MyConfig.LastSandboxSector)));
 }