Exemple #1
0
        private void onGameSceneLoadRequested(GameScenes scene)
        {
            //Utils.Log("Loading scene: " + scene);
            if (!SoundtrackEditor.InitialLoadingComplete && scene.Equals(GameScenes.MAINMENU))
            {
                SoundtrackEditor.InitialLoadingComplete = true;
            }

            SoundtrackEditor.CurrentSituation.scene = Enums.ConvertScene(scene);
            if (MonitorScene)
            {
                SoundtrackEditor.Instance.OnSituationChanged();
            }
        }
                public override bool Equals(System.Object right)
                {
                    if (right == null)
                    {
                        return(false);
                    }
                    GameSceneBased cmp = right as GameSceneBased;

                    if (cmp == null)
                    {
                        return(false);
                    }
                    return(scene.Equals(cmp.scene));
                }
        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();
        }
        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);
        }
Exemple #5
0
                public override bool Equals(object test)
                {
                    GameSceneBase cmp = test as GameSceneBase;

                    return(cmp != null && scene.Equals(cmp.scene));
                }
		void onLevelWasLoaded(GameScenes data)
		{
			// Debug.Log("KK: onLevelWasLoaded");
			bool something = true;
			
			if (selectedObject != null)
			{
				// Debug.Log("KK: Deselecting an object.");
				deselectObject(false);
				camControl.active = false;
			}

			// ASH 01112014 Toggle invoking of updateCache on and off for the flight scene only
			if (data.Equals(GameScenes.FLIGHT))
			{
				// ASH 04112014 Likely responsible for camera locks in the flight and space centre scenes
				InputLockManager.RemoveControlLock("KKEditorLock");
				// updateCache();
				InvokeRepeating("updateCache", 0, 1);
				something = false;
			}
			else
			{
				CancelInvoke("updateCache");
			}

			if (data.Equals(GameScenes.SPACECENTER))
			{
				// ASH 04112014 Likely responsible for camera locks in the flight and space centre scenes
				InputLockManager.RemoveControlLock("KKEditorLock");
				currentBody = KKAPI.getCelestialBody("Kerbin");
				staticDB.onBodyChanged(KKAPI.getCelestialBody("Kerbin"));
				updateCache();

				if (CareerStrategyEnabled(HighLogic.CurrentGame))
				{
					Debug.Log("KK: Load launchsite openclose states for career game");
					PersistenceFile<LaunchSite>.LoadList(LaunchSiteManager.AllLaunchSites, "LAUNCHSITES", "KK");
				}
				
				something = false;
				//InitialisedFacilities = false;
			}

			if (data.Equals(GameScenes.MAINMENU))
			{
				// Close all the launchsite objects
				// Debug.Log("KK: Closing all launchsites");
				LaunchSiteManager.setAllLaunchsitesClosed();
				atMainMenu = true;
				something = false;
				iMenuCount = iMenuCount + 1;
				InitialisedFacilities = false;
				// Debug.Log("KK: Reset InitialisedFacilities check");
			}
			
			if (data.Equals(GameScenes.EDITOR))
			{
				// Prevent abuse if selector left open when switching to from VAB and SPH
				selector.Close();

				// Default selected launchsite when switching between save games
				switch (EditorDriver.editorFacility)
				{
					case EditorFacility.SPH:
						selector.setEditorType(SiteType.SPH);
						if (atMainMenu)
						{
							// Debug.Log("KK: First visit to SPH");
							LaunchSiteManager.setLaunchSite(LaunchSiteManager.runway);
							atMainMenu = false;
						}
						break;
					case EditorFacility.VAB:
						selector.setEditorType(SiteType.VAB);
						if (atMainMenu)
						{
							// Debug.Log("KK: First visit to VAB");
							LaunchSiteManager.setLaunchSite(LaunchSiteManager.launchpad);
							atMainMenu = false;
						}
						break;
					default:
						selector.setEditorType(SiteType.Any);
						break;
				}
			}

			if (something)
			{
				staticDB.onBodyChanged(null);
			}
		}