void OnDestroy() { //GameEvents.onEditorVariantApplied.Remove(UpdateGeometryEvent); // Rodhern: Downgrade to KSP 1.3.1 GameEvents.onEditorPartEvent.Remove(UpdateGeometryEvent); GameEvents.onEditorUndo.Remove(ResetEditorEvent); GameEvents.onEditorRedo.Remove(ResetEditorEvent); GameEvents.onEditorShipModified.Remove(ResetEditorEvent); GameEvents.onEditorLoad.Remove(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Remove(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Remove(RemoveDesignConcerns); //EditorLogic.fetch.Unlock("FAREdLock"); if (blizzyEditorGUIButton != null) { blizzyEditorGUIButton.Destroy(); blizzyEditorGUIButton = null; } _stabDerivLinSim = null; _instantSim = null; _areaRulingOverlay.Cleanup(); _areaRulingOverlay = null; _editorGraph = null; _stabDeriv = null; if (_vehicleAero != null) { _vehicleAero.ForceCleanup(); } _vehicleAero = null; }
private void OnDestroy() { GameEvents.onEditorVariantApplied.Remove(UpdateGeometryEvent); GameEvents.onEditorPartEvent.Remove(UpdateGeometryEvent); GameEvents.onEditorUndo.Remove(ResetEditorEvent); GameEvents.onEditorRedo.Remove(ResetEditorEvent); GameEvents.onEditorShipModified.Remove(ResetEditorEvent); GameEvents.onEditorLoad.Remove(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Remove(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Remove(RemoveDesignConcerns); if (blizzyEditorGUIButton != null) { blizzyEditorGUIButton.Destroy(); blizzyEditorGUIButton = null; } _stabDerivLinSim = null; _instantSim = null; _areaRulingOverlay.Cleanup(); _areaRulingOverlay = null; _editorGraph = null; _stabDeriv = null; _vehicleAero?.ForceCleanup(); _vehicleAero = null; }
void Start() { if (CompatibilityChecker.IsAllCompatible() && instance == null) { instance = this; } else { GameObject.Destroy(this); return; } showGUI = false; if (FARDebugAndSettings.FARDebugButtonStock) { FARDebugAndSettings.FARDebugButtonStock.SetFalse(false); } _vehicleAero = new VehicleAerodynamics(); guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10); _instantSim = new InstantConditionSim(); GUIDropDown <int> flapSettingDropDown = new GUIDropDown <int>(new string[] { Localizer.Format("FARFlapSetting0"), Localizer.Format("FARFlapSetting1"), Localizer.Format("FARFlapSetting2"), Localizer.Format("FARFlapSetting3") }, new int[] { 0, 1, 2, 3 }, 0); GUIDropDown <CelestialBody> celestialBodyDropdown = CreateBodyDropdown(); modeDropdown = new GUIDropDown <FAREditorMode>(FAReditorMode_str, new FAREditorMode[] { FAREditorMode.STATIC, FAREditorMode.STABILITY, FAREditorMode.SIMULATION, FAREditorMode.AREA_RULING }); _simManager = new EditorSimManager(_instantSim); _editorGraph = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDeriv = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager); Color crossSection = GUIColors.GetColor(3); crossSection.a = 0.8f; Color crossSectionDeriv = GUIColors.GetColor(2); crossSectionDeriv.a = 0.8f; _areaRulingOverlay = EditorAreaRulingOverlay.CreateNewAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5); guiRect.height = 500; guiRect.width = 650; //GameEvents.onEditorVariantApplied.Add(UpdateGeometryEvent); // Rodhern: Downgrade to KSP 1.3.1 GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent); GameEvents.onEditorUndo.Add(ResetEditorEvent); GameEvents.onEditorRedo.Add(ResetEditorEvent); GameEvents.onEditorShipModified.Add(ResetEditorEvent); GameEvents.onEditorLoad.Add(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns); RequestUpdateVoxel(); }
void Start() { if (CompatibilityChecker.IsAllCompatible() && instance == null) { instance = this; } else { GameObject.Destroy(this); return; } _vehicleAero = new VehicleAerodynamics(); guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10); _instantSim = new InstantConditionSim(); GUIDropDown <int> flapSettingDropDown = new GUIDropDown <int>(new string[] { "0 (up)", "1 (init climb)", "2 (takeoff)", "3 (landing)" }, new int[] { 0, 1, 2, 3 }, 0); GUIDropDown <CelestialBody> celestialBodyDropdown = CreateBodyDropdown(); modeDropdown = new GUIDropDown <FAREditorMode>(FAReditorMode_str, new FAREditorMode[] { FAREditorMode.STATIC, FAREditorMode.STABILITY, FAREditorMode.SIMULATION, FAREditorMode.AREA_RULING }); _simManager = new EditorSimManager(_instantSim); _editorGraph = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDeriv = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager); Color crossSection = GUIColors.GetColor(3); crossSection.a = 0.8f; Color crossSectionDeriv = GUIColors.GetColor(2); crossSectionDeriv.a = 0.8f; _areaRulingOverlay = EditorAreaRulingOverlay.CreateNewAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5); guiRect.height = 500; guiRect.width = 650; GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent); GameEvents.onEditorUndo.Add(ResetEditorEvent); GameEvents.onEditorRedo.Add(ResetEditorEvent); GameEvents.onEditorShipModified.Add(ResetEditorEvent); GameEvents.onEditorLoad.Add(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns); RequestUpdateVoxel(); }
void Start() { if (CompatibilityChecker.IsAllCompatible() && instance == null) instance = this; else { GameObject.Destroy(this); return; } _vehicleAero = new VehicleAerodynamics(); guiRect = new Rect(Screen.width / 4, Screen.height / 6, 10, 10); _instantSim = new InstantConditionSim(); GUIDropDown<int> flapSettingDropDown = new GUIDropDown<int>(new string[] { "0 (up)", "1 (init climb)", "2 (takeoff)", "3 (landing)" }, new int[] { 0, 1, 2, 3 }, 0); GUIDropDown<CelestialBody> celestialBodyDropdown = CreateBodyDropdown(); _simManager = new EditorSimManager(_instantSim); _editorGraph = new StaticAnalysisGraphGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDeriv = new StabilityDerivGUI(_simManager, flapSettingDropDown, celestialBodyDropdown); _stabDerivLinSim = new StabilityDerivSimulationGUI(_simManager); Color crossSection = GUIColors.GetColor(3); crossSection.a = 0.8f; Color crossSectionDeriv = GUIColors.GetColor(2); crossSectionDeriv.a = 0.8f; _areaRulingOverlay = new EditorAreaRulingOverlay(new Color(0.05f, 0.05f, 0.05f, 0.7f), crossSection, crossSectionDeriv, 10, 5); guiRect.height = 500; guiRect.width = 650; GameEvents.onEditorPartEvent.Add(UpdateGeometryEvent); GameEvents.onEditorUndo.Add(ResetEditorEvent); GameEvents.onEditorRedo.Add(ResetEditorEvent); GameEvents.onEditorShipModified.Add(ResetEditorEvent); GameEvents.onEditorLoad.Add(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Add(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Add(RemoveDesignConcerns); RequestUpdateVoxel(); }
void OnDestroy() { GameEvents.onEditorPartEvent.Remove(UpdateGeometryEvent); GameEvents.onEditorUndo.Remove(ResetEditorEvent); GameEvents.onEditorRedo.Remove(ResetEditorEvent); GameEvents.onEditorShipModified.Remove(ResetEditorEvent); GameEvents.onEditorLoad.Remove(ResetEditorEvent); GameEvents.onGUIEngineersReportReady.Remove(AddDesignConcerns); GameEvents.onGUIEngineersReportDestroy.Remove(AddDesignConcerns); EditorLogic.fetch.Unlock("FAREdLock"); if (blizzyEditorGUIButton != null) blizzyEditorGUIButton.Destroy(); _stabDerivLinSim = null; _instantSim = null; _areaRulingOverlay = null; _editorGraph = null; _stabDeriv = null; if(_vehicleAero != null) _vehicleAero.ForceCleanup(); _vehicleAero = null; }