void SetCategory(LaunchSiteCategory cat) { category = cat; showAllcategorys = false; UpdateIoggles(); onFilterChanged.Invoke(); }
public LaunchSiteCategoryIcon Category(LaunchSiteCategory category) { switch (category) { case LaunchSiteCategory.Runway: icon.sprite = UIMain.runWayIcon; icon.enabled = true; break; case LaunchSiteCategory.Helipad: icon.sprite = UIMain.heliPadIcon; icon.enabled = true; break; case LaunchSiteCategory.RocketPad: icon.sprite = UIMain.VABIcon; icon.enabled = true; break; case LaunchSiteCategory.Waterlaunch: icon.sprite = UIMain.waterLaunchIcon; icon.enabled = true; break; case LaunchSiteCategory.Other: icon.sprite = UIMain.ANYIcon; icon.enabled = true; break; default: icon.sprite = null; icon.enabled = false; break; } return(this); }
/// <summary> /// Reads a setting from a ConfigNode and writes the content to the targets field with the same name /// </summary> /// <param name="target"></param> /// <param name="field"></param> /// <param name="cfgNode"></param> internal static void ReadCFGNode(object target, FieldInfo field, ConfigNode cfgNode) { if (!cfgNode.HasValue(field.Name)) { return; } if (!string.IsNullOrEmpty(cfgNode.GetValue(field.Name))) { switch (field.FieldType.ToString()) { case "System.String": field.SetValue(target, cfgNode.GetValue(field.Name)); break; case "System.Int32": field.SetValue(target, int.Parse(cfgNode.GetValue(field.Name))); break; case "System.Single": field.SetValue(target, float.Parse(cfgNode.GetValue(field.Name))); break; case "System.Double": field.SetValue(target, double.Parse(cfgNode.GetValue(field.Name))); break; case "System.Boolean": bool result; bool.TryParse(cfgNode.GetValue(field.Name), out result); field.SetValue(target, result); break; case "UnityEngine.Vector3": field.SetValue(target, ConfigNode.ParseVector3(cfgNode.GetValue(field.Name))); break; case "UnityEngine.Vector3d": field.SetValue(target, ConfigNode.ParseVector3D(cfgNode.GetValue(field.Name))); break; case "UnityEngine.Color": field.SetValue(target, ConfigNode.ParseColor(cfgNode.GetValue(field.Name))); break; case "CelestialBody": field.SetValue(target, ConfigUtil.GetCelestialBody(cfgNode.GetValue(field.Name))); break; case "KerbalKonstructs.Core.SiteType": SiteType value = SiteType.Any; try { value = (SiteType)Enum.Parse(typeof(SiteType), cfgNode.GetValue(field.Name)); } catch { value = SiteType.Any; } field.SetValue(target, value); break; case "KerbalKonstructs.Core.LaunchSiteCategory": LaunchSiteCategory category = LaunchSiteCategory.Other; try { category = (LaunchSiteCategory)Enum.Parse(typeof(LaunchSiteCategory), cfgNode.GetValue(field.Name)); } catch { category = LaunchSiteCategory.Other; } field.SetValue(target, category); break; } } }
internal void ShowInstancesScroll() { UpdateInstances(); for (int ix = 0; ix < allStaticInstances.Length; ix++) //foreach (StaticObject obj in allStaticInstances) { bool isLocal = true; if (showLocal) { if (allStaticInstances[ix].pqsCity.sphere == FlightGlobals.currentMainBody.pqsController) { var dist = Vector3.Distance(FlightGlobals.ActiveVessel.GetTransform().position, allStaticInstances[ix].gameObject.transform.position); isLocal = dist < localRange; } else { isLocal = false; } } string sGroupHolder = ""; if (!showLocal) { if (groupFilter != "") { sGroupHolder = allStaticInstances[ix].Group; if (!sGroupHolder.Contains(groupFilter)) { isLocal = false; } } } if (isLocal) { GUILayout.BeginHorizontal(); GUILayout.Button("" + allStaticInstances[ix].Group, DeadButton3, GUILayout.Width(120), GUILayout.Height(23)); if (allStaticInstances[ix].hasLauchSites) { launchsiteCategory = allStaticInstances[ix].launchSite.sitecategory; switch (launchsiteCategory) { case LaunchSiteCategory.Runway: GUILayout.Button(UIMain.runWayIcon, DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; case LaunchSiteCategory.Helipad: GUILayout.Button(UIMain.heliPadIcon, DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; case LaunchSiteCategory.RocketPad: GUILayout.Button(UIMain.VABIcon, DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; case LaunchSiteCategory.Waterlaunch: GUILayout.Button(UIMain.waterLaunchIcon, DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; case LaunchSiteCategory.Other: GUILayout.Button(UIMain.ANYIcon, DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; default: GUILayout.Button("", DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); break; } } else { GUILayout.Button("", DeadButton3, GUILayout.Width(23), GUILayout.Height(23)); } //GUI.enabled = (obj != selectedObject); if (GUILayout.Button(new GUIContent("" + allStaticInstances[ix].model.title + " ( " + allStaticInstances[ix].indexInGroup.ToString() + " )", "Edit this instance."), GUILayout.Height(23))) { enableColliders = true; EditorGUI.CloseEditors(); if (selectedObject != null) { selectedObjectPrevious = selectedObject; Color highlightColor = new Color(0, 0, 0, 0); allStaticInstances[ix].HighlightObject(highlightColor); } if (snapTargetInstance == allStaticInstances[ix]) { snapTargetInstance = null; } KerbalKonstructs.instance.selectObject(allStaticInstances[ix], false, true, false); //obj.selectObject(false); Color highlightColor2 = XKCDColors.Green_Yellow; allStaticInstances[ix].HighlightObject(highlightColor2); } //GUI.enabled = true; if (showLocal) { GUI.enabled = (snapTargetInstance != allStaticInstances[ix] && allStaticInstances[ix] != selectedObject); if (GUILayout.Button(new GUIContent(tFocus, "Set as snap target."), GUILayout.Height(23), GUILayout.Width(23))) { if (snapTargetInstance != null) { snapTargetInstancePrevious = snapTargetInstance; Color highlightColor3 = new Color(0, 0, 0, 0); snapTargetInstance.HighlightObject(highlightColor3); } snapTargetInstance = allStaticInstances[ix]; Color highlightColor4 = XKCDColors.RedPink; allStaticInstances[ix].HighlightObject(highlightColor4); } GUI.enabled = true; } GUILayout.EndHorizontal(); GUILayout.Space(2); } } }
public void DrawSelectorWindow(int id) { GUILayout.BeginHorizontal(); { GUI.enabled = false; GUILayout.Button("-KK-", UIMain.DeadButton, GUILayout.Height(21)); GUILayout.FlexibleSpace(); GUILayout.Button("Launchsite Selector", UIMain.DeadButton, GUILayout.Height(21)); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("X", UIMain.DeadButtonRed, GUILayout.Height(21))) { this.Close(); return; } } GUILayout.EndHorizontal(); GUILayout.Space(1); GUILayout.Box(UIMain.tHorizontalSep, UIMain.BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.BeginHorizontal(); { GUILayout.Space(5); if (MiscUtils.isCareerGame()) { if (GUILayout.Button(new GUIContent(showOpen ? UIMain.tOpenBasesOn : UIMain.tOpenBasesOff, "Open"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { if (showOpen) { showOpen = false; showClosed = true; } else { showOpen = true; } } if (GUILayout.Button(new GUIContent(showClosed ? UIMain.tClosedBasesOn : UIMain.tClosedBasesOff, "Closed"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { if (showClosed) { showClosed = false; showOpen = true; } else { showClosed = true; } } GUILayout.FlexibleSpace(); } if (GUILayout.Button(new GUIContent(showFavOnly ? UIMain.tFavesOn : UIMain.tFavesOff, "Only Favourites"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { showFavOnly = !showFavOnly; } GUILayout.FlexibleSpace(); if (EditorDriver.editorFacility == EditorFacility.SPH) { GUI.enabled = false; } isSelected = (showAllcategorys || (category == LaunchSiteCategory.RocketPad)); if (GUILayout.Button(new GUIContent(isSelected? UIMain.tLaunchpadsOn : UIMain.tLaunchpadsOff, "Rocketpads"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { category = LaunchSiteCategory.RocketPad; showAllcategorys = false; } GUI.enabled = true; GUILayout.Space(2); if (EditorDriver.editorFacility == EditorFacility.VAB) { GUI.enabled = false; } isSelected = (showAllcategorys || (category == LaunchSiteCategory.RocketPad)); if (GUILayout.Button(new GUIContent(isSelected ? UIMain.tRunwaysOn : UIMain.tRunwaysOff, "Runways"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { category = LaunchSiteCategory.Runway; showAllcategorys = false; } GUI.enabled = true; GUILayout.Space(2); if (EditorDriver.editorFacility == EditorFacility.VAB) { GUI.enabled = false; } isSelected = (showAllcategorys || (category == LaunchSiteCategory.Helipad)); if (GUILayout.Button(new GUIContent(isSelected ? UIMain.tHelipadsOn: UIMain.tHelipadsOff, "Helipads"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { category = LaunchSiteCategory.Helipad; showAllcategorys = false; } GUI.enabled = true; GUILayout.Space(2); if (EditorDriver.editorFacility == EditorFacility.VAB) { GUI.enabled = false; } isSelected = (showAllcategorys || (category == LaunchSiteCategory.Waterlaunch)); if (GUILayout.Button(new GUIContent(isSelected ? UIMain.tWaterOn : UIMain.tWaterOff, "WalterLaunch"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { category = LaunchSiteCategory.Waterlaunch; showAllcategorys = false; } GUI.enabled = true; GUILayout.Space(2); isSelected = (showAllcategorys || (category == LaunchSiteCategory.Other)); if (GUILayout.Button(new GUIContent(isSelected ? UIMain.tOtherOn : UIMain.tOtherOff, "Other"), UIMain.ButtonKK, GUILayout.Width(32), GUILayout.Height(32))) { category = LaunchSiteCategory.Other; showAllcategorys = false; } GUILayout.FlexibleSpace(); if (GUILayout.Button("ALL", GUILayout.Width(32), GUILayout.Height(32))) { showAllcategorys = true; } } GUILayout.EndHorizontal(); GUILayout.Space(10); sitesScrollPosition = GUILayout.BeginScrollView(sitesScrollPosition); { foreach (KKLaunchSite site in LaunchSiteManager.allLaunchSites) { if (showFavOnly && (site.favouriteSite != "Yes")) { continue; } if (category != site.sitecategory && !showAllcategorys) { continue; } if (LaunchSiteManager.CheckLaunchSiteIsValid(site) == false) { continue; } if (MiscUtils.isCareerGame()) { if ((!showOpen && site.isOpen) || (!showClosed && !site.isOpen)) { continue; } // Don't show hidden closed Bases if (site.LaunchSiteIsHidden && (!site.isOpen)) { continue; } } GUILayout.BeginHorizontal(); { ShowOpenStatus(site); launchButtonName = site.LaunchSiteName; if (site.LaunchSiteName == "Runway") { launchButtonName = "KSC Runway"; } if (site.LaunchSiteName == "LaunchPad") { launchButtonName = "KSC LaunchPad"; } GUI.enabled = (selectedSite != site); if (GUILayout.Button(launchButtonName, GUILayout.Height(30))) { selectedSite = site; BaseManager.selectedSite = selectedSite; //if (!MiscUtils.isCareerGame()) //{ // LaunchSiteManager.setLaunchSite(site); // smessage = "Launchsite set to " + launchButtonName; // MiscUtils.HUDMessage(smessage, 10, 2); //} } GUI.enabled = true; ShowOpenStatus(site); } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); GUILayout.Space(5); sCurrentSite = LaunchSiteManager.getCurrentLaunchSite(); switch (sCurrentSite) { case "Runway": GUILayout.Box("Current Launchsite: KSC Runway"); break; case "LaunchPad": GUILayout.Box("Current Launchsite: KSC LaunchPad"); break; default: GUILayout.Box("Current Launchsite: " + sCurrentSite); break; } GUI.enabled = (selectedSite.isOpen && (selectedSite.LaunchSiteName != sCurrentSite)); if (GUILayout.Button("Set as Launchsite", GUILayout.Height(46))) { LaunchSiteManager.setLaunchSite(selectedSite); MiscUtils.HUDMessage(selectedSite.LaunchSiteName + " has been set as the launchsite", 10, 0); } GUI.enabled = true; GUILayout.BeginHorizontal(); { GUI.enabled = false; if ((selectedSite.isOpen) && (EditorDriver.editorFacility == EditorFacility.SPH) && (KerbalKonstructs.instance.defaultSPHlaunchsite != selectedSite.LaunchSiteName)) { GUI.enabled = true; } if ((selectedSite.isOpen) && (EditorDriver.editorFacility == EditorFacility.VAB) && (KerbalKonstructs.instance.defaultVABlaunchsite != selectedSite.LaunchSiteName)) { GUI.enabled = true; } if (GUILayout.Button("Set as Default", GUILayout.Height(23))) { if (selectedSite != null) { MiscUtils.HUDMessage(selectedSite.LaunchSiteName + " has been set as the default", 10, 0); if (EditorDriver.editorFacility == EditorFacility.SPH) { KerbalKonstructs.instance.defaultSPHlaunchsite = selectedSite.LaunchSiteName; } if (EditorDriver.editorFacility == EditorFacility.VAB) { KerbalKonstructs.instance.defaultVABlaunchsite = selectedSite.LaunchSiteName; } } } GUI.enabled = true; if (GUILayout.Button("Use Default", GUILayout.Height(23))) { selectedSite = LaunchSiteManager.GetDefaultSite(); LaunchSiteManager.setLaunchSite(selectedSite); MiscUtils.HUDMessage(selectedSite.LaunchSiteName + " has been set as the launchsite", 10, 0); BaseManager.selectedSite = selectedSite; } } GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Box(UIMain.tHorizontalSep, UIMain.BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUI.enabled = true; if (GUI.tooltip != "") { var labelSize = GUI.skin.GetStyle("Label").CalcSize(new GUIContent(GUI.tooltip)); GUI.Box(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y + 20, labelSize.x + 5, labelSize.y + 6), GUI.tooltip, UIMain.KKToolTip); } GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
internal void ReadSettings() { if (selectedObject.hasLauchSites) { //LaunchSite myLaunchSite = new LaunchSite(); string sLaunchsiteDesc = selectedObject.launchSite.LaunchSiteDescription; string sModelDesc = selectedObject.model.description; // Edit or make a launchsite siteName = selectedObject.launchSite.LaunchSiteName; siteTrans = selectedObject.launchSite.LaunchPadTransform; if (sLaunchsiteDesc != "") { siteDesc = sLaunchsiteDesc; } else { siteDesc = sModelDesc; } siteHidden = selectedObject.launchSite.LaunchSiteIsHidden.ToString(); ILSActive = selectedObject.launchSite.ILSIsActive.ToString(); siteType = selectedObject.launchSite.LaunchSiteType; flOpenCost = selectedObject.launchSite.OpenCost; flCloseValue = selectedObject.launchSite.CloseValue; stOpenCost = string.Format("{0}", flOpenCost); stCloseValue = string.Format("{0}", flCloseValue); category = selectedObject.launchSite.sitecategory; initialCameraRotation = selectedObject.launchSite.InitialCameraRotation.ToString(); flLength = selectedObject.launchSite.LaunchSiteLength; if (flLength < 1) { flLength = selectedObject.model.DefaultLaunchSiteLength; } flWidth = selectedObject.launchSite.LaunchSiteWidth; if (flWidth < 1) { flWidth = selectedObject.model.DefaultLaunchSiteWidth; } } else { string sModelDesc = selectedObject.model.description; // Edit or make a launchsite siteName = selectedObject.gameObject.name; siteTrans = selectedObject.model.DefaultLaunchPadTransform; siteDesc = selectedObject.model.description; siteHidden = "false"; ILSActive = "false"; siteType = SiteType.Any; flOpenCost = 0f; flCloseValue = 0f; stOpenCost = string.Format("{0}", flOpenCost); stCloseValue = string.Format("{0}", flCloseValue); initialCameraRotation = "90"; category = LaunchSiteCategory.Other; flLength = selectedObject.model.DefaultLaunchSiteLength; flWidth = selectedObject.model.DefaultLaunchSiteWidth; } stLength = string.Format("{0}", flLength); stWidth = string.Format("{0}", flWidth); siteAuthor = selectedObject.model.author; // Debug.Log("KK: Making or editing a launchsite"); }
internal void SaveSettings() { bool addToDB = false; if (!selectedObject.hasLauchSites) { Log.Normal("Creating LaunchSite"); KKLaunchSite lsite = new KKLaunchSite(); selectedObject.launchSite = lsite; Log.Normal("created; lsite = " + lsite + "; launch site = " + selectedObject.launchSite); selectedObject.hasLauchSites = true; lsite.staticInstance = selectedObject; selectedObject.launchSite.body = selectedObject.CelestialBody; addToDB = true; } string oldName = selectedObject.launchSite.LaunchSiteName; LaunchSiteCategory oldCategory = category; bool oldState = selectedObject.launchSite.ILSIsActive; selectedObject.launchSite.LaunchSiteName = siteName; selectedObject.launchSite.LaunchSiteLength = float.Parse(stLength); selectedObject.launchSite.LaunchSiteWidth = float.Parse(stWidth); selectedObject.launchSite.LaunchSiteType = siteType; selectedObject.launchSite.LaunchPadTransform = siteTrans; selectedObject.launchSite.LaunchSiteDescription = siteDesc; selectedObject.launchSite.OpenCost = float.Parse(stOpenCost); selectedObject.launchSite.CloseValue = float.Parse(stCloseValue); selectedObject.launchSite.LaunchSiteIsHidden = bool.Parse(siteHidden); selectedObject.launchSite.ILSIsActive = bool.Parse(ILSActive); selectedObject.launchSite.LaunchSiteAuthor = siteAuthor; selectedObject.launchSite.refLat = (float)selectedObject.RefLatitude; selectedObject.launchSite.refLon = (float)selectedObject.RefLongitude; selectedObject.launchSite.refAlt = selectedObject.RadiusOffset; selectedObject.launchSite.sitecategory = category; selectedObject.launchSite.InitialCameraRotation = float.Parse(initialCameraRotation); if (ILSConfig.DetectNavUtils()) { Log.Normal("NavUtils detected"); Log.Debug("object: " + selectedObject); Log.Debug("launchsite: " + selectedObject.launchSite); Log.Debug("body: " + selectedObject.launchSite.body); bool regenerateILSConfig = false; Log.Debug("old name: " + oldName); Log.Debug("new name: " + selectedObject.launchSite.LaunchSiteName); if (oldName != null && !oldName.Equals(siteName)) { ILSConfig.RenameSite(selectedObject.launchSite.LaunchSiteName, siteName); regenerateILSConfig = true; } Log.Debug("old category: " + oldCategory); if ((oldCategory != category)) { ILSConfig.HandleCategoryChange(selectedObject); regenerateILSConfig = true; } bool state = bool.Parse(ILSActive); Log.Normal("new state: " + state + "; old state: " + oldState); if (oldState != state || regenerateILSConfig) { if (state) { ILSConfig.GenerateFullILSConfig(selectedObject); } else { ILSConfig.DropILSConfig(selectedObject.launchSite.LaunchSiteName, true); } } } if (addToDB) { selectedObject.launchSite.ParseLSConfig(selectedObject, null); selectedObject.SaveConfig(); EditorGUI.instance.enableColliders = true; selectedObject.ToggleAllColliders(true); LaunchSiteManager.RegisterLaunchSite(selectedObject.launchSite); } selectedObject.SaveConfig(); }
/// <summary> /// Launchsite Editor /// </summary> /// <param name="id"></param> void drawLaunchSiteEditorWindow(int id) { GUILayout.BeginHorizontal(); { GUI.enabled = false; GUILayout.Button("-KK-", DeadButton, GUILayout.Height(21)); GUILayout.FlexibleSpace(); GUILayout.Button("Launchsite Editor", DeadButton, GUILayout.Height(21)); GUILayout.FlexibleSpace(); GUI.enabled = true; if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(21))) { this.Close(); } } GUILayout.EndHorizontal(); GUILayout.Space(1); GUILayout.Box(UIMain.tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUILayout.Box(selectedObject.model.title); GUILayout.BeginHorizontal(); GUILayout.Label("Site Name: ", GUILayout.Width(120)); siteName = GUILayout.TextField(siteName, GUILayout.Height(19)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Transform: ", GUILayout.Width(120)); GUILayout.Box("" + siteTrans); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Length: ", GUILayout.Width(120)); stLength = GUILayout.TextField(stLength, GUILayout.Height(19)); GUILayout.Label(" m"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Width: ", GUILayout.Width(120)); stWidth = GUILayout.TextField(stWidth, GUILayout.Height(19)); GUILayout.Label(" m"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("SpaceCenter Camera rotation: ", GUILayout.Width(220)); initialCameraRotation = (GUILayout.TextField(initialCameraRotation, GUILayout.Height(19))); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Site Category: ", GUILayout.Width(115)); GUILayout.Label(category.ToString(), GUILayout.Width(85)); GUILayout.FlexibleSpace(); GUI.enabled = (category != LaunchSiteCategory.RocketPad); if (GUILayout.Button("RP", GUILayout.Width(25), GUILayout.Height(23))) { category = LaunchSiteCategory.RocketPad; } GUI.enabled = (category != LaunchSiteCategory.Runway); if (GUILayout.Button("RW", GUILayout.Width(25), GUILayout.Height(23))) { category = LaunchSiteCategory.Runway; } GUI.enabled = (category != LaunchSiteCategory.Helipad); if (GUILayout.Button("HP", GUILayout.Width(25), GUILayout.Height(23))) { category = LaunchSiteCategory.Helipad; } GUI.enabled = (category != LaunchSiteCategory.Waterlaunch); if (GUILayout.Button("WA", GUILayout.Width(25), GUILayout.Height(23))) { category = LaunchSiteCategory.Waterlaunch; } GUI.enabled = (category != LaunchSiteCategory.Other); if (GUILayout.Button("OT", GUILayout.Width(25), GUILayout.Height(23))) { category = LaunchSiteCategory.Other; } GUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.Label("Site Type: ", GUILayout.Width(120)); GUILayout.Label(siteType.ToString(), GUILayout.Width(40)); GUILayout.FlexibleSpace(); GUI.enabled = !(siteType == (SiteType)0); if (GUILayout.Button("VAB", GUILayout.Height(23))) { siteType = SiteType.VAB; } GUI.enabled = !(siteType == (SiteType)1); if (GUILayout.Button("SPH", GUILayout.Height(23))) { siteType = SiteType.SPH; } GUI.enabled = !(siteType == (SiteType)2); if (GUILayout.Button("Any", GUILayout.Height(23))) { siteType = SiteType.Any; } GUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.Label("Author: ", GUILayout.Width(120)); siteAuthor = GUILayout.TextField(siteAuthor, GUILayout.Height(19)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Open Cost: ", GUILayout.Width(120)); stOpenCost = GUILayout.TextField(stOpenCost, GUILayout.Height(19)); GUILayout.Label(" \\F"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Close Value: ", GUILayout.Width(120)); stCloseValue = GUILayout.TextField(stCloseValue, GUILayout.Height(19)); GUILayout.Label(" \\F"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Site is hidden: ", GUILayout.Width(115)); GUILayout.Label(siteHidden, GUILayout.Width(85)); GUILayout.FlexibleSpace(); GUI.enabled = !(siteHidden == "false"); if (GUILayout.Button("No", GUILayout.Width(40), GUILayout.Height(23))) { siteHidden = "false"; } GUI.enabled = !(siteHidden == "true"); if (GUILayout.Button("Yes", GUILayout.Width(40), GUILayout.Height(23))) { siteHidden = "true"; } GUI.enabled = true; GUILayout.EndHorizontal(); //if (ILSConfig.DetectNavUtils ()) { // NavUtilities config generator GUILayout.BeginHorizontal(); GUILayout.Label("ILS/HSI on (NavUtilities)", GUILayout.Width(115)); GUILayout.Label(ILSActive, GUILayout.Width(85)); GUILayout.FlexibleSpace(); GUI.enabled = !(ILSActive == "false"); if (GUILayout.Button("No", GUILayout.Width(40), GUILayout.Height(23))) { ILSActive = "false"; } GUI.enabled = !(ILSActive == "true"); if (GUILayout.Button("Yes", GUILayout.Width(40), GUILayout.Height(23))) { ILSActive = "true"; } GUILayout.EndHorizontal(); //} GUI.enabled = true; GUILayout.Label("Description: "); descScroll = GUILayout.BeginScrollView(descScroll); siteDesc = GUILayout.TextArea(siteDesc, GUILayout.ExpandHeight(true)); GUILayout.EndScrollView(); GUI.enabled = true; GUILayout.BeginHorizontal(); GUI.enabled = siteName.Length > 0; if (GUILayout.Button("Save", GUILayout.Width(115), GUILayout.Height(23))) { SaveSettings(); this.Close(); } GUI.enabled = true; GUILayout.FlexibleSpace(); if (GUILayout.Button("Cancel", GUILayout.Width(115), GUILayout.Height(23))) { this.Close(); } GUILayout.EndHorizontal(); GUILayout.Label("NOTE: The SC angle is for a better initial vew on your SpaceCenter on the SC scene"); GUILayout.Space(1); GUILayout.Box(UIMain.tHorizontalSep, BoxNoBorder, GUILayout.Height(4)); GUILayout.Space(2); GUI.DragWindow(new Rect(0, 0, 10000, 10000)); }
internal void ReadSettings() { if (selectedObject.hasLauchSites) { //LaunchSite myLaunchSite = new LaunchSite(); string sLaunchsiteDesc = selectedObject.launchSite.LaunchSiteDescription; string sModelDesc = selectedObject.model.description; // Edit or make a launchsite siteName = selectedObject.launchSite.LaunchSiteName; siteTrans = selectedObject.launchSite.LaunchPadTransform; if (sLaunchsiteDesc != "") { siteDesc = sLaunchsiteDesc; } else { siteDesc = sModelDesc; } siteHidden = selectedObject.launchSite.LaunchSiteIsHidden.ToString(); ILSActive = selectedObject.launchSite.ILSIsActive.ToString(); siteType = selectedObject.launchSite.LaunchSiteType; flOpenCost = selectedObject.launchSite.OpenCost; flCloseValue = selectedObject.launchSite.CloseValue; stOpenCost = string.Format("{0}", flOpenCost); stCloseValue = string.Format("{0}", flCloseValue); category = selectedObject.launchSite.sitecategory; initialCameraRotation = selectedObject.launchSite.InitialCameraRotation.ToString(); togglePositioning = selectedObject.launchSite.ToggleLaunchPositioning; stLength = Math.Round(selectedObject.launchSite.LaunchSiteLength, 0).ToString(); stWidth = Math.Round(selectedObject.launchSite.LaunchSiteWidth, 0).ToString(); stHeight = Math.Round(selectedObject.launchSite.LaunchSiteHeight, 0).ToString(); sMaxMass = Math.Round(selectedObject.launchSite.MaxCraftMass, 0).ToString(); sMaxParts = selectedObject.launchSite.MaxCraftParts.ToString(); } else { string sModelDesc = selectedObject.model.description; // Edit or make a launchsite siteName = selectedObject.gameObject.name; siteTrans = selectedObject.model.DefaultLaunchPadTransform; siteDesc = selectedObject.model.description; siteHidden = "false"; ILSActive = "false"; siteType = SiteType.Any; flOpenCost = 0f; flCloseValue = 0f; stOpenCost = string.Format("{0}", flOpenCost); stCloseValue = string.Format("{0}", flCloseValue); initialCameraRotation = "90"; togglePositioning = false; category = LaunchSiteCategory.Other; stLength = Math.Round(selectedObject.model.DefaultLaunchSiteLength, 0).ToString(); stWidth = Math.Round(selectedObject.model.DefaultLaunchSiteWidth, 0).ToString(); stHeight = Math.Round(selectedObject.model.DefaultLaunchSiteHeight, 0).ToString(); sMaxMass = Math.Round(selectedObject.model.DefaultLaunchSiteMaxMass, 0).ToString(); sMaxParts = selectedObject.model.DefaultLaunchSiteMaxParts.ToString(); ; } siteAuthor = selectedObject.model.author; // Debug.Log("KK: Making or editing a launchsite"); }