private static void SetTargetScene(ProtoScenarioModule psm, GameScenes scene) { if (!psm.targetScenes.Any(s => s == scene)) { psm.targetScenes.Add(scene); } }
public void gameSceneEvent(GameScenes scene) { if (!KCT_GameStates.settings.enabledForSave) return; List<GameScenes> validScenes = new List<GameScenes> { GameScenes.SPACECENTER, GameScenes.TRACKSTATION, GameScenes.SPH, GameScenes.EDITOR }; if (validScenes.Contains(scene)) { //Check for simulation save and load it. if (System.IO.File.Exists(KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder + "/KCT_simulation_backup.sfs")) { KCT_Utilities.LoadSimulationSave(); } } if (!HighLogic.LoadedSceneIsFlight && scene == GameScenes.FLIGHT && KCT_GameStates.flightSimulated) //Backup save at simulation start { KCT_Utilities.MakeSimulationSave(); } if (HighLogic.LoadedScene == scene && (scene == GameScenes.EDITOR || scene == GameScenes.SPH)) //Fix for null reference when using new or load buttons in editor { GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); } if (scene == GameScenes.MAINMENU) { KCT_GameStates.reset(); KCT_GameStates.firstStart = true; KCT_Utilities.disableSimulationLocks(); InputLockManager.RemoveControlLock("KCTLaunchLock"); } }
private void ChangeScene(GameScenes pNewScene) { for (int i = 0; i < Cameras.Count; ++i) { Cameras[i].gameObject.SetActive(false); if (i == (int)pNewScene) { Cameras[i].gameObject.SetActive(true); } } switch (pNewScene) { case GameScenes.LOGO: break; case GameScenes.MAIN_MENU: break; case GameScenes.OPTIONS: break; case GameScenes.CREDITS: break; case GameScenes.GAME: GameObject.Find("GameManager").GetComponent<GameManager>().Initialize(); break; } mCurrentGameScene = pNewScene; }
private void GameSceneLoadRequested(GameScenes scene) { if (scene != GameScenes.MAINMENU) { GameEvents.onGameSceneLoadRequested.Remove(GameSceneLoadRequested); mainMenu.envLogic.GoToStage(0); } }
void OnGameSceneLoadRequested(GameScenes scene) { if (scene == GameScenes.SPACECENTER) { if (Planetarium.GetUniversalTime() > 300) { DefaultSystem(); showGUI = false; } else if (File.Exists(KSPUtil.ApplicationRootPath + "/saves/" + HighLogic.SaveFolder + "/PlanetRandomizer.cfg")) { print("Loading System"); PlanetSettings.Load(KSPUtil.ApplicationRootPath + "/saves/" + HighLogic.SaveFolder + "/PlanetRandomizer.cfg"); RebuildSystem(); } else if (!File.Exists(KSPUtil.ApplicationRootPath + "/saves/" + HighLogic.SaveFolder + "/PlanetRandomizer.cfg")) { DefaultSystem(); print("Showing GUI"); showGUI = true; } } /*if (scene == GameScenes.MAINMENU) { PlanetSettings.Load(KSPUtil.ApplicationRootPath + "/GameData/PlanetRandomizer/Resources/PlanetRandomizer.cfg"); DefaultSystem(); }*/ }
private void removeButton(GameScenes scene) { if (SCANappLauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(SCANappLauncherButton); SCANappLauncherButton = null; } }
public void onGameSceneLoadRequested(GameScenes GameScene) { if (GameScene == GameScenes.MAINMENU) { setIcon(Utilities.getTexture("FPSLimiter", "SmallUtilities/FPSLimiter/Textures")); GameEvents.onGameSceneLoadRequested.Remove(onGameSceneLoadRequested); } }
private void removeButton(GameScenes scene) { if (stockToolbarButton != null) { ApplicationLauncher.Instance.RemoveModApplication(stockToolbarButton); stockToolbarButton = null; } }
private void OnLevelLoaded(GameScenes scene) { //call this every scene that needs BetterTimeWarp if (scene == GameScenes.FLIGHT || scene == GameScenes.SPACECENTER || scene == GameScenes.TRACKSTATION) { BetterTimeWarp.Instance = gameObject.AddComponent<BetterTimeWarp> (); } }
public void Event_OnGameSceneLoadRequested(GameScenes scene) { Log("Destroying Flight HUD"); hud.Shutdown(); Destroy(hud); hud = null; Log("Unhooking event"); GameEvents.onGameSceneLoadRequested.Remove(Event_OnGameSceneLoadRequested); }
public void dEstroy(GameScenes g) { GameEvents.onGUIApplicationLauncherReady.Remove(OnGUIReady); if (appButton != null) { ApplicationLauncher.Instance.RemoveModApplication(appButton); } }
private void DisableMapSO(GameScenes scene) { if (!isHomeworld && isLoaded) { if (OnDemandStorage.DisableBody(base.sphere.name)) { Debug.Log("[OD]: Disabled Body " + base.sphere.name); isLoaded = false; } } }
// Note: KSP's GameEvents.onLevelWasLoaded has the lower-case 'on' instead of usual 'On' private void onLevelWasLoaded(GameScenes scene) { if (scene != GameScenes.SPACECENTER) return; if (!RTSettings.Instance.FirstStart) return; // open here the option dialog for the first start RTLog.Notify("First start of RemoteTech!"); _optionWindow.Show(); RTSettings.Instance.FirstStart = false; }
public void LateUpdate() { try { if (HighLogic.LoadedScene != _lastScene) { _lastScene = HighLogic.LoadedScene; Util.Log("Saw scene switch to {0}", _lastScene.ToString()); } _expController.Update(); } catch (Exception ex) { Util.Log("{0}: {1}\n{2}", ex.GetType(), ex.Message, ex.StackTrace); } }
private void onSceneChange(GameScenes g) { switch (g) { case GameScenes.LOADING: case GameScenes.CREDITS: case GameScenes.LOADINGBUFFER: case GameScenes.MAINMENU: case GameScenes.PSYSTEM: case GameScenes.SETTINGS: case GameScenes.EDITOR: return; } progressParser.Loaded = false; Debug.Log("[Progress Tracking Parser] Initializing Progress Parser..."); progressParser.initialize(); }
private void OnLevelLoaded(GameScenes scene) { if (Settings.AllowEditors) { foreach (var editor in editorTypes.Where(e => e.Value.Contains(scene))) { try { GameObject obj = new GameObject (editor.Key.Name); obj.AddComponent (editor.Key); obj.SetActive (true); Utils.Log ("IngameEditor " + editor.Key.Name + " created"); } catch(Exception e) { Utils.LogError ("Failed to load editor: " + editor.Key.Name); Debug.LogException (e); } } } }
// virtual methods void Start() { KerbalGUIManager.print("[rusty] Started scene " + HighLogic.LoadedScene); lastScene = HighLogic.LoadedScene; AddEvents(); }
void onLevelWasLoaded(GameScenes data) { bool bTreatBodyAsNullForStatics = true; DeletePreviewObject(); staticDB.ToggleActiveAllStatics(false); if (selectedObject != null) { deselectObject(false, true); camControl.active = false; } if (!data.Equals(GameScenes.FLIGHT)) { DownlinkGUI.DisAudio.Stop(); } if (data.Equals(GameScenes.FLIGHT)) { bTreatBodyAsNullForStatics = false; InputLockManager.RemoveControlLock("KKEditorLock"); InputLockManager.RemoveControlLock("KKEditorLock2"); PersistenceUtils.savePersistenceBackup(); if (FlightGlobals.ActiveVessel != null) { staticDB.ToggleActiveStaticsOnPlanet(FlightGlobals.ActiveVessel.mainBody, true, true); currentBody = FlightGlobals.ActiveVessel.mainBody; staticDB.onBodyChanged(FlightGlobals.ActiveVessel.mainBody); DoHangaredCraftCheck(); } else { if (DebugMode) Debug.Log("KK: Flight scene load. No activevessel. Activating all statics."); staticDB.ToggleActiveAllStatics(true); } InvokeRepeating("updateCache", 0, 1); } else { CancelInvoke("updateCache"); } if (data.Equals(GameScenes.SPACECENTER)) { InputLockManager.RemoveControlLock("KKEditorLock"); // Tighter control over what statics are active bTreatBodyAsNullForStatics = false; currentBody = KKAPI.getCelestialBody("Kerbin"); //staticDB.onBodyChanged(KKAPI.getCelestialBody("Kerbin")); //staticDB.onBodyChanged(null); staticDB.ToggleActiveStaticsInGroup("KSCUpgrades", true); staticDB.ToggleActiveStaticsInGroup("KSCRace", true); // ********* if (MiscUtils.CareerStrategyEnabled(HighLogic.CurrentGame)) { if (DebugMode) Debug.Log("KK: Load launchsite openclose states for career game"); PersistenceFile<LaunchSite>.LoadList(LaunchSiteManager.AllLaunchSites, "LAUNCHSITES", "KK"); } } if (data.Equals(GameScenes.MAINMENU)) { if (!bImportedCustom) { bImportedCustom = true; } // Close all the launchsite objects LaunchSiteManager.setAllLaunchsitesClosed(); atMainMenu = true; // CHANGED 19082015 bTreatBodyAsNullForStatics = false; //currentBody = KKAPI.getCelestialBody("Kerbin"); //staticDB.onBodyChanged(KKAPI.getCelestialBody("Kerbin")); iMenuCount = iMenuCount + 1; InitialisedFacilities = false; } if (data.Equals(GameScenes.EDITOR)) { // Prevent abuse if selector left open when switching to from VAB and SPH GUI_LaunchSiteSelector.Close(); // Default selected launchsite when switching between save games switch (EditorDriver.editorFacility) { case EditorFacility.SPH: GUI_LaunchSiteSelector.setEditorType(SiteType.SPH); if (atMainMenu) { LaunchSiteManager.setLaunchSite(LaunchSiteManager.runway); atMainMenu = false; } break; case EditorFacility.VAB: GUI_LaunchSiteSelector.setEditorType(SiteType.VAB); if (atMainMenu) { LaunchSiteManager.setLaunchSite(LaunchSiteManager.launchpad); atMainMenu = false; } break; default: GUI_LaunchSiteSelector.setEditorType(SiteType.Any); break; } } if (bTreatBodyAsNullForStatics) staticDB.onBodyChanged(null); }
// save settings on scene changes private void OnGameSceneLoadRequested(GameScenes RequestedScene) { Debug.Log("[ShipManifest]: ShipManifestAddon.OnGameSceneLoadRequested"); SMSettings.SaveSettings(); //RunSave(); //if (SMSettings.Loaded) //{ // RunSave(); // SMSettings.SaveSettings(); //} }
private void OnGameSceneLoadRequested(GameScenes gameScene) { this.Log("Game scene load requested: " + gameScene); // Disable this instance becuase a new instance will be created after the new scene is loaded loadingNewScene = true; }
public void DebugActionTimed(GameScenes loadedscene) { LogFormatted("Timed Debug Action Initiated"); //LogFormatted("Stuff Here"); //LogFormatted(FlightGlobals.ActiveVessel.orbit.closestEncounterBody.bodyName); //LogFormatted(FlightGlobals.ActiveVessel.orbit.ClAppr.ToString()); //LogFormatted(FlightGlobals.ActiveVessel.orbit.closestEncounterBody.sphereOfInfluence.ToString()); // how to detect Escape - eg to Solar orbit //Detect SOI Change and time //if ((FlightGlobals.ActiveVessel.orbit.closestEncounterBody != null) && (FlightGlobals.ActiveVessel.orbit.ClAppr > 0)) //{ // //Is the closest approach less than the size of the SOI // LogFormatted(FlightGlobals.ActiveVessel.orbit.referenceBody + "," + FlightGlobals.ActiveVessel.orbit.closestEncounterBody + "," + // FlightGlobals.ActiveVessel.orbit.nextPatch.referenceBody + "," + FlightGlobals.ActiveVessel.orbit.nextPatch.closestEncounterBody); // if (FlightGlobals.ActiveVessel.orbit.ClAppr < FlightGlobals.ActiveVessel.orbit.closestEncounterBody.sphereOfInfluence) // { // LogFormatted("SOI Change in :" + (FlightGlobals.ActiveVessel.orbit.nextPatch.StartUT - Planetarium.GetUniversalTime())); // } // else // { // LogFormatted("Nextpatch in :" + (FlightGlobals.ActiveVessel.orbit.nextPatch.StartUT - Planetarium.GetUniversalTime())); // } //} //looking for next action on the path use orbit.patchEndTransition - enum of Orbit.PatchTransitionType // FINAL - fixed orbit no change // ESCAPE - leaving SOI // Intercept - entering new SOI inside current SOI // INITIAL - ??? // MANEUVER - MAneuver Node // // orbit.UTsoi - time of next SOI change (base on above transition types - ie if type is final this time can be ignored) //orbit.nextpatch gives you the next orbit and you can read the new SOI!!! //Maneuver Node //To recreate should only need DeltaV, NodeRotation and UT of Node //write orbit, next orbit, patchedconicsolver nodes? //see what we need to store for a Maneuver node //FlightGlobals.Vessels[0].patchedConicSolver.maneuverNodes[0] //if (tmpVessel.orbit.nextPatch == null) //{ // LogFormatted(tmpVessel.name + "-No next Patch"); //} //else //{ // LogFormatted(tmpVessel.name + "-Next patch @ " + (tmpVessel.orbit.nextPatch.StartUT-CurrentTime.UT)); // LogFormatted("Same orbit: " + (tmpVessel.orbit == tmpVessel.orbit.nextPatch)); //} }
public void Load( ) { _hideCompleteExperiments = false; _useBlizzysToolbar = false; _completeWithoutRecovery = false; _checkDebris = false; _allFilter = true; _stopTimeWarp = true; _playNoise = true; _showResultsWindow = true; _filterDifficultScience = true; _uiScale = 1f; _musicStartsMuted = false; _righClickMutesMusic = true; _selectedObjectWindow = true; try { if (File.Exists(_file)) { var node = ConfigNode.Load(_file); if (node == null) { return; } var root = node.GetNode("ScienceChecklist"); if (root == null) { return; } var settings = root.GetNode("Config"); if (settings == null) { return; } var V = settings.GetValue("HideCompleteExperiments"); if (V != null) { _hideCompleteExperiments = bool.Parse(V); } V = settings.GetValue("UseBlizzysToolbar"); if (V != null) { _useBlizzysToolbar = bool.Parse(V); } V = settings.GetValue("CompleteWithoutRecovery"); if (V != null) { _completeWithoutRecovery = bool.Parse(V); } V = settings.GetValue("CheckDebris"); if (V != null) { _checkDebris = bool.Parse(V); } V = settings.GetValue("AllFilter"); if (V != null) { _allFilter = bool.Parse(V); } V = settings.GetValue("StopTimeWarp"); if (V != null) { _stopTimeWarp = bool.Parse(V); } V = settings.GetValue("PlayNoise"); if (V != null) { _playNoise = bool.Parse(V); } V = settings.GetValue("ShowResultsWindow"); if (V != null) { _showResultsWindow = bool.Parse(V); } V = settings.GetValue("FilterDifficultScience"); if (V != null) { _filterDifficultScience = bool.Parse(V); } V = settings.GetValue("UiScale"); if (V != null) { _uiScale = float.Parse(V); } V = settings.GetValue("MusicStartsMuted"); if (V != null) { _musicStartsMuted = bool.Parse(V); } V = settings.GetValue("RighClickMutesMusic"); if (V != null) { _righClickMutesMusic = bool.Parse(V); } V = settings.GetValue("SelectedObjectWindow"); if (V != null) { _selectedObjectWindow = bool.Parse(V); } var windowSettings = root.GetNode("Windows"); if (windowSettings == null) { return; } foreach (var N in windowSettings.nodes) { // _logger.Trace( "Window Node" ); if (N.GetType( ) == typeof(ConfigNode)) { ConfigNode SceneNode = (ConfigNode)N; GameScenes Scene = (GameScenes)Enum.Parse(typeof(GameScenes), SceneNode.name, true); if (!_windowSettings.ContainsKey(Scene)) { _windowSettings.Add(Scene, new Dictionary <string, WindowSettings>( )); } foreach (var W in SceneNode.nodes) { if (W.GetType( ) == typeof(ConfigNode)) { ConfigNode WindowNode = (ConfigNode)W; string WindowName = WindowNode.name; // _logger.Trace( "Loading " + WindowName + " For " + Scene.ToString( ) ); WindowSettings NewWindowSetting = new WindowSettings(WindowName); for (int x = 0; x < WindowNode.CountValues; x++) { NewWindowSetting._settings[WindowNode.values[x].name] = WindowNode.values[x].value; } _windowSettings[Scene][NewWindowSetting._windowName] = NewWindowSetting; } } } } // _logger.Info( "Loaded successfully." ); return; // <--- Return from here -------------------------------------- } } catch (Exception e) { _logger.Info(Localizer.Format("#autoLOC_[x]_Science!_014") /*Unable to load config: */ + e.ToString( )); } }
internal void onSceneChange(GameScenes scene) { OnGUIAppLauncherDestroyed(); }
private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) => current = (GameScenes)scene.buildIndex;
// Save settings on scene changes private void OnGameSceneLoadRequested(GameScenes requestedScene) { Settings.SaveSettings(); }
private void onLevelWasLoaded(GameScenes gs) { Vessel v = FlightGlobals.ActiveVessel; checkFuelLines(v); }
void onGameSceneLoadRequested(GameScenes gs) { ClickThruBlocker.CTBWin.activeBlockerCnt = 0; }
public void Stop(GameScenes gameScene) { dmpGame.updateEvent.Remove(updateAction); GameEvents.onGameSceneLoadRequested.Remove(OnGameSceneLoadRequested); }
public void gameSceneEvent(GameScenes scene) { if (scene == GameScenes.MAINMENU) { KCT_GameStates.reset(); KCT_GameStates.firstStart = false; InputLockManager.RemoveControlLock("KCTLaunchLock"); KCT_GameStates.activeKSCName = "Stock"; KCT_GameStates.ActiveKSC = new KCT_KSC("Stock"); KCT_GameStates.KSCs = new List <KCT_KSC>() { KCT_GameStates.ActiveKSC }; KCT_GameStates.LastKnownTechCount = 0; KCT_GameStates.PermanentModAddedUpgradesButReallyWaitForTheAPI = 0; KCT_GameStates.TemporaryModAddedUpgradesButReallyWaitForTheAPI = 0; if (KCT_PresetManager.Instance != null) { KCT_PresetManager.Instance.ClearPresets(); KCT_PresetManager.Instance = null; } return; } KCT_GameStates.MiscellaneousTempUpgrades = 0; /*if (HighLogic.LoadedScene == GameScenes.MAINMENU) * { * if (scene == GameScenes.SPACECENTER) * { * KCT_PresetManager.Instance.FindPresetFiles(); * KCT_PresetManager.Instance.LoadPresets(); * } * }*/ if (KCT_PresetManager.PresetLoaded() && !KCT_PresetManager.Instance.ActivePreset.generalSettings.Enabled) { return; } List <GameScenes> validScenes = new List <GameScenes> { GameScenes.SPACECENTER, GameScenes.TRACKSTATION, GameScenes.EDITOR }; if (validScenes.Contains(scene)) { TechDisableEventFinal(); } if (HighLogic.LoadedScene == scene && scene == GameScenes.EDITOR) //Fix for null reference when using new or load buttons in editor { GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); } if (HighLogic.LoadedSceneIsEditor) { EditorLogic.fetch.Unlock("KCTEditorMouseLock"); } }
public void RemoveButton(GameScenes scene) { ApplicationLauncher.Instance.RemoveModApplication(btnLauncher); }
private void OnSceneChange(GameScenes scene) { //Print("OnSceneChange"); for (int i = 0; i < persistentEmitters.Count; i++) { EffectBehaviour.RemoveParticleEmitter(persistentEmitters[i].pe); //Print(" go is " + persistentEmitters[i].go); //Destroy(persistentEmitters[i].go); if (persistentEmitters[i].go != null) { Destroy(persistentEmitters[i].go); } } persistentEmitters = new List<PersistentKSPParticleEmitter>(); }
public void OnButtonEquip_Click() { GameScenes.ChangeScense(GameScenes.MyScene.ChargeShop, GameScenes.MyScene.Hero); }
public virtual void OnSceneChange(GameScenes data) => Close();
void OnGameSceneLoadRequestedForAppLauncher(GameScenes SceneToLoad) { }
public string GetScene(GameScenes scene) { // just convert scene type to a string and return it // to make it easier the GameScenes enum string is the scene name return(scene.ToString()); }
void OnGameSceneLoadRequestedForAppLauncher(GameScenes SceneToLoad) { LogFormatted_DebugOnly("GameSceneLoadRequest"); DestroyAppLauncherButton(); }
private void LevelWasLoaded(GameScenes data) { usedId = new HashSet <int>(); CurrentX = -32; CurrentY = 32; }
private void MainPlayerLevelLoop() { // player ready screen - wait the delay time and show READY on screen if (playerReady) { // initialize objects and set READY text if (initReadyScreen) { //FreezePlayer(true); //FreezeEnemies(true); FreezeEverything(true); if (screenMessageText != null) { screenMessageText.alignment = TextAlignmentOptions.Center; screenMessageText.alignment = TextAlignmentOptions.Top; screenMessageText.fontStyle = FontStyles.UpperCase; screenMessageText.fontSize = 24; screenMessageText.text = "\n\n\n\nREADY"; } initReadyScreen = false; // set the player transform to null so the camera will stay still // the player will call TeleportLanded() to signal animation finished if (cameraFollow != null) { cameraFollow.player = null; } } // countdown READY screen pause gamePlayerReadyTime -= Time.deltaTime; if (gamePlayerReadyTime < 0) { FreezePlayer(false); //FreezeEnemies(false); FreezeEverything(false); TeleportPlayer(true); if (screenMessageText != null) { screenMessageText.text = ""; } playerReady = false; AllowGamePause(true); } return; } // show player score if (playerScoreText != null) { playerScoreText.text = String.Format("<mspace=\"{0}\">{1:0000000}</mspace>", playerScoreText.fontSize, playerScore); } // if the game isn't over then spawn enemies if (!isGameOver) { // here is where we can do things while the game is running GetWorldViewCoordinates(); //ShowMessage(); //UpdateScore(); //SpawnEnemies(); //RepositionEnemies(); DestroyStrayBullets(); // scene change triggered by StartNextScene() if (startNextScene) { // save player weapons SavePlayerWeapons(); // load the next scene -- set in previous scene startNextScene = false; gameScene = GetScene(nextSceneName); SceneManager.LoadScene(nextSceneName); } } else { // game over, wait delay then reload scene gameRestartTime -= Time.deltaTime; if (gameRestartTime < 0) { // check player lives if (playerLives > 0) { // play same scene lastSceneName = SceneManager.GetActiveScene().name; SceneManager.LoadScene(lastSceneName); } else { // out of lives, game over screen gameScene = GameScenes.GameOver; SceneManager.LoadScene(GetScene(gameScene)); } } } }
void OnGameSceneLoadRequested(GameScenes gameScene) { First = false; Log("OnGameSceneLoadRequested", "QHide"); }
public void onLevelWasLoaded(GameScenes scene) { JSIAdvPodsUtil.Log_Debug("OnLevelWasLoaded {0}", scene); }
// With the help of NoMoreGrind code by nlight private void LoadUpgradesPrices(GameScenes data) { log("Loading new upgrades prices"); foreach (UpgradeableFacility facility in GameObject.FindObjectsOfType <UpgradeableFacility>()) { SpaceCenterFacility facilityType = (SpaceCenterFacility)Enum.Parse(typeof(SpaceCenterFacility), facility.name); float[] prices = getFacilityUpgradePrices(facilityType); int levels = getFacilityLevels(facilityType); int[] levelsVisual = getFacilityLevelsVisual(facilityType); if (prices == null) { log("No upgrades prices set for " + facilityType + ". Skipping"); continue; } if (levels != prices.Length) { log("Wrong numbers of upgrade price for " + facility + " expecting " + levels + " and have " + prices.Length + ". Check your configs"); continue; } UpgradeableObject.UpgradeLevel[] upgradeLevels = facility.UpgradeLevels; if (facility.UpgradeLevels[facility.FacilityLevel].Spawned) { facility.UpgradeLevels[facility.FacilityLevel].Despawn(); } UpgradeableObject.UpgradeLevel[] newUpgradeLevels = new UpgradeableObject.UpgradeLevel[levels]; for (int i = 0; i < levels; i++) { int originalLevel = Math.Min(i, upgradeLevels.Length - 1); UpgradeableObject.UpgradeLevel level = new UpgradeableObject.UpgradeLevel(); var sourceLvl = upgradeLevels[originalLevel]; level.Setup(facility); level.levelCost = prices[i]; level.levelText = sourceLvl.levelText; level.levelStats = sourceLvl.levelStats; level.facilityPrefab = sourceLvl.facilityPrefab; level.facilityInstance = null; if (levelsVisual.Length == levels) { //log(facility.name + " Copying level " + (levelsVisual[i] - 1) + " for level " + (i + 1)); level.facilityPrefab = upgradeLevels[levelsVisual[i] - 1].facilityPrefab; } else { log("Wrong levelsVisual length " + levelsVisual.Length + " for " + facility.name + " expected " + levels); } newUpgradeLevels[i] = level; } facility.UpgradeLevels = newUpgradeLevels; facility.SetupLevels(); facility.setLevel(facility.FacilityLevel); } GameEvents.onLevelWasLoaded.Remove(LoadUpgradesPrices); //log("New upgrades prices are Loaded"); }
void onGameSceneChange(GameScenes scene) { OnLeavingEditor (); /* save settings */ if (ConfigSaving != null) { ConfigSaving (); } }
private void LevelWasLoaded(GameScenes data) { usedId = new HashSet<int>(); CurrentX = -32; CurrentY = 32; }
public void SetGameOver() { scenes = GameScenes.GAMEOVER; }
public void DebugActionTriggered(GameScenes loadedscene) { LogFormatted("Manual Debug Action Initiated"); blnTriggerFlag = true; //Kerbal[] KerbalObjects = FlightGlobals.FindObjectsOfType(typeof(Kerbal)) as Kerbal[]; //LogFormatted("Kerbal Count: {0}", KerbalObjects.Length); //foreach (Kerbal k in KerbalObjects) //{ // LogFormatted("{0}", k.crewMemberName); //} //KerbalEVA[] KerbalEVAObjects = FlightGlobals.FindObjectsOfType(typeof(KerbalEVA)) as KerbalEVA[]; //LogFormatted("Kerbal EVA Count: {0}", KerbalEVAObjects.Length); //LogFormatted("Vessels Count: {0}", FlightGlobals.Vessels.Count); //foreach (Vessel v in FlightGlobals.Vessels) //{ // List<ProtoCrewMember> pCM = v.GetVesselCrew(); // foreach (ProtoCrewMember CM in pCM) // { // LogFormatted("{2}({1})-{0}", CM.name,v.vesselType,v.vesselName); // } //} //String strLine; //foreach (CelestialBody cbTemp in FlightGlobals.Bodies) //{ // strLine=String.Format("{0}({1}),", cbTemp.bodyName, Enum.GetName(typeof(CelestialBodyType), cbTemp.bodyType)); // try // { // strLine += String.Format("parent-{0},", cbTemp.referenceBody.bodyName); // } // catch (Exception) { } // try // { // strLine += String.Format("radius-{0},", cbTemp.orbit.radius.ToString()); // } // catch (Exception) { } // try // { // strLine += String.Format("sma-{0},", cbTemp.orbit.semiMajorAxis.ToString()); // } // catch (Exception) { } // try // { // strLine += String.Format("period-{0},", cbTemp.orbit.period.ToString()); // } // catch (Exception) { } // try // { // strLine += String.Format("tA-{0},", cbTemp.orbit.trueAnomaly); // } // catch (Exception) { } // try // { // strLine += String.Format("aOP-{0},", cbTemp.orbit.argumentOfPeriapsis); // } // catch (Exception) { } // try // { // strLine += String.Format("LAN-{0},", cbTemp.orbit.LAN); // } // catch (Exception) { } // LogFormatted(strLine); //} //LogFormatted("window textcolor r:{0}", KACResources.styleWindow.normal.textColor.r.ToString()); //byte[] b = KSP.IO.IOUtils.SerializeToBinary(FlightGlobals.ActiveVessel.orbit); //bw.Write(b); //bw.Close(); //KSP.IO.BinaryWriter bw = KSP.IO.BinaryWriter.CreateForType<KerbalAlarmClock>("testfile.bin"); //LogFormatted(scrollPosition.ToString()); //Print each of the vessels UTSOI //foreach (Vessel tmpVessel in FlightGlobals.Vessels) //{ // LogFormatted("{0}-{1}", tmpVessel.vesselName, tmpVessel.orbit.UTsoi.ToString()); //} //LogFormatted(FlightGlobals.ActiveVessel.id.ToString()); //Orbit o=FlightGlobals.ActiveVessel.orbit; //WriteOrbitFile(o,"Debug/Orbit.txt"); //if (o.nextPatch != null) // WriteOrbitFile(o.nextPatch, "Debug/OrbitNext.txt"); //WriteOrbitFile(tgtSelectedDistance.GetOrbit(),"Debug/OrbitTarget.txt"); //WriteManeuverFile(FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes,"Debug/Nodes.txt"); }
public void SetInGame() { scenes = GameScenes.INGAME; }
public void OnSceneSwitch(GameScenes scene) { isStarted = false; // fixes annoying nullrefs when switching scenes and things haven't been destroyed yet editorCam = null; }
public void SetTutorial() { scenes = GameScenes.TUTORIAL; }
void OnDestroy() { KerbalGUIManager.print("[rusty] Destroyed scene " + lastScene); RemoveEvents(); lastScene = HighLogic.LoadedScene; }
public void SetTitle() { scenes = GameScenes.TITLE; }
private void OnGameSceneLoadRequested(GameScenes scene) { iterateVessels.Clear(); iterateVessels.AddRange(loadingFlyingVessels.Keys); foreach (Guid vesselID in iterateVessels) { HackyFlyingVesselLoad hfvl = loadingFlyingVessels[vesselID]; VesselWorker.fetch.KillVessel(hfvl.flyingVessel); } loadingFlyingVessels.Clear(); }
/// <summary> /// Currently we save the space program every time a new game scene is loaded. /// Maybe just save when the requested game scene is the main menu /// </summary> /// <param name="scene">Scene.</param> private void onGameSceneLoadRequested(GameScenes scene) { manager.saveProgram(); manager.loadProgram(HighLogic.CurrentGame.Title); eventFlags = EventFlags.NONE; }
private void onGameSceneLoadRequested(GameScenes scene) { //Utils.Log("Changing scene: " + scene); if (!SoundtrackEditor.InitialLoadingComplete && scene.Equals(GameScenes.MAINMENU)) SoundtrackEditor.InitialLoadingComplete = true; SoundtrackEditor.CurrentSituation.scene = Enums.ConvertScene(scene); if (MonitorScene) SoundtrackEditor.Instance.OnSituationChanged(); }
public void OnGameSceneLoadRequested(GameScenes gameScene) { asb = null; }
private void OnGameSceneLoadRequested(GameScenes data) { KMPClientMain.DebugLog("OnGameSceneLoadRequested"); if (gameRunning && (data == GameScenes.SPACECENTER || data == GameScenes.MAINMENU)) { writePluginUpdate(); } }
public void onLevelWasLoaded(GameScenes scene) { onVesselChange(FlightGlobals.ActiveVessel); }