//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);
     }
 }
        protected override void CreateControls()
        {
            base.CreateControls();

            // Destinations Tab
            textAddDestination = new GUITextBox("Add Destination: ", "", "", 180, 300, DoAddDestination);
            buttonAddDest      = new GUIButton("Add", DoAddDestination, new GUILayoutOption[] { GUILayout.Width(120) });
            buttonRemoveDest   = new GUIButton("Remove", DoRemoveDestination, new GUILayoutOption[] { GUILayout.Width(100) });

            comboDestination = new DropDown(new Vector2(260, 170), KLVCore.GetAllDestinationName());
            RegisterCombos(comboDestination);

            // Settings Tab
            textFolderPath     = new GUITextBox("Config path:", SaveManager.vehiclesPath, "", 300, 400);
            buttonSave         = new GUIButton("Save Configurations", DoSave, null);
            buttonLoad         = new GUIButton("Load Configurations", DoLoad, null);
            buttonUnload       = new GUIButton("Unload All Configurations", DoUnload, null);
            buttonIncreaseFont = new GUIButton("▲", DoIncreaseFont, GUILayout.Width(30));
            buttonDecreaseFont = new GUIButton("▼", DoDecreaseFont, GUILayout.Width(30));
        }
示例#4
0
        protected void AddConfig(LaunchConfig config)
        {
            comboFamily.SetExpanded(false);

            if (maxNewConfigs <= newConfigs.Count())
            {
                return;
            }

            isAddingConfig = true;

            // Add config and all editing controls
            var newRemoveButton = new GUIButton("Remove", DoRemoveLaunchConfig, new GUILayoutOption[] { GUILayout.Width(80) });
            var newTextPayload  = new GUITextBox("Max payload: ", "", "t   to ", 50, 180);
            var newDestCombo    = new klvGUI.DropDown(new Vector2(200, 130), KLVCore.GetAllDestinationName(), newRemoveButton);

            if (config != null)
            {
                newDestCombo.SetSelection(config.Target.Name);
            }

            newDestCombo.SetExpandAction(DoExpandCombo);
            RegisterCombos(newDestCombo);

            if (config != null)
            {
                newTextPayload.SetText(config.PayloadMass.ToString("0.###"));
                newDestCombo.SetSelection(config.Target == null ? "" : config.Target.Name);
                newConfigs.Add(config);
            }
            else
            {
                newConfigs.Add(new LaunchConfig());
            }

            newTextPayload.SetEditing(true);

            buttonAllRemoveConfigs.Add(newRemoveButton);
            comboAllDestinations.Add(newDestCombo);
            textAllPayloads.Add(newTextPayload);
        }
 private void DoUnload(GUIButton sender, object value)
 {
     KLVCore.RefreshAllConfigurations();
     UpdateFamilies();
     comboDestination.SetItems(KLVCore.GetAllDestinationName());
 }
 private void DoLoad(GUIButton sender, object value)
 {
     KLVCore.Load();
     UpdateFamilies();
     comboDestination.SetItems(KLVCore.GetAllDestinationName());
 }