public MySolarSystemMapNavigationMark(MyMwcVector3Int sector, string name, MyMissionID?missionID, Color color, MyTransparentMaterialEnum texture) { Sector = sector; Name = name; Color = color; Texture = texture; Importance = 1; DrawVerticalLine = true; MissionID = missionID; Font = MyGuiManager.GetFontMinerWarsWhite(); }
private void TravelToSector(MyMwcVector3Int sector, MyMissionID?missionID = null) { if (MyGuiScreenGamePlay.Static.IsCurrentSector(sector)) { CloseScreen(); return; } if (!MyGuiScreenGamePlay.CanTravelToSector(sector)) { MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.ForbiddenSolarMapAreaWarning, MyTextsWrapperEnum.Warning, MyTextsWrapperEnum.Ok, null)); return; } MyMwcVector3Int targetSector = sector; m_currentSector.Position = targetSector; m_currentSector.UserId = MyClientServer.LoggedPlayer.GetUserId(); this.CloseScreenNow(); MyGuiScreenGamePlay.Static.TravelToSector(m_currentSector, MyMwcTravelTypeEnum.SOLAR, MySession.PlayerShip.GetPosition(), missionID); }
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 void AddEnterSectorResponse(MyMwcObjectBuilder_Checkpoint checkpoint, MyMissionID?missionID) { m_screenToLoad.AddEnterSectorResponse(checkpoint, missionID); }
//public void SetControlsChange(bool Value) //{ // m_controlsChange = Value; //} //public bool GetControlsChange() //{ // return m_controlsChange; //} public void AddEnterSectorResponse(MyMwcObjectBuilder_Checkpoint checkpoint, MyMissionID? missionToStart) { m_checkpoint = checkpoint; if (missionToStart != null) { m_missionToStart = missionToStart; } }
public void TravelToSector(MyMwcSectorIdentifier sectorIdentifier, MyMwcTravelTypeEnum travelType, Vector3 currentShipPosition, MyMissionID? missionToStart = null) { if (MySession.Static != null) { if (m_type == MyGuiScreenGamePlayType.GAME_STORY && !MyClientServer.LoggedPlayer.GetCanSave()) // Game travel is not allowed when user cannot save { return; } if (!CanTravel && !MyFakes.ENABLE_SOLAR_MAP && !MyFakes.TEST_MULTIPLE_LOAD_UNLOAD) { return; } m_transferToNeighbouringSectorStarted = true; m_travelSectorIdentifier = sectorIdentifier; m_travelReason = travelType; m_missionToStart = missionToStart; if (m_type != MyGuiScreenGamePlayType.EDITOR_STORY && m_previousType != MyGuiScreenGamePlayType.EDITOR_STORY && !MyFakes.DISABLE_AUTO_SAVE) { MySession.Static.Player.TravelLeave(m_travelReason); if (!MyMinerGame.IsPaused()) MyMinerGame.SwitchPause(); MyServerAction serverAction = MySession.Static.SaveLastCheckpoint(); // Saving before travel, save sector travelSaveSuccess(); } else { travelSaveSuccess(); } } }
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); }