/// <summary> /// Updates the given calculation pack with data from the panel. /// </summary> /// <param name="pack">Pack to update</param> protected override void UpdatePack(DataPack pack) { if (pack is VolumetricPopPack popPack) { // Basic pack attributes. pack.name = PackNameField.text; pack.displayName = PackNameField.text; // Iterate through each level, parsing input fields. for (int i = 0; i < maxLevels[serviceDropDown.selectedIndex]; ++i) { // Textfields. PanelUtils.ParseFloat(ref popPack.levels[i].emptyArea, emptyAreaFields[i].text); PanelUtils.ParseInt(ref popPack.levels[i].emptyPercent, emptyPercentFields[i].text); // Look at fixed population checkbox state to work out if we're doing fixed population or area per. if (fixedPopChecks[i].isChecked) { // Using fixed pop: negate the 'area per' number to denote fixed population. int pop = 0; PanelUtils.ParseInt(ref pop, fixedPopFields[i].text); popPack.levels[i].areaPer = 0 - pop; } else { // Area per unit. PanelUtils.ParseFloat(ref popPack.levels[i].areaPer, areaPerFields[i].text); } // Checkboxes. popPack.levels[i].multiFloorUnits = multiFloorChecks[i].isChecked; } } }
/// <summary> /// Updates the given calculation pack with data from the panel. /// </summary> /// <param name="pack">Pack to update</param> protected override void UpdatePack(DataPack pack) { if (pack is FloorDataPack floorPack) { // Basic pack attributes. floorPack.name = PackNameField.text; floorPack.displayName = PackNameField.text; floorPack.version = (int)DataVersion.customOne; // Textfields. PanelUtils.ParseFloat(ref floorPack.floorHeight, floorHeightField.text); PanelUtils.ParseFloat(ref floorPack.firstFloorMin, firstMinField.text); PanelUtils.ParseFloat(ref floorPack.firstFloorExtra, firstExtraField.text); // Checkboxes. floorPack.firstFloorEmpty = firstEmptyCheck.isChecked; } }