コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        public void Start()
        {
            if (HighLogic.LoadedScene == GameScenes.MAINMENU)
            {
                //only do it on the first entry to the menu
                if (first)
                {
                    first = false;

                    var windowPtr = FindWindow(null, "Kerbal Space Program");
                    if (windowPtr != null)
                    {
                        // this is handy to have AutoSizer or similar program correctly set the window position when launching
                        SetWindowText(windowPtr, "KSP - Trajectories Debug");
                    }

                    HighLogic.SaveFolder = "default";
                    HighLogic.LoadScene(GameScenes.SPACECENTER);

                    // When debugging, we are dirty cheating alpacas.
                    CheatOptions.InfiniteElectricity  = true;
                    CheatOptions.InfinitePropellant   = true;
                    CheatOptions.IgnoreMaxTemperature = true;
                }
            }
        }
コード例 #3
0
ファイル: WalkAbout.cs プロジェクト: linuxgurugamer/WalkAbout
 private void PerformPostPlacementAction()
 {
     if (HighLogic.CurrentGame.Parameters.CustomParams <WA>().noreload)
     {
         "Suppressed reload of SPACECENTER".Log();
     }
     if (HighLogic.CurrentGame.Parameters.CustomParams <WA>().jumpto)
     {
         var vessel = FindVesselByName(_mainGui.RequestedPlacement.Kerbal.name);
         if (vessel == null)
         {
             $"Unable to jump to vessel - no vessel found".Log();
         }
         else
         {
             $"Loading Flight scene for {vessel.name}".Log();
             FlightDriver.StartAndFocusVessel("persistent", FlightGlobals.Vessels.IndexOf(vessel));
         }
     }
     if (HighLogic.CurrentGame.Parameters.CustomParams <WA>().reload ||
         (!HighLogic.CurrentGame.Parameters.CustomParams <WA>().jumpto&& !HighLogic.CurrentGame.Parameters.CustomParams <WA>().noreload))
     {
         "Reloading SPACECENTER".Log();
         HighLogic.LoadScene(GameScenes.SPACECENTER);
     }
 }
コード例 #4
0
        private void OffsetGizmoSpawned(EditorGizmos.GizmoOffset data)
        {
            GizmoEvents.rotateGizmoActive = false;
            GizmoEvents.offsetGizmoActive = true;
            GizmoEvents.gizmosOffset      = HighLogic.FindObjectsOfType <EditorGizmos.GizmoOffset> ();
            GizmoEvents.gizmoOffsetHandle = HighLogic.FindObjectOfType <EditorGizmos.GizmoOffsetHandle> ();

            if (EditorLogic.SelectedPart != null)
            {
                Space sp = GizmoEvents.gizmosOffset[0].CoordSpace;
                Log.dbg("gizmoOffset == null, EditorLogic.SelectedPart: {0}", EditorLogic.SelectedPart.partInfo.title);
                Log.dbg("coordSpace: {0}", sp);

                if (GizmoEvents.gizmosOffset[0].CoordSpace == Space.Self)
                {
                    GizmoEvents.gizmosOffset[0].transform.rotation = EditorLogic.SelectedPart.transform.rotation;
                }
                else
                {
                    GizmoEvents.gizmosOffset[0].transform.rotation = Quaternion.identity;
                }
            }

            Log.dbg("Offset gizmo was spawned 2");
        }
コード例 #5
0
        private static void UpdateEditorGizmo(Part part)
        {
            if (part == EditorLogic.SelectedPart)
            {
                var gizmoOffset = HighLogic.FindObjectOfType <EditorGizmos.GizmoOffset>();
                if (gizmoOffset != null)
                {
                    gizmoOffset.transform.position = part.transform.position;
                    if (gizmoOffset.CoordSpace == Space.Self)
                    {
                        gizmoOffset.transform.rotation = part.transform.rotation;
                    }
                }

                var gizmoRotate = HighLogic.FindObjectOfType <EditorGizmos.GizmoRotate>();
                if (gizmoRotate != null)
                {
                    gizmoRotate.transform.position = part.transform.position;
                    if (gizmoRotate.CoordSpace == Space.Self)
                    {
                        gizmoRotate.transform.rotation = part.transform.rotation;
                    }
                }
            }
        }
コード例 #6
0
        public void RemoveVessel(Guid vesselId, bool isDockingUpdate, string dockingPlayer)
        {
            var vessel = FlightGlobals.Vessels.FirstOrDefault(v => v.id == vesselId);

            if (vessel == null)
            {
                return;
            }

            if (isDockingUpdate)
            {
                if (FlightGlobals.ActiveVessel?.id == vessel.id)
                {
                    var dockingPlayerVessel = FlightGlobals.Vessels
                                              .FirstOrDefault(v => LockSystem.Singleton.LockOwner("control-" + v.id) == dockingPlayer);

                    if (dockingPlayerVessel != null)
                    {
                        FlightGlobals.ForceSetActiveVessel(dockingPlayerVessel);
                    }
                    else
                    {
                        HighLogic.LoadScene(GameScenes.TRACKSTATION);
                        ScreenMessages.PostScreenMessage("Kicked to tracking station, a player docked with you but they were not loaded into the game.");
                    }
                }
                Debug.Log($"[LMP]: Removing docked vessel: {vesselId}");
                System.KillVessel(vessel, true);
            }
            else
            {
                Debug.Log($"[LMP]: Removing vessel: {vesselId}");
                System.KillVessel(vessel, true);
            }
        }
コード例 #7
0
        internal void SpaceCenterAction()
        {
            switch (facType)
            {
            case KKFacilityType.Barracks:
                var acPrefab = FindObjectOfType <ACSceneSpawner>();
                UIMasterController.Instance.AddCanvas(acPrefab.ACScreenPrefab, true);
                break;

            case KKFacilityType.Business:
                if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
                {
                    var adminPrefab = FindObjectOfType <AdministrationSceneSpawner>();
                    UIMasterController.Instance.AddCanvas(adminPrefab.AdministrationScreenPrefab, true);
                }
                break;

            case KKFacilityType.Research:
                if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
                {
                    var researchPrefab = FindObjectOfType <RDSceneSpawner>();
                    UIMasterController.Instance.AddCanvas(researchPrefab.RDScreenPrefab, true);
                }
                break;

            case KKFacilityType.GroundStation:
                HighLogic.LoadScene(GameScenes.TRACKSTATION);
                break;
            }
        }
コード例 #8
0
 //        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();
 }
コード例 #9
0
        private static bool PrefixSetStartupNewVessel()
        {
            if (MainSystem.NetworkState < ClientState.Connected || string.IsNullOrEmpty(FlightDriver.newShipToLoadPath))
            {
                return(true);
            }

            var configNode = ConfigNode.Load(FlightDriver.newShipToLoadPath);
            var shipName   = configNode.GetValue("ship");
            var partNames  = configNode.GetNodes("PART").Select(n => n.GetValue("part").Substring(0, n.GetValue("part").IndexOf('_'))).ToList();
            var partCount  = configNode.GetNodes("PART").Count();

            if (ModSystem.Singleton.ModControl)
            {
                var bannedParts = ModSystem.Singleton.GetBannedPartsFromPartNames(partNames.Distinct()).ToArray();
                if (bannedParts.Any())
                {
                    LunaLog.LogError($"Vessel {shipName} Contains the following banned parts: {string.Join(", ", bannedParts)}");
                    BannedPartsWindow.Singleton.DisplayBannedPartsDialog(shipName, bannedParts);
                    HighLogic.LoadScene(GameScenes.SPACECENTER);
                    return(false);
                }
            }

            if (partCount > SettingsSystem.ServerSettings.MaxVesselParts)
            {
                LunaLog.LogError($"Vessel {shipName} has {partCount} parts and the max allowed in the server is: {SettingsSystem.ServerSettings.MaxVesselParts}");
                BannedPartsWindow.Singleton.DisplayBannedPartsDialog(shipName, partCount);
                HighLogic.LoadScene(GameScenes.SPACECENTER);
                return(false);
            }

            return(true);
        }
コード例 #10
0
        private static void SwitchVesselIfSpectating(Vessel killVessel)
        {
            if (FlightGlobals.ActiveVessel?.id == killVessel.id)
            {
                //Try to switch to a nearby loaded vessel...
                var otherVessel = FlightGlobals.VesselsLoaded.FirstOrDefault(v => v.id != killVessel.id);

                //No nearby vessel detected... Get a random vessel and switch to it if exists, otherwise go to spacecenter
                if (otherVessel == null)
                {
                    otherVessel = FlightGlobals.Vessels.FirstOrDefault(v => v.id != killVessel.id);
                }

                if (otherVessel != null)
                {
                    FlightGlobals.ForceSetActiveVessel(otherVessel);
                }
                else
                {
                    HighLogic.LoadScene(GameScenes.SPACECENTER);
                }

                LunaScreenMsg.PostScreenMessage(LocalizationContainer.ScreenText.SpectatingRemoved, 10f, ScreenMessageStyle.UPPER_CENTER);
            }
        }
コード例 #11
0
 public GuiRenderer(GuiManager manager)
 {
     this.guiManager         = manager;
     GuiRenderer.windowStyle = new GUIStyle(HighLogic.get_Skin().get_window());
     GuiRenderer.tabStyle    = new GUIStyle(HighLogic.get_Skin().get_window());
     this.planetShine        = PlanetShine.PlanetShine.Instance;
 }
コード例 #12
0
        public void Start()
        {
            //only do it on the first entry to the menu
            if (first)
            {
                first = false;
                HighLogic.SaveFolder = "default";
                Game game = GamePersistence.LoadGame("persistent", HighLogic.SaveFolder, true, false);

                if (game != null && game.flightState != null && game.compatible)
                {
                    HighLogic.CurrentGame = game;
                    HighLogic.LoadScene(GameScenes.SPACECENTER);

                    //Int32 FirstVessel;
                    //Boolean blnFoundVessel = false;
                    //for (FirstVessel = 0; FirstVessel < game.flightState.protoVessels.Count; FirstVessel++)
                    //{
                    //    if (game.flightState.protoVessels[FirstVessel].vesselType != VesselType.SpaceObject &&
                    //        game.flightState.protoVessels[FirstVessel].vesselType != VesselType.Unknown)
                    //    {
                    //        blnFoundVessel = true;
                    //        break;
                    //    }
                    //}
                    //if (!blnFoundVessel)
                    //    FirstVessel = 0;
                    //FlightDriver.StartAndFocusVessel(game, FirstVessel);
                }

                //CheatOptions.InfiniteFuel = true;
            }
        }
コード例 #13
0
ファイル: Handler.cs プロジェクト: Kerbas-ad-astra/AnyRes
        void GUIActive(int windowID)
        {
            if (HighLogic.LoadedScene == GameScenes.SETTINGS)
            {
                GUI.BringWindowToFront(09271);
            }
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Width: ");
            xString = GUILayout.TextField(xString);
            xString = Regex.Replace(xString, @"[^0-9]", "");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Height: ");
            yString = GUILayout.TextField(yString);
            yString = Regex.Replace(yString, @"[^0-9]", "");
            GUILayout.EndHorizontal();
            fullScreen  = GUILayout.Toggle(fullScreen, "Fullscreen");
            reloadScene = GUILayout.Toggle(reloadScene, "Reload scene");
            if (GUILayout.Button("Set Screen Resolution"))
            {
                if (xString != null && yString != null)
                {
                    x = Convert.ToInt32(xString);
                    y = Convert.ToInt32(yString);

                    if (x > 0 && y > 0)
                    {
                        GameSettings.SCREEN_RESOLUTION_HEIGHT = y;
                        GameSettings.SCREEN_RESOLUTION_WIDTH  = x;
                        GameSettings.FULLSCREEN = fullScreen;
                        GameSettings.SaveSettings();
                        Screen.SetResolution(x, y, fullScreen);
                        if (reloadScene)
                        {
                            if (HighLogic.LoadedScene != GameScenes.LOADING)
                            {
                                HighLogic.LoadScene(HighLogic.LoadedScene);
                            }
                            else
                            {
                                ScreenMessages.PostScreenMessage("You cannot reload the scene while loading the game!", 1);
                            }
                        }
                    }
                    else
                    {
                        ScreenMessages.PostScreenMessage("One or both of your values is too small.  Please enter a valid value.", 1, ScreenMessageStyle.UPPER_CENTER);
                    }
                }
                else
                {
                    ScreenMessages.PostScreenMessage("The values you have set are invalid.  Please set a valid value.", 1, ScreenMessageStyle.UPPER_CENTER);
                }
            }
            GUILayout.EndVertical();

            GUI.DragWindow();
        }
コード例 #14
0
 private void RotateGizmoSpawned(EditorGizmos.GizmoRotate data)
 {
     GizmoEvents.rotateGizmoActive = true;
     GizmoEvents.offsetGizmoActive = false;
     GizmoEvents.gizmosRotate      = HighLogic.FindObjectsOfType <EditorGizmos.GizmoRotate> ();
     GizmoEvents.gizmoRotateHandle = HighLogic.FindObjectOfType <EditorGizmos.GizmoRotateHandle> ();
     Log.dbg("Rotate gizmo was spawned 2");
 }
コード例 #15
0
 private void OffsetGizmoSpawned(EditorGizmos.GizmoOffset data)
 {
     GizmoEvents.rotateGizmoActive = false;
     GizmoEvents.offsetGizmoActive = true;
     GizmoEvents.gizmosOffset      = HighLogic.FindObjectsOfType <EditorGizmos.GizmoOffset> ();
     GizmoEvents.gizmoOffsetHandle = HighLogic.FindObjectOfType <EditorGizmos.GizmoOffsetHandle> ();
     Log.Info("Offset gizmo was spawned");
 }
コード例 #16
0
 /// <summary>
 /// Implementation of <see cref="MonoBehaviour"/>.Start
 /// </summary>
 void Start()
 {
     // Hook into the ScenarioModule for Orbital Logistics
     if (_scenario == null)
     {
         _scenario = HighLogic.FindObjectOfType <ScenarioOrbitalLogistics>();
     }
 }
コード例 #17
0
 void Start()
 {
     // Hook into the ScenarioModule
     if (_scenario == null)
     {
         _scenario = HighLogic.FindObjectOfType <KonstructionScenario>();
     }
 }
コード例 #18
0
        void mainMenuWindow(int windowID)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(TradingButton, HighLogic.Skin.button))
            {
                trading.checkPrice(vessel.orbit.referenceBody.name, vessel.orbit.semiMajorAxis);
                menuWindow            = false;
                trading.DrawGUIWindow = true;
            }
            if (GUILayout.Button(CrewHireButton, HighLogic.Skin.button))
            {
                menuWindow = false;
                crewHire.GenerateCrew();
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(AsteroidButton, HighLogic.Skin.button))
            {
                menuWindow           = false;
                asteroid.asteroidGUI = true;
            }

            if (GUILayout.Button(ShipShopButton, HighLogic.Skin.button))
            {
                menuWindow          = false;
                shipShop.MenuWindow = true;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(ExplorationButton, HighLogic.Skin.button))
            {
                menuWindow             = false;
                exploration.infoWindow = true;
            }
            if (GUILayout.Button(Contract, HighLogic.Skin.button))
            {
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.BACKUP);
                HighLogic.LoadScene(GameScenes.SPACECENTER);
                menuWindow = false;
            }
            if (part.partInfo.name == "pirateStationScreen")
            {
                if (GUILayout.Button(SlaveTrafficButton, HighLogic.Skin.button))
                {
                    slavesTraffic.CheckPrice(vessel.mainBody.name);
                    menuWindow = false;
                    slavesTraffic.slaveWindow = true;
                }
            }
            GUILayout.EndHorizontal();
            if (GUILayout.Button("close", HighLogic.Skin.button))
            {
                menuWindow = false;
            }
            GUILayout.EndVertical();
        }
コード例 #19
0
 private void StopGame()
 {
     HighLogic.SaveFolder = "DarkMultiPlayer";
     GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
     if (HighLogic.LoadedScene != GameScenes.MAINMENU)
     {
         HighLogic.LoadScene(GameScenes.MAINMENU);
     }
 }
コード例 #20
0
 private void StopGame()
 {
     HighLogic.SaveFolder = "DarkMultiPlayer";
     if (HighLogic.LoadedScene != GameScenes.MAINMENU)
     {
         HighLogic.LoadScene(GameScenes.MAINMENU);
     }
     HighLogic.CurrentGame = null;
 }
コード例 #21
0
        // static functions, that make live a lot easier

        /// <summary>
        /// Stores a Vessel into the specified Hangar
        /// </summary>
        internal static void StoreVessel(Vessel vessel, Hangar hangar)
        {
            StoredVessel storedVessel = new StoredVessel
            {
                uuid       = vessel.protoVessel.vesselID,
                vesselName = vessel.GetDisplayName()
            };

            //get the experience and assign the crew to the rooster
            foreach (Part part in vessel.parts)
            {
                int count = part.protoModuleCrew.Count;

                if (count != 0)
                {
                    ProtoCrewMember[] crewList = part.protoModuleCrew.ToArray();

                    for (int i = 0; i < count; i++)
                    {
                        crewList[i].flightLog.AddEntryUnique(FlightLog.EntryType.Recover);
                        crewList[i].flightLog.AddEntryUnique(FlightLog.EntryType.Land, FlightGlobals.currentMainBody.name);
                        crewList[i].ArchiveFlightLog();

                        // remove the crew from the ship
                        part.RemoveCrewmember(crewList[i]);
                    }
                }
            }


            // save the ship
            storedVessel.vesselNode = new ConfigNode("VESSEL");

            //create a backup of the current state, then save that state
            ProtoVessel backup = vessel.BackupVessel();

            backup.Save(storedVessel.vesselNode);

            // save the stored information in the hangar
            hangar.storedVessels.Add(storedVessel);

            // remove the stored vessel from the game
            vessel.MakeInactive();
            vessel.Unload();
            //vessel.Die();

            FlightGlobals.RemoveVessel(vessel);
            if (vessel != null)
            {
                vessel.protoVessel.Clean();
            }

            //UnityEngine.Object.Destroy(vessel.gameObject);

            GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            HighLogic.LoadScene(GameScenes.SPACECENTER);
        }
コード例 #22
0
ファイル: Main.cs プロジェクト: SuumCW/DarkMultiPlayer
 private void OnApplicationQuit()
 {
     if (dmpGame != null && dmpGame.networkWorker.state == ClientState.RUNNING)
     {
         Application.CancelQuit();
         dmpGame.scenarioWorker.SendScenarioModules(true);
         HighLogic.LoadScene(GameScenes.MAINMENU);
     }
 }
コード例 #23
0
ファイル: Main.cs プロジェクト: Naphtaline/DarkMultiPlayer
 private void OnApplicationQuit()
 {
     if (gameRunning && NetworkWorker.fetch.state == ClientState.RUNNING)
     {
         Application.CancelQuit();
         ScenarioWorker.fetch.SendScenarioModules(true);
         HighLogic.LoadScene(GameScenes.MAINMENU);
     }
 }
コード例 #24
0
ファイル: MainSystem.cs プロジェクト: thempc/LunaMultiPlayer
 private void StopGame()
 {
     HighLogic.SaveFolder = "LunaMultiPlayer";
     if (HighLogic.LoadedScene != GameScenes.MAINMENU)
     {
         HighLogic.LoadScene(GameScenes.MAINMENU);
     }
     //HighLogic.CurrentGame = null; This is no bueno
     BodiesGees.Clear();
 }
コード例 #25
0
 private bool WantsToQuit()
 {
     if (dmpGame != null && dmpGame.networkWorker.state == ClientState.RUNNING)
     {
         dmpGame.scenarioWorker.SendScenarioModules(true);
         HighLogic.LoadScene(GameScenes.MAINMENU);
         return(false);
     }
     return(true);
 }
コード例 #26
0
 public void FixedUpdate()
 {
     if (first)
     {
         first = false;
         HighLogic.SaveFolder = "default";
         var game = GamePersistence.LoadGame("persistent", HighLogic.SaveFolder, true, false);
         if (game != null && game.flightState != null && game.compatible)
         {
             HighLogic.LoadScene(GameScenes.TRACKSTATION);
         }
     }
 }
コード例 #27
0
ファイル: KUniverseValue.cs プロジェクト: zad-sixstrings/KOS
 private void LoadGame(string name)
 {
     if (name.EndsWith(".sfs"))
     {
         name = name.Substring(0, name.Length - 4);
     }
     if (HighLogic.CurrentGame.Parameters.Flight.CanQuickLoad)
     {
         string filename = name + ".sfs";
         string path     = KSPUtil.GetOrCreatePath("saves/" + HighLogic.SaveFolder);
         if (!File.Exists(Path.Combine(path, filename)))
         {
             throw new KOSException("Error loading the quicksave file, the save file does not exist.");
         }
         shared.Cpu.GetCurrentOpcode().AbortProgram = true;
         try
         {
             SaveGame("kos-backup-quicksave");
             var game = GamePersistence.LoadGame(name, HighLogic.SaveFolder, true, false);
             if (game.flightState != null)
             {
                 if (game.compatible)
                 {
                     GamePersistence.UpdateScenarioModules(game);
                     if (game.startScene != GameScenes.FLIGHT)
                     {
                         if (KSPUtil.CheckVersion(game.file_version_major, game.file_version_minor, game.file_version_revision, 0, 24, 0) != VersionCompareResult.INCOMPATIBLE_TOO_EARLY)
                         {
                             GamePersistence.SaveGame(game, name, HighLogic.SaveFolder, SaveMode.OVERWRITE);
                             HighLogic.LoadScene(GameScenes.SPACECENTER);
                             return;
                         }
                     }
                     FlightDriver.StartAndFocusVessel(game, game.flightState.activeVesselIdx);
                 }
             }
         }
         catch (Exception ex)
         {
             SafeHouse.Logger.Log(ex.Message);
             throw new KOSException("Error loading the quicksave file");
         }
     }
     else
     {
         throw new KOSException("KSP prevents using quickload currently.");
     }
 }
コード例 #28
0
ファイル: OrX_Log.cs プロジェクト: net-lisias-ksph/OrX-LBC
 public void GameOver()
 {
     ironKerbal = false;
     OrX_Controls.instance.DisableGuiOrXControl();
     if (win)
     {
         ScreenMsg("<color=#cc4500ff><b>MISSION COMPLETE</b></color>");
         // PLAY WINNING SOUNDS
     }
     else
     {
         ScreenMsg("<color=#cc4500ff><b>YOU DIED .... GAME OVER</b></color>");
         HighLogic.bufferedLoad(5, false);
         // PLAY FAILURE SOUNDS
     }
 }
コード例 #29
0
        private static void SwitchVesselIfSpectating(Vessel killVessel)
        {
            if (VesselCommon.IsSpectating && FlightGlobals.ActiveVessel.id == killVessel.id)
            {
                var otherVessels = FlightGlobals.Vessels.Where(v => v.id != killVessel.id).ToArray();

                if (otherVessels.Any())
                {
                    FlightGlobals.ForceSetActiveVessel(otherVessels.First());
                }
                else
                {
                    HighLogic.LoadScene(GameScenes.SPACECENTER);
                }

                ScreenMessages.PostScreenMessage("The player you were spectating removed his vessel");
            }
        }
コード例 #30
0
        private static void SwitchVesselIfSpectating(Vessel killVessel)
        {
            if (FlightGlobals.ActiveVessel?.id == killVessel.id)
            {
                //Get a random vessel and switch to it if exists, otherwise go to spacecenter
                var otherVessel = FlightGlobals.Vessels.FirstOrDefault(v => v.id != killVessel.id);

                if (otherVessel != null)
                {
                    FlightGlobals.ForceSetActiveVessel(otherVessel);
                }
                else
                {
                    HighLogic.LoadScene(GameScenes.SPACECENTER);
                }

                ScreenMessages.PostScreenMessage("The vessel you were spectating was removed", 10f);
            }
        }