コード例 #1
0
        protected void DoSaveVehicle(GUIButton sender, object value)
        {
            if (value != null)
            {
                if (!string.IsNullOrEmpty(comboFamily.selectedItemName))
                {
                    Vehicle newVehicle = null;

                    if (editingVehicle == null)
                    {
                        newVehicle = KLVCore.AddVehicle(comboFamily.selectedItemName, outputVehicleName.ToString(), vehicleWetMass, outputVehicleNote.ToString());
                    }
                    else
                    {
                        newVehicle = editingVehicle;
                        newVehicle.SetName(outputVehicleName.ToString());
                        newVehicle.SetNote(outputVehicleNote.ToString());
                    }

                    newVehicle.SetLaunchConfigs(newConfigs);

                    KLVCore.Save();

                    if (SubassemblyDropZone.Instance != null && SubassemblyDropZone.Instance.enabled)
                    {
                        try
                        {
                            EditorPartList.Instance.subassemblyButtonTransform.enabled = true;
                            SaveManager.SaveSubassembly(SubassemblyDropZone.Instance, selectedRootPart, newVehicle.GetFullName(), newVehicle.Note);
                        }
                        catch (NullReferenceException)
                        {
                            //GUIUtilities.Log("Saving subassembly button error");
                        }
                    }
                    EndVehicleEdit();
                }
            }
        }