public static List <Part> GetDockedParts(Vessel vessel, Part dockedPort) { Part parentPart = dockedPort; List <Part> childParts = new List <Part>(); List <Part> linkedParts = null; linkedParts = GetLinkedParts(parentPart); uint dockedToPartId = 0; foreach (Part linkedPart in linkedParts) { var dockedPart = RmmUtil.GetDockedPart(vessel, linkedPart); if (!(dockedPart != null && dockedPart.flightID == parentPart.flightID)) { childParts.Add(linkedPart); } else { dockedToPartId = linkedPart.flightID; } } int childPartIndex = 0; while (childPartIndex < childParts.Count) { linkedParts = GetLinkedParts(childParts[childPartIndex]); foreach (Part linkedPart in linkedParts) { // don't add parent part if (linkedPart.flightID == parentPart.flightID) { continue; } // don't add parts twice bool present = false; foreach (Part childPart in childParts) { if (linkedPart.flightID == childPart.flightID) { present = true; break; } } if (present) { continue; } childParts.Add(linkedPart); } childPartIndex++; } // return one list with all parts List <Part> allParts = null; allParts = childParts; allParts.Add(parentPart); return(allParts); }
private float CalculateVesselPrice(bool withCargo) { double price = 0.0f; string[] propellantResources = new string[0]; if (trackReturnResources == "") { //RmmUtil.DetermineProppellantArray(vessel, ref propellantResources); } else { RmmUtil.GetProppellantArray(trackReturnResources, ref propellantResources); } //cost parts foreach (Part p in vessel.parts) { double missingResCost = 0; foreach (PartResource r in p.Resources) { if (withCargo || propellantResources.Contains(r.info.name)) { missingResCost = missingResCost + RmmUtil.Cost(r.info.name, (r.maxAmount - r.amount)); } else { missingResCost = missingResCost + RmmUtil.Cost(r.info.name, r.maxAmount); } } price = price + (p.partInfo.cost - missingResCost + part.GetModuleCosts(0)); } return((float)price); }
public void RoutineDepartureDetail(string missiondId, uint flightIdDepartureDockPart, IWindow parent = null) { CancelRoutineDepartureDetail(); _routineDepartureDetailWindow = new RoutineDepartureDetailWindow(this); WindowManager.Open(_routineDepartureDetailWindow, parent: parent); RoutineDepartureMission routineDepartureMission = null; foreach (Mission mission in _missions) { if (mission.Info == null) { continue; } if (mission.Info.Type != 20) { continue; } if (mission.MissionId == missiondId) { routineDepartureMission = RoutineMission.AssemblePotentialRoutineMission <RoutineDepartureMission>(mission); routineDepartureMission.flightIdDepartureDockPart = flightIdDepartureDockPart; if (!routineDepartureMission.AllowedVessel(FlightGlobals.ActiveVessel).CheckSucces) { continue; } } } _routineDepartureDetailWindow.RoutineDepartureMission = routineDepartureMission; _routineDepartureDetailWindow.DepartureParts = RmmUtil.GetDockedParts(FlightGlobals.ActiveVessel, RmmUtil.GetDockedPart(FlightGlobals.ActiveVessel, RmmUtil.GetVesselPart(FlightGlobals.ActiveVessel, flightIdDepartureDockPart))); }
public CheckList Allowed(Vessel vessel) { var checkList = new CheckList(); checkList.Check(Valid(), "invalid mission departure mission"); if (!checkList.CheckSucces) { return(checkList); } checkList.Check(AllowedVessel(vessel), "vessel not allowed"); if (!checkList.CheckSucces) { return(checkList); } List <Part> departureParts = RmmUtil.GetDockedParts(vessel, RmmUtil.GetDockedPart(vessel, RmmUtil.GetVesselPart(vessel, flightIdDepartureDockPart))); checkList.Check(departureParts != null, "no docked vessel on docking port"); if (!checkList.CheckSucces) { return(checkList); } checkList.Check(RmmUtil.AstronautCrewCount(departureParts) >= _mission.Departure.Crew, "not enough crew"); int crewCapacity = 0; foreach (MissionLanding missionLanding in _mission.Landings) { crewCapacity += missionLanding.CrewCapacity; } checkList.Check(RmmUtil.AstronautCrewCount(departureParts) <= crewCapacity, "too many crew"); foreach (MissionResource missionResource in _mission.Departure.Resources) { if (!_mission.Departure.Proppellants.Contains(missionResource.Name)) { continue; } checkList.Check(RmmUtil.ReadResource(departureParts, missionResource.Name) >= (missionResource.Amount * 0.99), "insufficient " + missionResource.Name); } double vesselCargoMass = 0; List <MissionResource> vesselResources = MissionResource.GetMissionResourceList(departureParts); foreach (MissionResource vesselResource in vesselResources) { if (Proppelants.Contains(vesselResource.Name)) { continue; } vesselCargoMass += RmmUtil.Mass(vesselResource.Name, vesselResource.Amount); } LoggerRmm.Debug(vesselCargoMass + " " + CargoMass); checkList.Check((vesselCargoMass * 0.99) <= CargoMass, "too much cargomass"); return(checkList); }
private void HandleMenuWindow() { if (_menuWindow == null) { return; } if (!WindowManager.IsOpen(_menuWindow)) { CancelMenu(); return; } if (RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name) && (RmmUtil.IsPreLaunch(FlightGlobals.ActiveVessel) || FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING)) { _menuWindow.TrackingEnabled = true; } else { _menuWindow.TrackingEnabled = false; } if (RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name) && FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING) { _menuWindow.RoutineArrivalEnabled = true; _menuWindow.RoutineDepartureEnabled = true; _menuWindow.RegisterDockingPortsEnabled = true; } else { _menuWindow.RoutineArrivalEnabled = false; _menuWindow.RoutineDepartureEnabled = false; } }
private void trackLaunch() { MissionLaunch launch = new MissionLaunch { Time = (float)Planetarium.GetUniversalTime(), Body = vessel.mainBody.name, VesselName = vessel.name, Funds = RmmUtil.CalculateVesselPrice(vessel), Crew = RmmUtil.AstronautCrewCount(vessel), Parts = MissionPart.GetMissionPartList(vessel), }; _mission.TrackLaunch(launch); trackingActive = true; trackingPrimary = true; trackingStatus = "Underway"; //----------------------- trackPartCount = RmmUtil.CountVesselParts(vessel); trackCrew = RmmUtil.AstronautCrewCount(vessel); trackCrewCapacity = RmmUtil.CrewCapacityCount(vessel); ScreenMessages.PostScreenMessage("mission tracking-LAUNCH", 4, ScreenMessageStyle.UPPER_CENTER); setOtherModules(); updateTrackingVars(vessel); updateNextLogicTime(vessel); }
private void trackArrival(Part dockedPort) { MissionArrival arrival = new MissionArrival { Time = Planetarium.GetUniversalTime(), Body = vessel.mainBody.name, Orbit = MissionOrbit.GetMissionOrbit(vessel.orbit), flightIDDockPart = dockedPort.flightID, Crew = (int)trackCrew, CrewCapacity = (int)trackCrewCapacity, Parts = MissionPart.GetMissionPartList(RmmUtil.GetDockedParts(vessel, dockedPort)) }; _mission.TrackArrival(arrival); trackingActive = false; trackingPrimary = false; trackingStatus = "Arrived"; //----------------------- StoreVesselSnapShot("arrival"); _partModule.PortCode = ""; ScreenMessages.PostScreenMessage("mission tracking-ARRIVAL", 4, ScreenMessageStyle.UPPER_CENTER); _partModule.nextLogicTime = 0; updateTrackingVars(vessel); updateNextLogicTime(vessel); }
private void setModule() { if (commercialvehiclemode && commercialvehicleOfferingLoaded) { Events["setAutoDepart"].guiActive = true; } else { Events["setAutoDepart"].guiActive = false; } if ((RmmUtil.IsPreLaunch(vessel) && !trackingActive && IsDockingPort()) || (returnMission && !trackingActive)) { Events["tracking"].guiActive = true; } else { Events["tracking"].guiActive = false; } if (PortCode == "" && vessel.situation == Vessel.Situations.ORBITING && RmmUtil.AllowedBody(vessel.mainBody.name) && IsDockingPort()) { Events["register"].guiActive = true; } else { Events["register"].guiActive = false; } }
private void TrackLanding() { MissionLanding landing = new MissionLanding { Time = Planetarium.GetUniversalTime(), Body = vessel.mainBody.name, Coordinates = MissionCoordinates.GetMissionCoordinates(vessel.latitude, vessel.longitude), Funds = RmmUtil.CalculateVesselPrice(vessel), Crew = (int)trackCrew, CrewCapacity = (int)trackCrewCapacity, Parts = MissionPart.GetMissionPartList(vessel), Resources = MissionResource.GetMissionResourceList(vessel), }; _mission.TrackLanding(landing); trackingPrimary = false; trackingActive = false; trackingStatus = "Landed"; ScreenMessages.PostScreenMessage("mission tracking-LANDING", 4, ScreenMessageStyle.UPPER_CENTER); _partModule.nextLogicTime = 0; updateTrackingVars(vessel); updateNextLogicTime(vessel); }
private void HandleStartTrackingWindow() { if (_startTrackingWindow == null) { return; } if (!WindowManager.IsOpen(_startTrackingWindow)) { CancelStartTracking(); return; } if (_startTrackingVessel != null) { if (RmmUtil.IsTrackingActive(FlightGlobals.ActiveVessel) || !RmmUtil.IsPreLaunch(FlightGlobals.ActiveVessel)) { CancelStartTracking(); return; } _startTrackingWindow.VesselName = _startTrackingVessel.vesselName; _startTrackingWindow.Price = RmmUtil.CalculateVesselPrice(_startTrackingVessel); _startTrackingWindow.MinimumCrew = RmmUtil.AstronautCrewCount(_startTrackingVessel); } else if (_startDockingPort != null) { if (FlightGlobals.ActiveVessel.situation != Vessel.Situations.ORBITING) { CancelStartTracking(); return; } List <Part> dockedVesselParts = RmmUtil.GetDockedParts(_startDockingPort.vessel, _startDockingPort); // determine minimum crew _startTrackingWindow.MinimumCrew = RmmUtil.AstronautCrewCount(dockedVesselParts); // determine minimum resources List <string> propellants = RmmUtil.DetermineProppellantArray(dockedVesselParts); List <Resource> minimumResources = new List <Resource>(); foreach (String propellant in propellants) { var amount = RmmUtil.ReadResource(dockedVesselParts, propellant); if (amount != 0) { Resource resource = new Resource { Name = propellant, Amount = amount, }; minimumResources.Add(resource); } } _startTrackingWindow.MinimumResources = minimumResources; } }
private void updateMaxCrewCount() { int currentCount = RmmUtil.CrewCapacityCount(vessel); if (currentCount < trackCrewCapacity) { trackCrewCapacity = currentCount; } }
private void updatePartCount() { int currentCount = RmmUtil.CountVesselParts(vessel); if (currentCount < trackPartCount) { trackPartCount = currentCount; } }
private void updateCrewCount() { int currentCount = RmmUtil.AstronautCrewCount(vessel); if (currentCount < trackCrew) { trackCrew = currentCount; } }
public override void OnFixedUpdate() { if (!HighLogic.LoadedSceneIsFlight) { return; } if (_nextLogicTime == 0 || _nextLogicTime > Planetarium.GetUniversalTime()) { return; } if (vessel.packed || !vessel.loaded) { _nextLogicTime = Planetarium.GetUniversalTime() + 1; return; } if (vessel.situation == Vessel.Situations.ORBITING && RmmUtil.AllowedBody(vessel.mainBody.name) && _registrationEnabled) { if (!_registrationAllowed) { _registrationAllowed = true; _refreshedRequired = true; } } else { if (_registrationAllowed) { _registrationAllowed = false; _refreshedRequired = true; } } if (vessel.situation == Vessel.Situations.ORBITING && RmmUtil.AllowedBody(vessel.mainBody.name) && _trackingEnabled) { if (!_trackingAllowed) { _trackingAllowed = true; _refreshedRequired = true; } } else { if (_trackingAllowed) { _trackingAllowed = false; _refreshedRequired = true; } } if (_refreshedRequired) { RefreshModule(); } _nextLogicTime = Planetarium.GetUniversalTime() + 10; }
void onToggleOn() { Menu(); // Add docking port modules if (RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name) && FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING) { RmmDockingPortModule.AddToVessel(FlightGlobals.ActiveVessel); } }
public void RoutineDepartureOverview(IWindow parent = null) { _missions = Mission.LoadMissions();; CancelRoutineDepartureOverview(); _routineDepartureOverviewWindow = new RoutineDepartureOverviewWindow(this); WindowManager.Open(_routineDepartureOverviewWindow, parent: parent); List <RoutineDepartureMission> routineDepartureMissions = new List <RoutineDepartureMission>(); foreach (Mission mission in _missions) { if (mission.Info == null) { continue; } if (mission.Info.Type != 20) { continue; } var locationRoutineDepartureMission = RoutineMission.AssemblePotentialRoutineMission <RoutineDepartureMission>(mission); if (locationRoutineDepartureMission == null) { continue; } if (!locationRoutineDepartureMission.AllowedLocation(FlightGlobals.ActiveVessel).CheckSucces) { continue; } foreach (Part part in FlightGlobals.ActiveVessel.parts) { string name = RmmScenario.Instance.GetRegisteredDockingPort(part.flightID); if (!String.IsNullOrEmpty(name)) { Part dockedPart = RmmUtil.GetDockedPart(FlightGlobals.ActiveVessel, part); if (dockedPart != null) { var routineDepartureMission = RoutineMission.AssemblePotentialRoutineMission <RoutineDepartureMission>(mission); routineDepartureMission.flightIdDepartureDockPart = part.flightID; var check = routineDepartureMission.AllowedVessel(FlightGlobals.ActiveVessel); if (!routineDepartureMission.AllowedVessel(FlightGlobals.ActiveVessel).CheckSucces) { continue; } routineDepartureMissions.Add(routineDepartureMission); } } } } _routineDepartureOverviewWindow.RoutineDepartureMissions = routineDepartureMissions; }
public void RegisterDockingPortsOption() { if (!RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name)) { return; } if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING) { EnableDockingPortRegistration(); } }
public void RoutineDepartureOption() { if (!RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name)) { return; } if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING) { _routineControl.RoutineDepartureOverview(_menuWindow); } }
public static StructurePart GetStructurePart(Part part, Part root) { StructurePart structurePart = new StructurePart { Id = part.flightID, Name = part.name, LinkCount = RmmUtil.GetLinkedParts(part).Count, Position = root.transform.InverseTransformPoint(part.transform.position) }; return(structurePart); }
private bool ToolBarButtonVisible() { if (RmmUtil.IsPreLaunch(FlightGlobals.ActiveVessel) || (FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING && RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name) && RmmUtil.HasDockingPorts(FlightGlobals.ActiveVessel)) || RmmUtil.IsTrackingActive(FlightGlobals.ActiveVessel)) { return(true); } return(false); }
//private void createMissionFile() //{ // string[] data = new string[16]; // // data[0] = "Name=" + trackName; // data[1] = "CompanyName=" + trackCompanyName; // data[2] = "VehicleName=" + trackVehicleName; // data[3] = "LaunchSystemName=" + trackLaunchSystemName; // data[4] = "Price=" + trackPrice.ToString(); // data[6] = "Time=" + trackMissionTime.ToString(); // data[7] = "Body=" + trackBody; // data[8] = "MaxOrbitAltitude=" + trackMaxOrbitAltitude.ToString(); // data[9] = "MinimumCrew=" + trackMinimumCrew.ToString(); // data[10] = "MaximumCrew=" + trackMaximumCrew.ToString(); // data[11] = "ReturnEnabled=" + trackReturnEnabled.ToString(); // data[12] = "SafeReturn=" + trackSafeReturn.ToString(); // data[13] = "ReturnResources=" + trackReturnResources; // data[14] = "ReturnCargoMass=" + trackReturnCargoMass.ToString(); // data[15] = "DockingDistance=0.15"; // data[16] = "MinimumReturnCrew=" + trackMinimumReturnCrew.ToString(); // data[17] = "CrewBalance=" + trackCrewBalance.ToString(); // // System.IO.File.WriteAllLines(RmmUtil.GamePath + RmmUtil.CommercialOfferingsPath + "Missions" + Path.DirectorySeparatorChar + trackFolderName + Path.DirectorySeparatorChar + "mission.txt", data); // //} private void createLandingFile() { string[] data = new string[6]; data[0] = "ReturnLanding=" + returnMission.ToString(); data[1] = "FlightID=" + part.flightID; data[2] = "LandingPrice=" + CalculateVesselPrice(false); data[3] = "LandingCrew=" + RmmUtil.AstronautCrewCount(vessel); data[4] = "MaximumLandingCrew=" + RmmUtil.AstronautCrewCount(vessel); data[5] = "ReturnCargoMass=" + trackReturnCargoMass.ToString(); System.IO.File.WriteAllLines(RmmUtil.GamePath + RmmUtil.CommercialOfferingsPath + "Missions" + Path.DirectorySeparatorChar + trackFolderName + Path.DirectorySeparatorChar + "landing.txt", data); }
private void HandleRoutineDepartureDetailWindow() { if (_routineDepartureDetailWindow == null) { return; } if (!WindowManager.IsOpen(_routineDepartureDetailWindow)) { CancelRoutineDepartureDetail(); return; } _routineDepartureDetailWindow.CrewCount = RmmUtil.CrewCount(_routineDepartureDetailWindow.DepartureParts); List <RoutineDepartureDetailWindow.ResourceItem> resources = new List <RoutineDepartureDetailWindow.ResourceItem>(); foreach (String proppelant in _routineDepartureDetailWindow.RoutineDepartureMission.Proppelants) { foreach (MissionResource missionResource in _routineDepartureDetailWindow.RoutineDepartureMission.Resources) { if (missionResource.Name == proppelant) { RoutineDepartureDetailWindow.ResourceItem resourceItem = new RoutineDepartureDetailWindow.ResourceItem { Name = missionResource.Name, RequiredAmount = missionResource.Amount, CurrentAmount = RmmUtil.ReadResource(_routineDepartureDetailWindow.DepartureParts, missionResource.Name), }; resources.Add(resourceItem); } } } _routineDepartureDetailWindow.Resources = resources; double currentVesselCargoMass = 0; double currentVesselCargoFunds = 0; List <MissionResource> vesselResources = MissionResource.GetMissionResourceList(_routineDepartureDetailWindow.DepartureParts); foreach (MissionResource vesselResource in vesselResources) { if (_routineDepartureDetailWindow.RoutineDepartureMission.Proppelants.Contains(vesselResource.Name)) { continue; } currentVesselCargoMass += RmmUtil.Mass(vesselResource.Name, vesselResource.Amount); currentVesselCargoFunds += RmmUtil.Cost(vesselResource.Name, vesselResource.Amount); } _routineDepartureDetailWindow.CurrentCargoMass = currentVesselCargoMass; _routineDepartureDetailWindow.CurrentCargoFunds = currentVesselCargoFunds; }
public void StartTracking(string name) { Tracking tracking = null; if (_startTrackingVessel != null) { foreach (Part part in _startTrackingVessel.parts) { var trackingModule = part.Modules.OfType <RMMModule>().FirstOrDefault(); if (trackingModule != null) { tracking = trackingModule.TrackingModule; break; } } } if (_startDockingPort != null) { List <Part> dockedVesselParts = RmmUtil.GetDockedParts(_startDockingPort.vessel, _startDockingPort); foreach (Part part in dockedVesselParts) { var trackingModule = part.Modules.OfType <RMMModule>().FirstOrDefault(); if (trackingModule != null) { tracking = trackingModule.TrackingModule; break; } } } if (tracking == null) { LoggerRmm.Warning("no tracking module on vessel"); return; } if (_startTrackingVessel != null) { tracking.StartLaunchMission(name); } if (_startDockingPort != null) { tracking.StartDepartMission(name, _startDockingPort); } CancelStartTracking(); }
private void HandleRoutineDepartures() { if (!HighLogic.LoadedSceneIsFlight) { return; } if (FlightGlobals.ActiveVessel.packed || !FlightGlobals.ActiveVessel.loaded) { return; } if (_departureWorker == null) { foreach (RoutineDepartureMission mission in _routineDepartureMissions) { // Departures are executed immdediatly so remove mission which are more then 30 seconds old. if (mission.DepartureTime < Planetarium.GetUniversalTime() - 30) { RmmScenario.Instance.SetOrderedMission(mission.OrderId, null, 0, null); _routineDepartureMissions = null; _departureWorker = null; } if (mission.DepartureTime < Planetarium.GetUniversalTime() && RmmUtil.PartExistsInVessel(FlightGlobals.ActiveVessel, mission.flightIdDepartureDockPart) && mission.Allowed(FlightGlobals.ActiveVessel).CheckSucces) { _departureWorker = new DepartureWorker(); _departureWorker.StartDeparture(mission, FlightGlobals.ActiveVessel); } } } else { if (_departureWorker.CompleteDeparture) { _departureWorker.HandleDepartureCompletion(); return; } else { RmmScenario.Instance.SetOrderedMission(_departureWorker.Mission.OrderId, null, 0, null); _routineDepartureMissions = null; _departureWorker = null; } } }
public void OpenGUITracking() { if (RmmUtil.IsPreLaunch(vessel) && !trackingActive) { trackStrName = vessel.vesselName; trackStrVehicleName = vessel.vesselName; SetThisPortPrimary(); } if (returnMission && !trackingActive) { SetThisPortPrimary(); } renderGUITracking = true; }
public CheckList AllowedLocation(Vessel vessel) { var checkList = new CheckList(); checkList.Check(Valid(), "invalid mission departure mission"); if (!checkList.CheckSucces) { return(checkList); } checkList.Check(vessel.situation == Vessel.Situations.ORBITING, "vessel not in orbit"); checkList.Check(vessel.mainBody.name == _mission.Departure.Body, "vessel not at " + _mission.Departure.Body); checkList.Check(!RmmUtil.HomeBody(_mission.Departure.Body) || vessel.orbit.semiMajorAxis < _mission.Departure.Orbit.semiMajorAxis * 1.3, "vessel orbit too high"); return(checkList); }
public void StartTrackingOption() { if (!RmmUtil.AllowedBody(FlightGlobals.ActiveVessel.mainBody.name)) { return; } if (!RmmUtil.IsTrackingActive(FlightGlobals.ActiveVessel) && RmmUtil.IsPreLaunch(FlightGlobals.ActiveVessel)) { _trackingControl.CreateLaunchTracking(FlightGlobals.ActiveVessel); } if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.ORBITING) { EnableDepartureTracking(); } }
public static float CalculateVesselPrice(Vessel vessel) { double price = 0.0f; //cost parts foreach (Part part in vessel.parts) { double missingResCost = 0; foreach (PartResource r in part.Resources) { missingResCost = missingResCost + RmmUtil.Cost(r.info.name, (r.maxAmount - r.amount)); } price = price + (part.partInfo.cost - missingResCost + part.GetModuleCosts(0)); } return((float)price); }
private void HandleRoutineArrivals() { if (!HighLogic.LoadedSceneIsFlight) { return; } if (FlightGlobals.ActiveVessel.packed || !FlightGlobals.ActiveVessel.loaded) { return; } if (_arrivalWorker == null) { foreach (RoutineArrivalMission mission in _routineArrivalMissions) { if (mission.ArrivalTime < Planetarium.GetUniversalTime() && RmmUtil.PartExistsInVessel(FlightGlobals.ActiveVessel, mission.flightIdArrivalDockPart) && mission.Allowed(FlightGlobals.ActiveVessel).CheckSucces) { if (!SkyClear(FlightGlobals.ActiveVessel)) { mission.ArrivalTime += 600; ScreenMessages.PostScreenMessage("mission " + mission.Name + " delayed-LOCAL TRAFFIC", 4, ScreenMessageStyle.UPPER_CENTER); continue; } _arrivalWorker = new ArrivalWorker(); _arrivalWorker.StartArrival(mission, FlightGlobals.ActiveVessel); } } } else { if (_arrivalWorker.CompleteArrival) { _arrivalWorker.HandleArrivalCompletion(); return; } else { RmmScenario.Instance.SetOrderedMission(_arrivalWorker.Mission.OrderId, null, 0, null); _routineArrivalMissions = null; _arrivalWorker = null; } } }
/// <summary> /// GUI Tracking /// </summary> /// <param name="windowID"></param> private void WindowGUITracking(int windowID) { GUI.DragWindow(new Rect(0, 0, 200, 30)); GUILayout.BeginVertical(); if (!trackingActive && RmmUtil.IsPreLaunch(vessel)) { if (trackWinMode != 0) { windowPosGUITracking = new Rect(200, 200, 300, 100); trackWinMode = 0; } createMissionForm(); } else if (trackingActive) { if (trackWinMode != 1) { windowPosGUITracking = new Rect(0, 400, 200, 50); trackWinMode = 1; } GUILayout.BeginHorizontal(); GUILayout.Label("tracking", RmmStyle.Instance.LabelStyle, GUILayout.Width(60)); if (GUILayout.Button("stop tracking", RmmStyle.Instance.ButtonStyle, GUILayout.Width(100), GUILayout.Height(22))) { trackAbort(); } GUILayout.EndHorizontal(); } else if (returnMission && !trackingActive && RmmUtil.IsDocked(vessel, part)) { if (trackWinMode != 2) { windowPosGUITracking = new Rect(200, 200, 300, 50); trackWinMode = 2; } returnMissionForm(); } else { CloseGUITracking(); } GUILayout.EndVertical(); }