示例#1
0
        protected virtual void DoSaveFamily(GUIButton sender, object value)
        {
            if (!string.IsNullOrEmpty(value.ToString()) && KLVCore.FamilyAvailable(value.ToString()))
            {
                if (editingFamily == null)
                {
                    //Adding new family
                    KLVCore.AddVehicleFamily(value.ToString());
                }
                else
                {
                    //Editing existing family
                    editingFamily.SetName(value.ToString());
                    editingFamily = null;
                }

                KLVCore.Save();
                KLVCore.UpdateAllVehicleNameSchemes();
                UpdateFamilies();
                textEditFamily.SetText("");
                textEditFamily.SetEditing(false);

                SetFamilyEditState(false);
            }
        }
        //Destinations

        private void DoRemoveDestination(GUIButton sender, object value)
        {
            if (!string.IsNullOrEmpty(value.ToString()))
            {
                KLVCore.RemoveDestination(value.ToString());
                KLVCore.Save();
                KLVCore.UpdateAllVehicleNameSchemes();
                comboDestination.SetItems(KLVCore.GetAllDestinationName());
                comboDestination.Deselect();
            }
        }
 private void DoAddDestination(GUIButton sender, object value)
 {
     if (!string.IsNullOrEmpty(value.ToString()) && KLVCore.DestinationAvailable(value.ToString()))
     {
         textAddDestination.SetEditing(false);
         textAddDestination.SetText("");
         KLVCore.AddDestination(value.ToString());
         KLVCore.Save();
         KLVCore.UpdateAllVehicleNameSchemes();
         comboDestination.SetItems(KLVCore.GetAllDestinationName());
         //Open combo to view new addition
         MarkComboToExpand(true, comboDestination);
     }
 }
示例#4
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();
                }
            }
        }
 //Settings
 private void DoSave(GUIButton sender, object value)
 {
     KLVCore.Save();
 }