Esempio n. 1
0
        private void TravelSectorLoaded(MyMwcTravelTypeEnum travelType, MyMwcVector3Int targetSector, byte[] sectorDataResponse, MyMwcObjectBuilder_Sector cachedSector)
        {
            var checkpoint = GetCheckpointBuilder(false);

            checkpoint.SectorObjectBuilder = cachedSector;

            // Overwrite current sector
            checkpoint.CurrentSector.Position = targetSector;
            UpdatePlayerPosition(travelType, ref checkpoint.PlayerObjectBuilder.ShipObjectBuilder.PositionAndOrientation.Position);

            if (sectorDataResponse != null)
            {
                checkpoint.SectorObjectBuilder = MyMwcObjectBuilder_Base.FromBytes <MyMwcObjectBuilder_Sector>(sectorDataResponse);
                MyLocalCache.Save(null, checkpoint.SectorObjectBuilder, checkpoint.CurrentSector);
            }

            // Change NEW_STORY to LOAD_CHECKPOINT, because it's necessary, travel is never new story
            MyMwcStartSessionRequestTypeEnum?sessionStart = null;

            if (MyGuiScreenGamePlay.Static != null)
            {
                sessionStart = MyGuiScreenGamePlay.Static.GetSessionType();
                if (sessionStart.HasValue && sessionStart.Value == MyMwcStartSessionRequestTypeEnum.NEW_STORY)
                {
                    sessionStart = MyMwcStartSessionRequestTypeEnum.LOAD_CHECKPOINT;
                }
            }

            MyGuiScreenGamePlay.ReloadGameplayScreen(checkpoint, sessionStart, null, null, travelType);
        }
Esempio n. 2
0
        private void NewGameSectorLoaded(MyMwcObjectBuilder_Checkpoint checkpoint, byte[] sectorData, MyMissionID missionId)
        {
            checkpoint.SectorObjectBuilder = MyMwcObjectBuilder_Base.FromBytes <MyMwcObjectBuilder_Sector>(sectorData);

            // Save sector to cache
            MyLocalCache.Save(null, checkpoint.SectorObjectBuilder, checkpoint.CurrentSector);

            checkpoint.CurrentSector.UserId = MyClientServer.LoggedPlayer.GetUserId(); //TODO: should this be send by server?
            ReloadGameplayNewGame(checkpoint, missionId);
        }