void menuWindow(int windowID) { GUILayout.BeginVertical(); if (GUILayout.Button("buy a new ship", HighLogic.Skin.button)) { craftBrowser = LoadCraftDialog.Create(EditorFacility.VAB, HighLogic.CurrentGame.Title.Split(new string[] { " (" }, StringSplitOptions.None)[0], OnSelected, OnCancelled, false); MenuWindow = false; } if (GUILayout.Button("Sell a ship", HighLogic.Skin.button)) { MenuWindow = false; sellWindow = true; } if (GUILayout.Button("Design a new ship", HighLogic.Skin.button)) { MenuWindow = false; sellWindow = false; aboutWindow = false; GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.BACKUP); EditorDriver.StartEditor(EditorFacility.VAB); } if (GUILayout.Button("close", HighLogic.Skin.button)) { MenuWindow = false; MainMenu.menuWindow = true; } GUILayout.EndVertical(); }
// IEnumerator loadScene(GameScenes scenes, EditorFacility facility = EditorFacility.None) void loadScene(GameScenes scenes, EditorFacility facility = EditorFacility.None) { //yield return new WaitForEndOfFrame (); if (scenes != GameScenes.EDITOR) { HighLogic.LoadScene(scenes); } else if (facility != EditorFacility.None) { EditorFacility editorFacility = EditorFacility.None; if (ShipConstruction.ShipConfig != null) { editorFacility = ShipConstruction.ShipType; } if (HighLogic.LoadedSceneIsFlight && FlightGlobals.fetch) { FlightGlobals.PersistentVesselIds.Clear(); FlightGlobals.PersistentLoadedPartIds.Clear(); FlightGlobals.PersistentUnloadedPartIds.Clear(); } EditorDriver.StartupBehaviour = (editorFacility == facility ? EditorDriver.StartupBehaviours.LOAD_FROM_CACHE : EditorDriver.StartupBehaviours.START_CLEAN); EditorDriver.StartEditor(facility); } InputLockManager.ClearControlLocks(); }
public void Start() { if (autostart) { HighLogic.SaveFolder = save_name; DebugToolbar.toolbarShown = true; if (mode == "editor") { var editor = EditorFacility.VAB; GamePersistence.LoadGame("persistent", HighLogic.SaveFolder, true, false); if (craft_name != null || craft_name != "") { string path = Paths.joined(KSPUtil.ApplicationRootPath, "saves", save_name, "Ships", "VAB", craft_name + ".craft"); EditorDriver.StartAndLoadVessel(path, editor); } else { EditorDriver.StartEditor(editor); } } else if (mode == "spacecenter") { HighLogic.LoadScene(GameScenes.SPACECENTER); } else if (mode == "flight") { FlightDriver.StartAndFocusVessel("quicksave", 1); } } }
public void loadEditor() { //Save the game. GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); // Setup facility EditorDriver.StartupBehaviour = EditorDriver.StartupBehaviours.START_CLEAN; if (loadVAB) { EditorDriver.StartEditor(EditorFacility.VAB); } else { EditorDriver.StartEditor(EditorFacility.SPH); } }
IEnumerator loadScene(GameScenes scenes, EditorFacility facility = EditorFacility.None) { yield return(new WaitForEndOfFrame()); if (scenes != GameScenes.EDITOR) { HighLogic.LoadScene(scenes); } else if (facility != EditorFacility.None) { EditorFacility editorFacility = EditorFacility.None; if (ShipConstruction.ShipConfig != null) { editorFacility = ShipConstruction.ShipType; } EditorDriver.StartupBehaviour = (editorFacility == facility ? EditorDriver.StartupBehaviours.LOAD_FROM_CACHE : EditorDriver.StartupBehaviours.START_CLEAN); EditorDriver.StartEditor(facility); } InputLockManager.ClearControlLocks(); }
void OnMouseDown() { if (HighLogic.LoadedScene == GameScenes.SPACECENTER && !InputLockManager.IsLocked(ControlTypes.KSC_FACILITIES)) { EditorFacility facility; staticInstance.HighlightObject(Color.clear); if (staticInstance.launchSite.LaunchSiteType == SiteType.VAB) { facility = EditorFacility.VAB; } else { facility = EditorFacility.SPH; } EditorDriver.StartupBehaviour = EditorDriver.StartupBehaviours.START_CLEAN; EditorDriver.StartEditor(facility); } }
IEnumerator QStart() { while (!Ready || !QuickStart_Persistent.Ready) { yield return(0); } yield return(new WaitForSecondsRealtime(QSettings.Instance.WaitLoading)); yield return(new WaitForEndOfFrame()); QDebug.Log("SpaceCenter Loaded", "QSpaceCenter"); if (QSettings.Instance.gameScene == (int)GameScenes.FLIGHT) { string _saveGame = GamePersistence.SaveGame(QSaveGame.FILE, HighLogic.SaveFolder, SaveMode.OVERWRITE); if (!string.IsNullOrEmpty(QuickStart_Persistent.vesselID)) { int _idx = HighLogic.CurrentGame.flightState.protoVessels.FindLastIndex(pv => pv.vesselID == QuickStart_Persistent.VesselID); if (_idx != -1) { QDebug.Log(string.Format("StartAndFocusVessel: {0}({1})[{2}] idx: {3}", QSaveGame.vesselName, QSaveGame.vesselType, QuickStart_Persistent.vesselID, _idx), "QSpaceCenter"); FlightDriver.StartAndFocusVessel(_saveGame, _idx); } else { QDebug.Warning("QStart: invalid idx", "QSpaceCenter"); DestroyThis(); } } else { QDebug.Warning("QStart: No vessel found", "QSpaceCenter"); DestroyThis(); } } if (QSettings.Instance.gameScene == (int)GameScenes.TRACKSTATION) { HighLogic.LoadScene(GameScenes.LOADINGBUFFER); HighLogic.LoadScene(GameScenes.TRACKSTATION); InputLockManager.ClearControlLocks(); QDebug.Log("Goto Tracking Station", "QSpaceCenter"); DestroyThis(); } if (QSettings.Instance.gameScene == (int)GameScenes.EDITOR) { if (QSettings.Instance.enableEditorLoadAutoSave && File.Exists(QuickStart_Persistent.shipPath)) { EditorDriver.StartAndLoadVessel(QuickStart_Persistent.shipPath, (EditorFacility)QSettings.Instance.editorFacility); QDebug.Log("StartAndLoadVessel: " + QuickStart_Persistent.shipPath, "QSpaceCenter"); } else { EditorDriver.StartupBehaviour = EditorDriver.StartupBehaviours.START_CLEAN; EditorDriver.StartEditor((EditorFacility)QSettings.Instance.editorFacility); QDebug.Log("StartEditor", "QSpaceCenter"); } InputLockManager.ClearControlLocks(); QDebug.Log("Goto " + (QSettings.Instance.editorFacility == (int)EditorFacility.VAB ? "Vehicle Assembly Building" : "Space Plane Hangar"), "QSpaceCenter"); DestroyThis(); } Destroy(this); yield break; }