private static void addWindowFuelTypeControls(ContainerDefinition container) { GUILayout.Label("Fuel Types -- Click to add ratio, CTRL click to set ratio, SHIFT click to subtract ratio"); ContainerFuelPreset[] presets = container.fuelPresets; ContainerFuelPreset preset; GUILayout.BeginHorizontal(); for (int i = 0; i < presets.Length; i++) { preset = presets[i]; if (i > 0 && i % 4 == 0) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); } if (GUILayout.Button(preset.name, GUILayout.Width(175))) { if (ctrlPressed())//ctrl == set fuel type { container.setFuelPreset(presets[i]); } else if (shiftPressed()) { container.subtractPresetRatios(presets[i]); } else { container.addPresetRatios(presets[i]); } } } GUILayout.EndHorizontal(); }
public void setFuelPreset(ContainerDefinition container, ContainerFuelPreset preset, bool updateSymmetry) { container.setFuelPreset(preset); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { SSTUVolumeContainer mod = p.GetComponent <SSTUVolumeContainer>(); ContainerDefinition def2 = mod.getContainer(container.name); ContainerFuelPreset preset2 = def2.internalGetFuelPreset(preset.name); mod.setFuelPreset(def2, preset2, false); } } }