/// <summary> /// Adds the given preset to the library /// </summary> /// <param name="preset">Preset to add</param> public void AddPreset(Preset preset) { this._presets.Add(preset); RealChuteSettings.SaveSettings(); }
/// <summary> /// Removes the preset of the given name from the library /// </summary> /// <param name="name">Name of the preset to delete</param> public void DeletePreset(Preset preset) { this._presets.Remove(preset); RealChuteSettings.SaveSettings(); }
/// <summary> /// Tries to get the preset of the given name and stores it in the ref value /// </summary> /// <param name="name">Name of the preset to find</param> /// <param name="preset">Value to store the result in</param> public bool TryGetPreset(string name, ref Preset preset) { if (PresetExists(name)) { preset = GetPreset(name); return true; } UnityEngine.Debug.Log("[RealChute]: Could not find the preset " + name + " within the config"); return false; }
/// <summary> /// Tries to get the preset at the given index and stores it in the ref value /// </summary> /// <param name="index">Index of the preset to find</param> /// <param name="preset">Value to store the result in</param> public bool TryGetPreset(int index, ref Preset preset) { if (presets.Count > index + 1) { preset = GetPreset(index); return true; } UnityEngine.Debug.Log("[RealChute]: Could not find the preset at the index [" + index + "] within the config"); return false; }
//Applies the preset on the chute internal void ApplyPreset(Preset preset) { Preset.ChuteParameters parameters = preset.parameters[id]; this.material = this.pChute.materials.GetMaterial(parameters.material); this.templateGUI.materialsID = this.pChute.materials.GetMaterialIndex(parameters.material); this.templateGUI.preDepDiam = parameters.preDeployedDiameter; this.templateGUI.depDiam = parameters.deployedDiameter; this.templateGUI.isPressure = parameters.minIsPressure; this.templateGUI.predepClause = this.templateGUI.isPressure ? parameters.minPressure : parameters.minDeployment; if (templateGUI.isPressure) { this.parachute.minDeployment = float.Parse(parameters.minDeployment); } else { this.parachute.minPressure = float.Parse(parameters.minPressure); } this.templateGUI.deploymentAlt = parameters.deploymentAlt; this.templateGUI.cutAlt = parameters.cutAlt; this.templateGUI.preDepSpeed = parameters.preDeploymentSpeed; this.templateGUI.depSpeed = parameters.deploymentSpeed; if (this.textures != null) { if (this.textures.ContainsCanopy(parameters.chuteTexture)) { this.templateGUI.chuteID = this.textures.GetCanopyIndex(parameters.chuteTexture); } if (this.textures.ContainsModel(parameters.modelName)) { this.templateGUI.modelID = this.textures.GetModelIndex(parameters.modelName); } } this.templateGUI.typeID = parameters.type; this.templateGUI.calcSelect = parameters.calcSelect; this.templateGUI.getMass = parameters.getMass; this.templateGUI.useDry = parameters.useDry; this.templateGUI.mass = parameters.mass; this.templateGUI.landingSpeed = parameters.landingSpeed; this.templateGUI.deceleration = parameters.deceleration; this.templateGUI.refDepAlt = parameters.refDepAlt; this.templateGUI.chuteCount = parameters.chuteCount; }
/// <summary> /// Tries to get the preset at the given index and stores it in the ref value /// </summary> /// <param name="index">Index of the preset to find</param> /// <param name="preset">Value to store the result in</param> public bool TryGetPreset(int index, ref Preset preset) { if (presets.Count > index + 1) { preset = GetPreset(index); return true; } return false; }
/// <summary> /// Tries to get the preset of the given name and stores it in the ref value /// </summary> /// <param name="name">Name of the preset to find</param> /// <param name="preset">Value to store the result in</param> public bool TryGetPreset(string name, ref Preset preset) { if (PresetExists(name)) { preset = GetPreset(name); return true; } return false; }
/// <summary> /// Adds the given preset to the library /// </summary> /// <param name="preset">Preset to add</param> public void AddPreset(Preset preset) { this._presets.Add(preset.name, preset); RefreshData(); RealChuteSettings.SaveSettings(); }
//Applies the preset on the chute internal void ApplyPreset(Preset preset) { Preset.ChuteParameters parameters = preset.parameters[id]; this.material = pChute.materials.GetMaterial(parameters.material); this.materialsID = pChute.materials.GetMaterialIndex(parameters.material); this.preDepDiam = parameters.preDeployedDiameter; this.depDiam = parameters.deployedDiameter; this.isPressure = parameters.minIsPressure; this.predepClause = this.isPressure ? parameters.minPressure : parameters.minDeployment; if (isPressure) { this.parachute.minDeployment = float.Parse(parameters.minDeployment); } else { this.parachute.minPressure = float.Parse(parameters.minPressure); } this.deploymentAlt = parameters.deploymentAlt; this.cutAlt = parameters.cutAlt; this.preDepSpeed = parameters.preDeploymentSpeed; this.depSpeed = parameters.deploymentSpeed; if (pChute.textureLibrary == preset.textureLibrary || pChute.textureLibrary != "none") { if (textures.canopyNames.Contains(parameters.chuteTexture) && textures.canopies.Count > 0 && !string.IsNullOrEmpty(parameters.chuteTexture)) { this.chuteID = textures.GetCanopyIndex(textures.GetCanopy(parameters.chuteTexture)); } if (textures.modelNames.Contains(parameters.modelName) && textures.models.Count > 0 && !string.IsNullOrEmpty(parameters.modelName)) { this.modelID = textures.GetModelIndex(textures.GetModel(parameters.modelName)); } } this.typeID = RCUtils.types.ToList().IndexOf(parameters.type); this.calcSelect = parameters.calcSelect; this.getMass = parameters.getMass; this.useDry = parameters.useDry; this.mass = parameters.mass; this.landingSpeed = parameters.landingSpeed; this.deceleration = parameters.deceleration; this.refDepAlt = parameters.refDepAlt; this.chuteCount = parameters.chuteCount; }