//Creates and save a preset from the current stats private void CreatePreset() { presets.AddPreset(new Preset(this)); RealChuteSettings.SaveSettings(); PopupDialog.SpawnPopupDialog("Preset saved", "The \"" + presetName + "\" preset was succesfully saved!", "Close", false, skins); print("[RealChute]: Saved the " + presetName + " preset to the settings file."); }
//Creates and save a preset from the current stats internal void CreatePreset() { PresetsLibrary.Instance.AddPreset(new Preset(this)); RealChuteSettings.SaveSettings(); RCUtils.PopupDialog("Preset saved", "The \"" + this.editorGUI.presetName + "\" preset was succesfully saved!", "Close"); print("[RealChute]: Saved the " + this.editorGUI.presetName + " preset to the settings file."); }
private void OnDestroy() { if (!CompatibilityChecker.IsCompatible()) { return; } RealChuteSettings.SaveSettings(); GameEvents.onGUIAstronautComplexDespawn.Remove(ShowUI); GameEvents.onGUIRnDComplexDespawn.Remove(ShowUI); GameEvents.onGUIMissionControlDespawn.Remove(ShowUI); GameEvents.onGUIAstronautComplexSpawn.Remove(HideUI); GameEvents.onGUIRnDComplexSpawn.Remove(HideUI); GameEvents.onGUIMissionControlSpawn.Remove(HideUI); }
private void OnDestroy() { if (!CompatibilityChecker.IsAllCompatible()) { return; } this.destroying = true; CloseWindow(); RealChuteSettings.SaveSettings(); GameEvents.onShowUI.Remove(ShowUI); GameEvents.onHideUI.Remove(HideUI); GameEvents.onGUIAstronautComplexSpawn.Remove(HideUI); GameEvents.onGUIAstronautComplexDespawn.Remove(ShowUI); GameEvents.onGUIRnDComplexSpawn.Remove(HideUI); GameEvents.onGUIRnDComplexDespawn.Remove(ShowUI); GameEvents.onGUIMissionControlSpawn.Remove(HideUI); GameEvents.onGUIMissionControlDespawn.Remove(ShowUI); GameEvents.onGUIAdministrationFacilitySpawn.Remove(HideUI); GameEvents.onGUIAdministrationFacilityDespawn.Remove(ShowUI); }
private void OnDestroy() { if (!CompatibilityChecker.IsAllCompatible()) { return; } RealChuteSettings.SaveSettings(); GameEvents.onGUIApplicationLauncherReady.Remove(AddButton); GameEvents.onShowUI.Remove(ShowUI); GameEvents.onHideUI.Remove(HideUI); GameEvents.onGUIAstronautComplexSpawn.Remove(HideUI); GameEvents.onGUIAstronautComplexDespawn.Remove(ShowUI); GameEvents.onGUIRnDComplexSpawn.Remove(HideUI); GameEvents.onGUIRnDComplexDespawn.Remove(ShowUI); GameEvents.onGUIMissionControlSpawn.Remove(HideUI); GameEvents.onGUIMissionControlDespawn.Remove(ShowUI); GameEvents.onGUIAdministrationFacilitySpawn.Remove(HideUI); GameEvents.onGUIAdministrationFacilityDespawn.Remove(ShowUI); ApplicationLauncher.Instance.RemoveModApplication(button); }
private void OnDestroy() { if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT))) { return; } RealChuteSettings.SaveSettings(); GameEvents.onGUIApplicationLauncherReady.Remove(AddButton); GameEvents.onShowUI.Remove(ShowUI); GameEvents.onHideUI.Remove(HideUI); GameEvents.onGUIAstronautComplexSpawn.Remove(HideUI); GameEvents.onGUIAstronautComplexDespawn.Remove(ShowUI); GameEvents.onGUIRnDComplexSpawn.Remove(HideUI); GameEvents.onGUIRnDComplexDespawn.Remove(ShowUI); GameEvents.onGUIMissionControlSpawn.Remove(HideUI); GameEvents.onGUIMissionControlDespawn.Remove(ShowUI); GameEvents.onGUIAdministrationFacilitySpawn.Remove(HideUI); GameEvents.onGUIAdministrationFacilityDespawn.Remove(ShowUI); ApplicationLauncher.Instance.RemoveModApplication(button); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT))) { foreach (BaseAction action in Actions) { action.active = false; } foreach (BaseEvent evnt in Events) { evnt.active = false; evnt.guiActive = false; evnt.guiActiveEditor = false; } Fields["chuteCount"].guiActive = false; return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup settings = RealChuteSettings.fetch; //Part GUI Events["GUIDeploy"].active = true; Events["GUICut"].active = false; Events["GUIArm"].active = true; Events["GUIRepack"].guiActiveUnfocused = false; if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionCut"].guiName = "Cut chute"; Events["GUICut"].guiName = "Cut chute"; } if (settings.autoArm) { Events["GUIArm"].active = false; Actions["ActionArm"].active = false; } else { Events["GUIArm"].active = true; Actions["ActionArm"].active = true; } //Initiates the Parachutes LoadParachutes(); parachutes.ForEach(p => p.Initialize()); //First initiation of the part if (!initiated) { initiated = true; capOff = false; armed = false; this.baseDrag = this.part.maximum_drag; if (spareChutes >= 0) { chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { //If the part has been staged in the past if (capOff) { this.part.stackIcon.SetIconColor(XKCDColors.Red); } System.Random random = new System.Random(); parachutes.ForEach(p => p.randomTime = (float)random.NextDouble()); //Hide/show UI event addition GameEvents.onHideUI.Add(HideUI); GameEvents.onShowUI.Add(ShowUI); } //GUI window = new Rect(200, 100, 350, 400); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsCompatible()) { foreach (BaseAction action in Actions) { action.active = false; } foreach (BaseEvent evnt in Events) { evnt.active = false; evnt.guiActive = false; evnt.guiActiveEditor = false; } Fields["chuteCount"].guiActive = false; return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup settings = RealChuteSettings.fetch; //Part GUI Events["GUIDeploy"].active = true; Events["GUICut"].active = false; Events["GUIArm"].active = true; Events["GUIRepack"].guiActiveUnfocused = false; if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionCut"].guiName = "Cut chute"; Events["GUICut"].guiName = "Cut chute"; } if (settings.autoArm) { Events["GUIArm"].active = false; Actions["ActionArm"].active = false; } else { Events["GUIArm"].active = true; Actions["ActionArm"].active = true; } //Initiates the Parachutes LoadParachutes(); parachutes.ForEach(p => p.Initialize()); //First initiation of the part if (!initiated) { initiated = true; capOff = false; armed = false; this.baseDrag = this.part.maximum_drag; if (spareChutes >= 0) { chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { //If the part has been staged in the past if (capOff) { this.part.stackIcon.SetIconColor(XKCDColors.Red); } System.Random random = new System.Random(); parachutes.ForEach(p => p.randomTime = (float)random.NextDouble()); //Hide/show UI event addition GameEvents.onHideUI.Add(HideUI); GameEvents.onShowUI.Add(ShowUI); } //GUI window = new Rect(200, 100, 350, 400); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsAllCompatible()) { foreach (BaseAction a in Actions) { a.active = false; } foreach (BaseEvent e in Events) { e.active = false; e.guiActive = false; e.guiActiveEditor = false; } Fields["chuteCount"].guiActive = false; return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup this.settings = RealChuteSettings.fetch; //Part GUI if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionCut"].guiName = "Cut chute"; cut.guiName = "Cut chute"; } Actions["ActionArm"].active = !settings.autoArm; //Initiates the Parachutes if (this.parachutes.Count <= 0) { RealChuteModule m = this; if (this.node == null && !PersistentManager.instance.TryGetNode<RealChuteModule>(this.part.name, ref this.node)) { return; } LoadParachutes(); } this.parachutes.ForEach(p => p.Initialize()); //First initiation of the part if (!this.initiated) { this.initiated = true; this.armed = false; if (this.spareChutes >= 0) { this.chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { Random random = new Random(); this.parachutes.ForEach(p => p.randomTime = (float)random.NextDouble()); //Hide/show UI event addition GameEvents.onHideUI.Add(HideUI); GameEvents.onShowUI.Add(ShowUI); if (this.canRepack) { SetRepack(); } foreach(DragCube cube in this.part.DragCubes.Cubes) { switch (cube.Name) { case "PACKED": this.part.DragCubes.SetCubeWeight("PACKED", 1); break; case "SEMIDEPLOYED": case "DEPLOYED": this.part.DragCubes.SetCubeWeight(cube.Name, 0); break; default: break; } } } //GUI this.window = new Rect(200, 100, 350, 400); this.drag = new Rect(0, 0, 350, 30); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsAllCompatible()) { foreach (BaseAction a in Actions) { a.active = false; } foreach (BaseEvent e in Events) { e.active = false; e.guiActive = false; e.guiActiveEditor = false; } Fields["chuteCount"].guiActive = false; return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup settings = RealChuteSettings.fetch; //Part GUI if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionCut"].guiName = "Cut chute"; cut.guiName = "Cut chute"; } Actions["ActionArm"].active = !settings.autoArm; //Initiates the Parachutes LoadParachutes(); this.parachutes.ForEach(p => p.Initialize()); //First initiation of the part if (!this.initiated) { this.initiated = true; this.armed = false; if (this.spareChutes >= 0) { this.chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { Random random = new Random(); this.parachutes.ForEach(p => p.randomTime = (float)random.NextDouble()); //Hide/show UI event addition GameEvents.onHideUI.Add(HideUI); GameEvents.onShowUI.Add(ShowUI); if (this.canRepack) { SetRepack(); } } //GUI this.window = new Rect(200, 100, 350, 400); this.drag = new Rect(0, 0, 350, 30); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsCompatible()) { foreach (BaseAction action in Actions) { action.active = false; } foreach (BaseEvent evnt in Events) { evnt.active = false; evnt.guiActive = false; evnt.guiActiveEditor = false; } foreach (BaseField field in Fields) { field.guiActive = false; field.guiActiveEditor = false; } return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup settings = RealChuteSettings.fetch; //Part GUI Events["GUIDeploy"].active = true; Events["GUICut"].active = false; Events["GUISecCut"].active = false; Events["GUIArm"].active = true; Events["GUICutBoth"].active = false; Events["GUIRepack"].guiActiveUnfocused = false; if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionSecCut"].active = false; Actions["ActionCutBoth"].active = false; Actions["ActionCut"].guiName = "Cut chute"; Events["GUICut"].guiName = "Cut chute"; } if (settings.autoArm) { Events["GUIArm"].active = false; Actions["ActionArm"].active = false; } else { Events["GUIArm"].active = true; Actions["ActionArm"].active = true; } //Tweakables tooltip if (this.part.Modules.Contains("ProceduralChute") || !isTweakable) { foreach (BaseField field in Fields) { field.guiActiveEditor = false; } } else if (!secondaryChute) { Fields["secPreDeployedDiameter"].guiActiveEditor = false; Fields["secDeployedDiameter"].guiActiveEditor = false; Fields["secMinIsPressure"].guiActiveEditor = false; Fields["secMinDeployment"].guiActiveEditor = false; Fields["secMinPressure"].guiActiveEditor = false; Fields["secDeploymentAlt"].guiActiveEditor = false; Fields["secCutAlt"].guiActiveEditor = false; Fields["secPreDeploymentSpeed"].guiActiveEditor = false; Fields["secDeploymentSpeed"].guiActiveEditor = false; } //Initiates animations anim = this.part.FindModelAnimators(capName).FirstOrDefault(); //Initiates the Parachutes main = new Parachute(this, false); if (secondaryChute) { secondary = new Parachute(this, true); } //First initiation of the part if (!initiated) { initiated = true; capOff = false; armed = false; this.baseDrag = this.part.maximum_drag; if (spareChutes >= 0) { chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { //If the part has been staged in the past if (capOff) { this.part.stackIcon.SetIconColor(XKCDColors.Red); } System.Random random = new System.Random(); main.randomTime = (float)random.NextDouble(); if (secondaryChute) { secondary.randomTime = (float)random.NextDouble(); } } //GUI window = new Rect(200, 100, 350, 400); }
public override void OnStart(PartModule.StartState state) { if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; } if (!CompatibilityChecker.IsAllCompatible()) { foreach (BaseAction a in Actions) { a.active = false; } foreach (BaseEvent e in Events) { e.active = false; e.guiActive = false; e.guiActiveEditor = false; } Fields["chuteCount"].guiActive = false; return; } //Staging icon this.part.stagingIcon = "PARACHUTES"; //Autoarming checkup this.settings = RealChuteSettings.fetch; //Part GUI if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; } if (!secondaryChute) { Actions["ActionCut"].guiName = "Cut chute"; cut.guiName = "Cut chute"; } Actions["ActionArm"].active = !settings.autoArm; //Initiates the Parachutes if (this.parachutes.Count <= 0) { RealChuteModule m = this; if (this.node == null && !PersistentManager.instance.TryGetNode <RealChuteModule>(this.part.name, ref this.node)) { return; } LoadParachutes(); } this.parachutes.ForEach(p => p.Initialize()); //First initiation of the part if (!this.initiated) { this.initiated = true; this.armed = false; if (this.spareChutes >= 0) { this.chuteCount = (int)spareChutes; } } //Flight loading if (HighLogic.LoadedSceneIsFlight) { Random random = new Random(); this.parachutes.ForEach(p => p.randomTime = (float)random.NextDouble()); //Hide/show UI event addition GameEvents.onHideUI.Add(HideUI); GameEvents.onShowUI.Add(ShowUI); if (this.canRepack) { SetRepack(); } foreach (DragCube cube in this.part.DragCubes.Cubes) { switch (cube.Name) { case "PACKED": this.part.DragCubes.SetCubeWeight("PACKED", 1); break; case "SEMIDEPLOYED": case "DEPLOYED": this.part.DragCubes.SetCubeWeight(cube.Name, 0); break; default: break; } } } //GUI this.window = new Rect(200, 100, 350, 400); this.drag = new Rect(0, 0, 350, 30); }