void SettingsWindowFcn(int windowID) { GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Enter desired hotkey: "); GUILayout.Label(hotkey.ToString(), GUI.skin.textField); if (_lastKeyPressed != KeyCode.None) { hotkey = _lastKeyPressed; _lastKeyPressed = KeyCode.None; } // look at EEX GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("OK", GUILayout.Width(60))) { active = false; completed = true; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.DragWindow(); }
private void DrawTitle(String text) { GUILayout.BeginHorizontal(); GUILayout.Label(text, HighLogic.Skin.label); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); }
private void DrawSettingsGUI(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Settings are now in the stock settings"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("(old settings, if any, were NOT migrated)"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", GUILayout.Width(60))) { showWindow = false; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(); }
/* * Saved Message */ private void HandleSavedDisplay(int windowID) { bool MMPathLoaderIsReady = DatabaseHandler.isModuleManagerInstalled ? (bool)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("IsReady") : false; GUILayout.BeginVertical(); if (DatabaseHandler.isReloading) { ScreenMessages.PostScreenMessage(string.Concat(Constants.guiDBReloading1, "\n", Constants.guiDBReloading2), Time.deltaTime, ScreenMessageStyle.UPPER_CENTER); GUILayout.Label(Constants.guiDBReloading1); GUILayout.Label(Constants.guiDBReloading2); if (!MMPathLoaderIsReady) { GUILayout.Label(String.Format("ModuleManager progress: {0:P0}", (float)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("ProgressFraction"))); // GUILayout.Label(String.Format("{0}", (string)DatabaseHandler.DynaInvokeMMPatchLoaderMethod("ProgressTitle"))); } } else { GUILayout.Label(Constants.guiDialSaved); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { this.state = DisplayState.none; ClearEditor(); } } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
/* * Overwrite Message */ private void HandleOverwriteDisplay(int windowID) { string welding_pathname = this.welding_pathname; // Caching the pathname GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialOverwrite); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(welding_pathname); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { WriteCfg(welding_pathname); this.state = DisplayState.savedWindow; } if (GUILayout.Button(Constants.guiCancel)) { this.state = DisplayState.infoWindow; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
private void LoadAndDisplay(string f) { if (!loaded) { Load(f); loaded = true; } int imgcnt = 0; string l = ""; foreach (string line in lines) { if (line.Length >= 7 && line.Substring(0, 7) == "<IMAGE=") { if (l.Length > 0) { GUILayout.BeginHorizontal(); GUILayout.Label(l); GUILayout.EndHorizontal(); l = ""; } if (imgcnt <= images.Count) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Box(images[imgcnt], GUILayout.Width(images[imgcnt].width + 10), GUILayout.Height(images[imgcnt].height + 10)); GUILayout.FlexibleSpace(); imgcnt++; GUILayout.EndHorizontal(); } } else { if (l == "") { l = line; } else { l += "\n" + line; } } } if (l.Length > 0) { GUILayout.BeginHorizontal(); GUILayout.Label(l); GUILayout.EndHorizontal(); l = ""; } }
/* * Warning Message */ private void HandleWarningDisplay(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialWarn); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { this.state = DisplayState.infoWindow; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
private void drawLanderSetting() { landerConfig.EnableSystem = GUILayout.Toggle(landerConfig.EnableSystem, "System Enable", toggleStyle); // descent rate landerConfig.EnableDescentRate = GUILayout.Toggle(landerConfig.EnableDescentRate, "Descent Rate", toggleStyle); GUILayout.Label(String.Format("Safety Factor: {0}", landerConfig.DescentRateSafetyFactor)); landerConfig.DescentRateSafetyFactor = (float)Math.Round(GUILayout.HorizontalSlider(landerConfig.DescentRateSafetyFactor, 1.0f, 4.0f), 1); GUILayout.BeginHorizontal(); { GUILayout.Label("Final Speed"); GUILayout.FlexibleSpace(); touchDownSpeedString = GUILayout.TextField(touchDownSpeedString, GUILayout.Height(30), GUILayout.Width(80)); GUILayout.Label(Util.GetShortString(landerConfig.UnitOfAltitude) + "/s"); } GUILayout.EndHorizontal(); // horizontal speed landerConfig.EnableHorizontalSpeed = GUILayout.Toggle(landerConfig.EnableHorizontalSpeed, "Horizontal Speed", toggleStyle); GUILayout.BeginHorizontal(); { GUILayout.Label("vh Check Alt"); GUILayout.FlexibleSpace(); horizontalSpeedCheckAltitudeString = GUILayout.TextField(horizontalSpeedCheckAltitudeString, GUILayout.Height(30), GUILayout.Width(80)); GUILayout.Label(Util.GetShortString(landerConfig.UnitOfAltitude)); } GUILayout.EndHorizontal(); GUILayout.Label(String.Format("Horizontal Speed Factor: {0}", landerConfig.HorizontalSpeedFactor)); landerConfig.HorizontalSpeedFactor = (float)Math.Round(GUILayout.HorizontalSlider(landerConfig.HorizontalSpeedFactor, 0.01f, 1.0f), 2); // altitude landerConfig.EnableAltitudeCallouts = GUILayout.Toggle(landerConfig.EnableAltitudeCallouts, "Altitude Callouts", toggleStyle); // retard landerConfig.EnableRetard = GUILayout.Toggle(landerConfig.EnableRetard, "Retard", toggleStyle); }
/* * Error Message */ private void HandleErrorDisplay(int windowID) { GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Label(Constants.guiDialFail); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button(Constants.guiOK)) { EditorLockManager.unlockEditor(Constants.settingWeldingLock); this.state = DisplayState.none; } GUILayout.EndVertical(); GUI.DragWindow(); } //private void OnErrorDisplay()
private void IntroWindow(int id) { LoadAndDisplay(KSPUtil.ApplicationRootPath + "GameData/" + IntroPath); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("OK", GUILayout.Width(120))) { showHelp = false; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Hide this window at startup")) { showHelp = false; showIntroAtStartup = false; ToolbarControl.SaveData(); } GUILayout.EndHorizontal(); GUI.DragWindow(); }
void ConfirmDelete(int id) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label("Confirm delete of " + this.presets.GetVictimName()); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Cancel")) { deleteEnabled = false; confirmDeleteEnabled = false; } if (GUILayout.Button("Yes")) { //deleteEnabled = false; confirmDeleteEnabled = false; this.presets.Commit(); } GUILayout.EndHorizontal(); }
public override void OnRender() { try { List <Part> parts = EditorLogic.fetch.ship != null ? EditorLogic.fetch.ship.Parts : new List <Part>(); this.highlight.BeginTracking(); GUILayout.BeginVertical(); #if false // If Blizzy's toolbar is available, give the user the option to pick the stock toolbar. if (ToolbarManager.ToolbarAvailable) #endif { //bool stockToolbar = PartWizardPlugin.ToolbarIsStock; bool stockToolbar = GUILayout.Toggle(PartWizardPlugin.ToolbarIsStock, Localized.UseStockToolbar, GUILayout.Width(200)); if (stockToolbar != PartWizardPlugin.ToolbarIsStock) { #if false PartWizardPlugin.ToolbarTypeToggleActive = true; #endif PartWizardPlugin.ToolbarIsStock = stockToolbar; PartWizardPlugin.Instance.SaveToolbarConfiguration(); } } #region Display Mode Control GUILayout.BeginHorizontal(); this.viewType = (ViewType)GUIControls.HorizontalToggleSet((int)this.viewType, this.viewTypeContents, this.selectedViewTypeStyle, this.unselectedViewTypeStyle); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Sort by:"); this.sortBy = (SortBy)GUIControls.HorizontalToggleSet((int)this.sortBy, this.sortTypeContents, this.selectedViewTypeStyle, this.unselectedViewTypeStyle); GUILayout.EndHorizontal(); List <Part> buyableParts = null; if (this.viewType == ViewType.Hidden) { parts = parts.FindAll((p) => { return(p.partInfo.category == PartCategories.none); }); } else if (this.viewType == ViewType.Unavailable) { parts = parts.FindAll((p) => { bool result = false; // Get the R&D technology state for the current part. ProtoTechNode techState = ResearchAndDevelopment.Instance.GetTechState(p.partInfo.TechRequired); // If there is a state or the technology is locked or the part hasn't been purchased... if (techState == null || techState.state != RDTech.State.Available || !techState.partsPurchased.Contains(p.partInfo)) { // ...add it to the list. result = true; } return(result); }); Debug.Log("total # buyable part: " + parts.Count.ToString()); // Stash the filtered list in to the buyable list. buyableParts = parts; // Create a new collection with a copy of all the buyable parts. parts = new List <Part>(buyableParts); // Create a hash set to act as a filter for duplicate parts. HashSet <string> duplicatePartFilter = new HashSet <string>(); // Remove each part that has already been added to the hash filter. parts.RemoveAll((p) => !duplicatePartFilter.Add(p.name)); // Here parts is a list of unique buyable parts and buyableParts is all of the buyable parts, including duplicates. Debug.Log("total # buyable part after dup filter: " + parts.Count.ToString()); } #endregion if (parts != null && parts.Count > 0) { switch (sortBy) { case SortBy.Name: parts.Sort((p, q) => p.partInfo.title.CompareTo(q.partInfo.title)); break; case SortBy.StageAsc: if (this.viewType != ViewType.Unavailable) { parts.Sort((p, q) => p.inverseStage.CompareTo(q.inverseStage)); } else { parts.Sort((p, q) => p.partInfo.title.CompareTo(q.partInfo.title)); } break; case SortBy.StageDesc: if (this.viewType != ViewType.Unavailable) { parts.Sort((q, p) => p.inverseStage.CompareTo(q.inverseStage)); } else { parts.Sort((p, q) => p.partInfo.title.CompareTo(q.partInfo.title)); } break; } } #region Part List GUILayout.BeginVertical(GUIControls.PanelStyle); this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, false, false); int totalEntryCost = 0; int visiblePartCount = 0; int lastStage = 0; if (parts != null && parts.Count > 0) { lastStage = parts[0].inverseStage; } if (this.viewType == ViewType.Category) { if (GUILayout.Button(Localized.ViewAll)) { for (int i = 0; i < visibleCategories.Length; i++) { visibleCategories[i] = true; } } if (GUILayout.Button(Localized.Clear)) { for (int i = 0; i < visibleCategories.Length; i++) { visibleCategories[i] = false; } } for (PartCategories partCategories = PartCategories.Propulsion; partCategories < PartCategories.Coupling; partCategories++) { // Need to add one to the PartCategories because "none" is a -1, and some parts have a category = none visibleCategories[(int)partCategories + 1] = GUILayout.Toggle(visibleCategories[(int)partCategories + 1], partCategories.ToString(), toggleStyle); } } else if (this.viewType == ViewType.Resources) { if (GUILayout.Button(Localized.ViewAll)) { foreach (ResourceInfo resourceInfo in this.availableResources.Values) { resourceInfo.Visible = true; } } if (GUILayout.Button(Localized.Clear)) { foreach (ResourceInfo resourceInfo in this.availableResources.Values) { resourceInfo.Visible = false; } } foreach (string availableResource in this.availableResources.Keys) { bool resourceVisible = GUILayout.Toggle(this.availableResources[availableResource].Visible, availableResource, toggleStyle); this.availableResources[availableResource].Visible = resourceVisible; } } else { foreach (Part part in parts) { // Reset part name label color to default; some conditions may change the color to indicate various things. labelStyle.normal.textColor = PartWizardWindow.DefaultPartNameColor; // Check if this part's category is currently visible. // Need to add one to the PartCategories because "none" is a -1, and some parts have a category = none if (visibleCategories[(int)part.partInfo.category + 1]) { // The part's category is visible, now check resource conditions to determine final visibility. bool partVisible = false; if (this.availableResources[Localized.ShowPartsWithoutResources].Visible && part.Resources.Count == 0) { partVisible = true; } else { foreach (PartResource partResource in part.Resources) { if (this.availableResources[partResource.resourceName].Visible) { partVisible = true; break; } } } if (partVisible) { totalEntryCost += part.partInfo.entryCost; visiblePartCount++; GUIControls.BeginMouseOverHorizontal(); bool actionEditorPartButtonMouseOver = false; #region Part Label if (sortBy == SortBy.StageAsc || sortBy == SortBy.StageDesc) { if (lastStage != part.inverseStage) { lastStage = part.inverseStage; } GUILayout.Label(lastStage.ToString() + ": "); } if (EditorLogic.fetch.editorScreen != EditorScreen.Actions) { // Check compound parts for integrity. if (part is CompoundPart) { CompoundPart compoundPart = (CompoundPart)part; if (compoundPart.attachState == CompoundPart.AttachState.Detached || compoundPart.attachState == CompoundPart.AttachState.Attaching || compoundPart.target == compoundPart.parent) { labelStyle.normal.textColor = Color.red; } } labelStyle.fixedWidth = 250; GUILayout.Label(new GUIContent(part.partInfo.title, part.partInfo.name), labelStyle); } else { Log.Write("EditorScreen.Actions, part: " + part.partInfo.title); if (GUIControls.MouseOverButton(new GUIContent(part.partInfo.title, part.partInfo.name), out actionEditorPartButtonMouseOver, this.actionEditorModePartButtonStyle)) { // Each part gets the EditorActionPartSelector added to it when the editor switches to the Actions screen. (And it // gets taken away when leaving that screen.) EditorActionPartSelector selector = part.GetComponent <EditorActionPartSelector>(); // Make sure we have it... if (selector != null) { // ...and select it. selector.Select(); Log.Write("Action editor selecting part {0}.", part.name); } } } #endregion // Adds space between the part name and the buttons (if any) associated with the part. GUILayout.FlexibleSpace(); // Only enable the following buttons if there is no actively selected part, but we want to have them drawn. GUI.enabled = EditorLogic.SelectedPart == null; bool deleted = false; // Will be set to true if the delete button was pressed. bool bought = false; // Will be set to true if the buy button was pressed. bool breakSymmetryMouseOver = false; // Will be set to true if the mouse is over the part's break symmetry button. bool deleteButtonMouseOver = false; // Will be set to true if the mouse is over the part's delete button. bool buyButtonMouseOver = false; // Will be set to true if the mouse is over the part's buy button. string deleteTooltip = default(string); string buyTooltip = default(string); if (this.viewType == ViewType.All || this.viewType == ViewType.Hidden) { #region Break Symmetry Button string breakabilityReport = default(string); GUI.enabled = EditorLogic.SelectedPart == null && EditorLogic.fetch.editorScreen == EditorScreen.Parts && PartWizard.HasBreakableSymmetry(part, out breakabilityReport); string breakSymmetryTooltip = GUI.enabled ? Localized.BreakSymmetryDescription : default(string); breakSymmetryMouseOver = false; if (GUIControls.MouseOverButton(new GUIContent(Localized.BreakSymmetryButtonText, breakSymmetryTooltip), out breakSymmetryMouseOver, Configuration.PartActionButtonWidth)) { this.symmetryEditorWindow.Part = part; if (!this.symmetryEditorWindow.Visible) { this.symmetryEditorWindow.Show(this); // Short circuit the mouse over for breaking symmetry when showing the Symmetry Editor in case it appears over top of this // button and immediately begins highlighting parts. This would cause *this* window's highlighting to be stuck on the part. breakSymmetryMouseOver = false; } } breakSymmetryMouseOver &= GUI.enabled; // Clear mouse over flag if the symmetry button was disabled. #endregion #region Delete Button GUI.enabled = EditorLogic.SelectedPart == null && EditorLogic.fetch.editorScreen == EditorScreen.Parts && PartWizard.IsDeleteable(part); deleteTooltip = GUI.enabled ? ((part.symmetryCounterparts.Count == 0) ? Localized.DeletePartSingularDescription : Localized.DeletePartPluralDescription) : default(string); if (GUIControls.MouseOverButton(new GUIContent(Localized.DeletePartButtonText, deleteTooltip), out deleteButtonMouseOver, Configuration.PartActionButtonWidth)) { PartWizard.Delete(part); // Set a flag so additional GUI logic can decide what to do in the case where a part is deleted. deleted = true; } deleteButtonMouseOver &= GUI.enabled; // Clear mouse over flag if the delete button was disabled. #endregion } else // this.viewType == ViewType.Unavailable { #region Buy Button GUI.enabled = EditorLogic.SelectedPart == null && (double)part.partInfo.entryCost <= Funding.Instance.Funds && PartWizard.IsBuyable(part); buyTooltip = GUI.enabled ? string.Format(Localized.BuyPartDescriptionTextFormat, part.partInfo.entryCost) : default(string); if (GUIControls.MouseOverButton(new GUIContent(Localized.BuyPartButtonText, buyTooltip), out buyButtonMouseOver, Configuration.PartActionButtonWidth)) { Log.Write("Buying part {0}.", part.name); PartWizard.Buy(part, true); // Set a flag so additional GUI logic can decide what to do in the case where a part is bought. bought = true; } buyButtonMouseOver &= GUI.enabled; // Clear mouse over flag if the buy button was disabled. #endregion } GUI.enabled = true; bool groupMouseOver = false; GUIControls.EndMouseOverHorizontal(out groupMouseOver); // End of row for this part. // If we deleted a part, then just jump out of the loop since the parts list has been modified. if (deleted || bought) { break; } #region Part Highlighting Control if (breakSymmetryMouseOver) { this.highlight.Add(part, Configuration.HighlightColorEditableSymmetryRoot, Configuration.HighlightColorEditableSymmetryCounterparts, true); } else if (deleteButtonMouseOver) { this.highlight.Add(part, Configuration.HighlightColorDeletablePart, Configuration.HighlightColorDeletableCounterparts, true); } else if (buyButtonMouseOver) { // TODO: Duplicate code! buyableParts.ForEach((p) => { if (part.name == p.name) { this.highlight.Add(p, Configuration.HighlightColorBuyablePart); } }); } else if (groupMouseOver) { if (viewType != ViewType.Unavailable) { Color highlightColor = (part == EditorLogic.RootPart) ? Configuration.HighlightColorRootPart : Configuration.HighlightColorSinglePart; Color counterpartHighlightColor = Configuration.HighlightColorCounterparts; if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) { highlightColor = Configuration.HighlightColorActionEditorTarget; counterpartHighlightColor = Configuration.HighlightColorActionEditorTarget; } this.highlight.Add(part, highlightColor, counterpartHighlightColor, false); } else { // TODO: Duplicate code! buyableParts.ForEach((p) => { if (part.name == p.name) { Log.Write("Highlighting 2 part: " + part.partInfo.title); this.highlight.Add(p, Configuration.HighlightColorBuyablePart, false); } }); } } else if (actionEditorPartButtonMouseOver) { Log.Write("Highlighting part: " + part.partInfo.title); this.highlight.Add(part, Configuration.HighlightColorActionEditorTarget, Configuration.HighlightColorActionEditorTarget); } #endregion } } } } GUILayout.EndScrollView(); GUILayout.EndVertical(); if (viewType == ViewType.Unavailable) { int buyableEntryCost = 0; bool enableBulkBuy = false; foreach (Part p in parts) { buyableEntryCost += p.partInfo.entryCost; enableBulkBuy |= PartWizard.IsBuyable(p); } GUI.enabled = parts.Count > 0 && (double)buyableEntryCost <= Funding.Instance.Funds && enableBulkBuy; bool buyAllMouseOver = false; if (GUIControls.MouseOverButton(new GUIContent(string.Format(Localized.BuyAllButtonTextFormat, buyableEntryCost)), out buyAllMouseOver)) { foreach (Part part in parts) { if (PartWizard.IsBuyable(part)) { Log.Write("Buying part {0}.", part.name); PartWizard.Buy(part, false); } } PartWizard.SaveGame(); } // TODO: Highlight all parts that will be bought by clicking Buy All. if (buyAllMouseOver) { buyableParts.ForEach((p) => { this.highlight.Add(p, Configuration.HighlightColorBuyablePart); }); } GUI.enabled = true; } #endregion #region Status Area // Push everything above this up, otherwise it will be centered vertically. GUILayout.FlexibleSpace(); if (viewType == ViewType.All || viewType == ViewType.Hidden || viewType == ViewType.Unavailable) { string status = default(string); if (!string.IsNullOrEmpty(GUI.tooltip)) { if (parts.Count != 1) { status = string.Format(CultureInfo.CurrentCulture, Localized.StatusLabelPluralTooltipTextFormat, visiblePartCount, GUI.tooltip, parts.Count - visiblePartCount); } else { status = string.Format(CultureInfo.CurrentCulture, Localized.StatusLabelSingularTooltipTextFormat, visiblePartCount, GUI.tooltip, parts.Count - visiblePartCount); } } else { if (parts.Count != 1) { status = string.Format(CultureInfo.CurrentCulture, Localized.StatusLabelPluralTextFormat, visiblePartCount, parts.Count - visiblePartCount); } else { status = string.Format(CultureInfo.CurrentCulture, Localized.StatusLabelSingularTextFormat, visiblePartCount, parts.Count - visiblePartCount); } } GUILayout.Label(status, this.tooltipLabelStyle); } #endregion GUILayout.EndVertical(); if (this.Visible && this.mouseOver) { this.highlight.EndTracking(); } else { this.highlight.CancelTracking(); } } catch (Exception e) { Log.Write("PartWizardWindow.OnRender() unexpected exception caught."); Log.Write(e.Message); Log.Write(e.StackTrace); this.highlight.CancelTracking(); throw; } finally { GUI.DragWindow(); } }
public override void OnRender() { try { GUILayout.BeginVertical(); this.scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, false); this.highlight.BeginTracking(); if (this.mouseOver) { this.highlight.Add(this.part, Configuration.HighlightColorSymmetryEditor, Configuration.HighlightColorSymmetryEditor); } for (int index = 0; index < this.symmetryGroups.Count; index++) { PartGroup group = this.symmetryGroups[index]; GUIControls.BeginMouseOverVertical(GUIControls.PanelStyle); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent(string.Format(CultureInfo.CurrentCulture, Localized.GroupLabelText, index + 1))); // Don't allow group removal if there is only one group. GUI.enabled = (this.symmetryGroups.Count > 1); if (GUILayout.Button(SymmetryEditorWindow.RemoveGroupButtonText)) { // If there's a group above, use it. If not, then use the one below. PartGroup destinationGroup = (index > 0) ? this.symmetryGroups[index - 1] : this.symmetryGroups[index + 1]; destinationGroup.MergeFrom(group); this.symmetryGroups.Remove(group); break; } GUILayout.EndHorizontal(); GUI.enabled = true; bool mouseOverPart = false; foreach (Part groupPart in group.Parts) { GUIControls.BeginMouseOverHorizontal(); GUILayout.Label(new GUIContent(groupPart.partInfo.title)); GUI.enabled = index < this.symmetryGroups.Count - 1; if (GUILayout.Button(SymmetryEditorWindow.MoveDownButtonText, Configuration.PartActionButtonWidth)) { PartGroup nextGroup = this.symmetryGroups[index + 1]; group.MoveTo(groupPart, nextGroup); break; } GUI.enabled = index > 0; if (GUILayout.Button(SymmetryEditorWindow.MoveUpButtonText, Configuration.PartActionButtonWidth)) { PartGroup previousGroup = this.symmetryGroups[index - 1]; group.MoveTo(groupPart, previousGroup); break; } GUI.enabled = true; bool mouseOverPartArea = false; GUIControls.EndMouseOverVertical(out mouseOverPartArea); if (mouseOverPartArea) { // First add the group with the child part color, recursively. this.highlight.Add(group, Configuration.HighlightColorEditableSymmetryChildParts, true); // Next add the group with the counterparts highlighted, non-recursively. this.highlight.Add(group, Configuration.HighlightColorCounterparts, false); // Last add the specific part, non-recursively. this.highlight.Add(groupPart, Configuration.HighlightColorSinglePart, false); mouseOverPart = true; } } bool groupMouseOver = false; GUIControls.EndMouseOverVertical(out groupMouseOver); if (!mouseOverPart && groupMouseOver) { this.highlight.Add(group, Configuration.HighlightColorEditableSymmetryCounterparts, true); } } // Enable the Add Group button only if there is enough symmetrical parts to fill it. GUI.enabled = (this.symmetryGroups.Count < (this.part.symmetryCounterparts.Count + 1)); if (GUILayout.Button(SymmetryEditorWindow.AddGroupButtonText)) { this.symmetryGroups.Add(new PartGroup()); } GUI.enabled = true; GUILayout.EndScrollView(); // Push everything above this up, otherwise it will be centered vertically. GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); #region OK Button if (GUILayout.Button(Localized.OK)) { int symmetricGroupsCreated = 0; int partsProcessed = 0; foreach (PartGroup group in this.symmetryGroups) { if (group.Parts.Count > 0) { partsProcessed += group.Count; Part symmetricRoot = group.Extract(0); PartWizard.CreateSymmetry(symmetricRoot, group.Parts); symmetricGroupsCreated++; #if DEBUG Log.WriteSymmetryReport(symmetricRoot); #endif } } Log.Write("Modified symmetry for {0}, creating {1} symmetric group(s) from {2} parts.", part.name, symmetricGroupsCreated, partsProcessed); this.Hide(); } #endregion #region Cancel Button if (GUILayout.Button(Localized.Cancel)) { this.Hide(); } #endregion GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (this.Visible && this.mouseOver) { this.highlight.EndTracking(); } else { this.highlight.CancelTracking(); } } catch (Exception e) { Log.Write("SymmetryEditorWindow.OnRender() unexpected exception caught."); Log.Write(e.Message); Log.Write(e.StackTrace); this.highlight.CancelTracking(); throw; } finally { GUI.DragWindow(); } }
private void Window(int id) { if (!cfgWinData) { cfgWinData = true; // newScreenshotAtIntervals = AS.configuration.screenshotAtIntervals; newInterval = AS.configuration.screenshotInterval; interval = newInterval.ToString(); newConvertToJPG = AS.configuration.convertToJPG; newKeepOrginalPNG = AS.configuration.keepOrginalPNG; newNoGUIOnScreenshot = AS.configuration.noGUIOnScreenshot; newGUIOnScreenshot = AS.configuration.guiOnScreenshot; newScreenshotPath = AS.configuration.screenshotPath; newFilename = AS.configuration.filename; newJPGQuality = AS.configuration.JPGQuality; JPGQuality = newJPGQuality.ToString(); newScreenshotOnSceneChange = AS.configuration.screenshotOnSceneChange; newOnSpecialEvent = AS.configuration.onSpecialEvent; newKeycode = AS.configuration.keycode; newprecrashSnapshots = AS.configuration.precrashSnapshots; newsecondsUntilImpact = AS.configuration.secondsUntilImpact; newhsAltitudeLimit = AS.configuration.hsAltitudeLimit; newhsMinVerticalSpeed = AS.configuration.hsMinVerticalSpeed; newhsScreenshotInterval = AS.configuration.hsScreenshotInterval; secondsUntilImpact = AS.configuration.secondsUntilImpact.ToString(); hsAltitudeLimit = AS.configuration.hsAltitudeLimit.ToString(); hsMinVerticalSpeed = AS.configuration.hsMinVerticalSpeed.ToString(); hsScreenshotInterval = AS.configuration.hsScreenshotInterval.ToString(); newsupersize = AS.configuration.supersize; strsupersize = AS.configuration.supersize.ToString(); newautoSave = AS.configuration.autoSave; newminBetweenSaves = AS.configuration.minBetweenSaves; minBetweenSaves = AS.configuration.minBetweenSaves.ToString(); newsavePrefix = AS.configuration.savePrefix; newnumToRotate = AS.configuration.numToRotate; numToRotate = AS.configuration.numToRotate.ToString(); newautoSaveOnGameStart = AS.configuration.autoSaveOnGameStart; } SetVisible(true); GUI.enabled = true; GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); //DrawTitle ("Options"); GUILayout.BeginArea(new Rect(10, 50, 375, 450)); GUILayout.BeginVertical(); DrawTitle("Screenshot Options"); //GUILayout.BeginHorizontal (); //GUILayout.Label ("Take screenshots at specified intervals: "); //GUILayout.FlexibleSpace (); //newScreenshotAtIntervals = GUILayout.Toggle (newScreenshotAtIntervals, ""); //GUILayout.EndHorizontal (); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot Interval in seconds: "); GUILayout.FlexibleSpace(); interval = GUILayout.TextField(interval, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Convert to JPG: "); GUILayout.FlexibleSpace(); newConvertToJPG = GUILayout.Toggle(newConvertToJPG, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Keep original PNG: "); GUILayout.FlexibleSpace(); newKeepOrginalPNG = GUILayout.Toggle(newKeepOrginalPNG, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("JPEG Quality (1-100):"); GUILayout.FlexibleSpace(); JPGQuality = GUILayout.TextField(JPGQuality, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Supersize images (0-4):"); GUILayout.FlexibleSpace(); strsupersize = GUILayout.TextField(strsupersize, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot path:"); GUILayout.FlexibleSpace(); // GUILayout.EndHorizontal (); // GUILayout.BeginHorizontal (); // GUILayout.FlexibleSpace (); newScreenshotPath = GUILayout.TextField(newScreenshotPath, GUILayout.MinWidth(50F), GUILayout.MaxWidth(250F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Filename Format:"); GUILayout.FlexibleSpace(); newFilename = GUILayout.TextField(newFilename, GUILayout.MinWidth(30F), GUILayout.MaxWidth(160F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot after scene change:"); GUILayout.FlexibleSpace(); newScreenshotOnSceneChange = GUILayout.Toggle(newScreenshotOnSceneChange, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot after special event:"); GUILayout.FlexibleSpace(); newOnSpecialEvent = GUILayout.Toggle(newOnSpecialEvent, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Use Blizzy Toolbar if available:"); GUILayout.FlexibleSpace(); newUseBlizzyToolbar = GUILayout.Toggle(newUseBlizzyToolbar, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Activation Keycode:"); GUILayout.FlexibleSpace(); newKeycode = GUILayout.TextField(newKeycode, GUILayout.MinWidth(30F), GUILayout.MaxWidth(40F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("No GUI on screenshot:"); GUILayout.FlexibleSpace(); newNoGUIOnScreenshot = GUILayout.Toggle(newNoGUIOnScreenshot, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("GUI on screenshot: "); GUILayout.FlexibleSpace(); newGUIOnScreenshot = GUILayout.Toggle(newGUIOnScreenshot, ""); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); GUILayout.BeginArea(new Rect(400, 50, 300, 400)); GUILayout.BeginVertical(); DrawTitle("Pre-Crash Settings"); GUILayout.BeginHorizontal(); GUILayout.Label("Take pre-crash snapshots:"); GUILayout.FlexibleSpace(); newprecrashSnapshots = GUILayout.Toggle(newprecrashSnapshots, ""); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Seconds until impact:"); secondsUntilImpact = GUILayout.TextField(secondsUntilImpact, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Altitude limit (meters):"); hsAltitudeLimit = GUILayout.TextField(hsAltitudeLimit, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(60.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Minimum vertical speed:"); hsMinVerticalSpeed = GUILayout.TextField(hsMinVerticalSpeed, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Screenshot interval (pre-crash):"); hsScreenshotInterval = GUILayout.TextField(hsScreenshotInterval, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(""); GUILayout.EndHorizontal(); DrawTitle("Automatic Save Settings"); GUILayout.BeginHorizontal(); GUILayout.Label("Activation Key (not configurable):"); GUILayout.FlexibleSpace(); GUILayout.Label("Ctrl-F6"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Minutes between saves:"); minBetweenSaves = GUILayout.TextField(minBetweenSaves, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Save file format:"); newsavePrefix = GUILayout.TextField(newsavePrefix, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(160.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Max save files:"); numToRotate = GUILayout.TextField(numToRotate, GUILayout.MinWidth(30.0F), GUILayout.MaxWidth(30.0F)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Autosave on at game start:"); GUILayout.FlexibleSpace(); newautoSaveOnGameStart = GUILayout.Toggle(newautoSaveOnGameStart, ""); GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.EndArea(); // // I probably don't need to have the "finally" sections, but // it doesn't hurt and will be there if I need it in the future // try { newInterval = Convert.ToSingle(Convert.ToDouble(interval)); } catch (Exception) { } finally { } try { newJPGQuality = Convert.ToUInt16(JPGQuality); } catch (Exception) { } finally { } try { newsecondsUntilImpact = Convert.ToUInt16(secondsUntilImpact); } catch (Exception) { } finally { } try { newhsAltitudeLimit = Convert.ToUInt16(hsAltitudeLimit); } catch (Exception) { } finally { } try { newhsMinVerticalSpeed = Convert.ToUInt16(hsMinVerticalSpeed); } catch (Exception) { } finally { } try { newhsScreenshotInterval = Convert.ToSingle(Convert.ToDouble(hsScreenshotInterval)); } catch (Exception) { } finally { } try { newsupersize = Convert.ToUInt16(strsupersize); if (newsupersize < 0) { newsupersize = 0; } if (newsupersize > AS.configuration.MAX_SUPERSIZE) { newsupersize = AS.configuration.MAX_SUPERSIZE; } } catch (Exception) { } finally { } try { newminBetweenSaves = Convert.ToUInt16(minBetweenSaves); } catch (Exception) { } finally { } try { newnumToRotate = Convert.ToUInt16(numToRotate); } catch (Exception) { } finally { } GUI.DragWindow(); }
private void drawPlaneSetting() { planeConfig.EnableSystem = GUILayout.Toggle(planeConfig.EnableSystem, "System Enable", toggleStyle); // descent rate config planeConfig.EnableDescentRate = GUILayout.Toggle(planeConfig.EnableDescentRate, "Descent Rate", toggleStyle); planeConfig.EnableClosureToTerrain = GUILayout.Toggle(planeConfig.EnableClosureToTerrain, "Closure to Terrain", toggleStyle); GUILayout.Label(String.Format("Descent Rate Factor: {0}", planeConfig.DescentRateFactor)); descentRateFactorExp = GUILayout.HorizontalSlider(descentRateFactorExp, -1.0f, 1.0f); planeConfig.DescentRateFactor = (float)Math.Round(Math.Pow(10, descentRateFactorExp), 1); // altitude loss planeConfig.EnableAltitudeLoss = GUILayout.Toggle(planeConfig.EnableAltitudeLoss, "Altitude Loss After Takeoff", toggleStyle); // terrain clearance planeConfig.EnableTerrainClearance = GUILayout.Toggle(planeConfig.EnableTerrainClearance, "Terrain Clearance", toggleStyle); GUILayout.BeginHorizontal(); { GUILayout.Label("Gear Alt"); GUILayout.FlexibleSpace(); tooLowGearAltitudeString = GUILayout.TextField(tooLowGearAltitudeString, GUILayout.Height(30), GUILayout.Width(80)); GUILayout.Label(Util.GetShortString(planeConfig.UnitOfAltitude)); } GUILayout.EndHorizontal(); // altitude planeConfig.EnableAltitudeCallouts = GUILayout.Toggle(planeConfig.EnableAltitudeCallouts, "Altitude Callouts", toggleStyle); // retard planeConfig.EnableRetard = GUILayout.Toggle(planeConfig.EnableRetard, "Retard", toggleStyle); // bank angle planeConfig.EnableTraffic = GUILayout.Toggle(planeConfig.EnableTraffic, "Traffic", toggleStyle); // traffic planeConfig.EnableBankAngle = GUILayout.Toggle(planeConfig.EnableBankAngle, "Bank Angle", toggleStyle); // v1 planeConfig.EnableV1 = GUILayout.Toggle(planeConfig.EnableV1, "V1", toggleStyle); // rotate planeConfig.EnableRotate = GUILayout.Toggle(planeConfig.EnableRotate, "Rotate", toggleStyle); // gear up planeConfig.EnableGearUp = GUILayout.Toggle(planeConfig.EnableGearUp, "Gear Up", toggleStyle); // stall GUILayout.BeginHorizontal(); { planeConfig.EnableStall = GUILayout.Toggle(planeConfig.EnableStall, "Stall", toggleStyle); GUILayout.Space(50); planeConfig.EnableStallShake = GUILayout.Toggle(planeConfig.EnableStallShake, "Shake", toggleStyle); } GUILayout.EndHorizontal(); GUILayout.Label(String.Format("Max AOA: {0} deg", planeConfig.StallAoa)); planeConfig.StallAoa = (float)Math.Round(GUILayout.HorizontalSlider(planeConfig.StallAoa, 0.0f, 180.0f), 0); // take off speed GUILayout.Label(String.Format("V1 Speed: {0} m/s", planeConfig.V1Speed)); planeConfig.V1Speed = (float)Math.Round(GUILayout.HorizontalSlider(planeConfig.V1Speed, 10.0f, 200.0f), 0); GUILayout.Label(String.Format("Take Off Speed: {0} m/s", planeConfig.TakeOffSpeed)); planeConfig.TakeOffSpeed = (float)Math.Round(GUILayout.HorizontalSlider(planeConfig.TakeOffSpeed, 10.0f, 200.0f), 0); // landing speed GUILayout.Label(String.Format("Landing Speed: {0} m/s", planeConfig.LandingSpeed)); planeConfig.LandingSpeed = (float)Math.Round(GUILayout.HorizontalSlider(planeConfig.LandingSpeed, 10.0f, 200.0f), 0); }
private void DoWindow(int id) { GUILayout.BeginHorizontal(); GUILayout.Label("For each mod, select which toolbar to put it's button on."); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("If the Blizzy toobar is not installed, all buttons will be put on the stock toolbar, regardless of the setting"); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Stock", GUILayout.Width(50)); GUILayout.Label("Blizzy", GUILayout.Width(50)); GUILayout.Label("Both", GUILayout.Width(50)); GUILayout.Label("None", GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); //ToolbarControl.sortedModList = ToolbarControl.sortedModList.OrderBy(x => x.displayName).ToList(); scrollVector = GUILayout.BeginScrollView(scrollVector, scrollbar_style, GUILayout.Height(scrollBarHeight)); foreach (ToolbarControl.Mod mod in ToolbarControl.sortedModList) { bool doUseButtons = false; GUILayout.BeginHorizontal(); bool stock = GUILayout.Toggle(mod.useStock, "", GUILayout.Width(60)); if (stock != mod.useStock) { if (ToolbarControl.registeredMods[mod.modId].useStock == ToolbarControl.registeredMods[mod.modId].useBlizzy && ToolbarControl.registeredMods[mod.modId].useStock) { ToolbarControl.registeredMods[mod.modId].useBlizzy = false; } else { ToolbarControl.registeredMods[mod.modId].useStock = stock; ToolbarControl.registeredMods[mod.modId].useBlizzy = !stock; } doUseButtons = true; } bool blizzy = GUILayout.Toggle(mod.useBlizzy, "", GUILayout.Width(50)); if (blizzy != ToolbarControl.registeredMods[mod.modId].useBlizzy) { if (ToolbarControl.registeredMods[mod.modId].useStock == ToolbarControl.registeredMods[mod.modId].useBlizzy && ToolbarControl.registeredMods[mod.modId].useBlizzy) { ToolbarControl.registeredMods[mod.modId].useStock = false; } else { ToolbarControl.registeredMods[mod.modId].useBlizzy = blizzy; ToolbarControl.registeredMods[mod.modId].useStock = !blizzy; } doUseButtons = true; } bool both = (stock & blizzy); bool newboth = GUILayout.Toggle(both, "", GUILayout.Width(50)); if (newboth != both) { ToolbarControl.registeredMods[mod.modId].useBlizzy = true; ToolbarControl.registeredMods[mod.modId].useStock = true; doUseButtons = true; } if (!ToolbarControl.registeredMods[mod.modId].noneAllowed) { GUI.enabled = false; } bool none = (!stock & !blizzy); bool newnone = GUILayout.Toggle(none, "", GUILayout.Width(25)); if (newnone != none) { ToolbarControl.registeredMods[mod.modId].useBlizzy = false; ToolbarControl.registeredMods[mod.modId].useStock = false; doUseButtons = true; } if (doUseButtons) { ToolbarControl.SaveData(); if (ToolbarControl.registeredMods[mod.modId].modToolbarControl != null) { ToolbarControl.registeredMods[mod.modId].modToolbarControl.UseButtons(mod.modId); } else { Log.Debug("mod.Key: " + mod.modId + " modToolbarControl is null"); } } GUI.enabled = true; GUILayout.Label(" " + mod.displayName); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close")) { GUIEnabled = false; } GUILayout.FlexibleSpace(); if (GUILayout.Button("?")) { IntroWindowClass.showHelp = true; IntroWindowClass.automoved = 0; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUI.DragWindow(); }
void OnWindowGUI(int id) { GUI.skin = HighLogic.Skin; Historian historian = Historian.Instance; // column one using (GUILayout.AreaScope columnOne = new GUILayout.AreaScope(new Rect(15, 20, 380, 550))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); historian.Suppressed = GUILayout.Toggle(historian.Suppressed, Localizer.GetStringByTag("#Historian_Suppressed")); historian.AlwaysActive = GUILayout.Toggle(historian.AlwaysActive, Localizer.GetStringByTag("#Historian_AlwaysActive")); historian.AutoHideUI = GUILayout.Toggle(historian.AutoHideUI, Localizer.GetStringByTag("#Historian_AutoHideUI")); Configuration.Instance.AutoHideUI = historian.AutoHideUI; Configuration.Instance.PersistentConfigurationWindow = GUILayout.Toggle(Configuration.Instance.PersistentConfigurationWindow, Localizer.GetStringByTag("#Historian_AlwaysShowConfigWindow")); Configuration.Instance.EnableLauncherButton = GUILayout.Toggle(Configuration.Instance.EnableLauncherButton, Localizer.GetStringByTag("#Historian_UseAppLauncher")); Configuration.Instance.EnableToolbarButton = GUILayout.Toggle(Configuration.Instance.EnableToolbarButton, Localizer.GetStringByTag("#Historian_UseToolbar")); GUILayout.Space(10); using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { int rightClickOptionsCount = 4; //GUILayout.Space(40); GUILayout.Label(Localizer.GetStringByTag("#Historian_RightClickAction")); GUILayout.Space(10); if (GUILayout.Button(previousButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { Configuration.Instance.RightClickAction = (RightClickAction)Mathf.Clamp((int)Configuration.Instance.RightClickAction - 1, 0, rightClickOptionsCount - 1); } else if (GUILayout.Button(nextButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { Configuration.Instance.RightClickAction = (RightClickAction)Mathf.Clamp((int)Configuration.Instance.RightClickAction + 1, 0, rightClickOptionsCount - 1); } GUILayout.Space(5); GUILayout.Label(Configuration.Instance.RightClickAction.ToString(), GUI.skin.textArea, GUILayout.ExpandWidth(true)); } ManageButtons(); GUILayout.Space(10); using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_Layout")); GUILayout.Space(10); string[] layouts = historian.GetLayoutNames(); if (GUILayout.Button(previousButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { historian.CurrentLayoutIndex = Mathf.Clamp(historian.CurrentLayoutIndex - 1, 0, layouts.Length - 1); } else if (GUILayout.Button(nextButtonTexture, GUILayout.Width(20), GUILayout.Height(GUI.skin.label.lineHeight))) { historian.CurrentLayoutIndex = Mathf.Clamp(historian.CurrentLayoutIndex + 1, 0, layouts.Length - 1); } GUILayout.Space(5); GUILayout.Label(historian.GetCurrentLayoutName(), GUI.skin.textArea, GUILayout.ExpandWidth(true)); } GUILayout.Space(10); using (GUILayout.HorizontalScope customHead = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_CustomText")); GUILayout.FlexibleSpace(); Configuration.Instance.PersistentCustomText = GUILayout.Toggle(Configuration.Instance.PersistentCustomText, Localizer.GetStringByTag("#Historian_Persistent"), GUILayout.Width(120)); } Configuration.Instance.CustomText = GUILayout.TextArea(Configuration.Instance.CustomText, GUI.skin.textArea, GUILayout.Height(60)); GUILayout.Space(10); using (GUILayout.HorizontalScope spaceCentre = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_DefaultSpaceCenterLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultSpaceCenterName = GUILayout.TextField(Configuration.Instance.DefaultSpaceCenterName, GUI.skin.textArea, GUILayout.Width(150)); } GUILayout.Space(10); GUILayout.Label($"{Localizer.GetStringByTag("#Historian_LastActionTime")}: {Configuration.Instance.TimeToRememberLastAction} ms"); Configuration.Instance.TimeToRememberLastAction = (int)GUILayout.HorizontalSlider(Configuration.Instance.TimeToRememberLastAction, 250, 10000, GUILayout.ExpandWidth(true)); } } // column two using (GUILayout.AreaScope columnTwo = new GUILayout.AreaScope(new Rect(410, 20, 220, 500))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); GUILayout.Label(Localizer.GetStringByTag("#Historian_DayNames")); for (int i = 0; i < Configuration.Instance.KerbinDayNames.Length; i++) { using (GUILayout.HorizontalScope item = new GUILayout.HorizontalScope()) { GUILayout.Label($"{i + 1}:"); GUILayout.FlexibleSpace(); Configuration.Instance.KerbinDayNames[i] = GUILayout.TextField(Configuration.Instance.KerbinDayNames[i], GUI.skin.textArea, GUILayout.Width(190f)); } } GUILayout.Space(50); GUILayout.Label(Localizer.GetStringByTag("#Historian_DefaultEmptyCrewSlot")); GUILayout.Space(10); using (GUILayout.HorizontalScope noCrewLabel = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_CrewedLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultNoCrewLabel = GUILayout.TextField(Configuration.Instance.DefaultNoCrewLabel, GUI.skin.textArea, GUILayout.Width(120)); } using (GUILayout.HorizontalScope noCrewLabel = new GUILayout.HorizontalScope()) { GUILayout.Label(Localizer.GetStringByTag("#Historian_UncrewedLabel")); GUILayout.FlexibleSpace(); Configuration.Instance.DefaultUnmannedLabel = GUILayout.TextField(Configuration.Instance.DefaultUnmannedLabel, GUI.skin.textArea, GUILayout.Width(120)); } } } // column three using (GUILayout.AreaScope columnThree = new GUILayout.AreaScope(new Rect(660, 20, 220, 480))) { using (GUILayout.VerticalScope col = new GUILayout.VerticalScope()) { GUILayout.Space(20); GUILayout.Label(Localizer.GetStringByTag("#Historian_MonthNames")); for (int i = 0; i < Configuration.Instance.KerbinMonthNames.Length; i++) { using (GUILayout.HorizontalScope item = new GUILayout.HorizontalScope()) { GUILayout.Label($"{i + 1}:"); GUILayout.FlexibleSpace(); Configuration.Instance.KerbinMonthNames[i] = GUILayout.TextField(Configuration.Instance.KerbinMonthNames[i], GUI.skin.textArea, GUILayout.Width(190f)); } } } } // bottom bar using (GUILayout.AreaScope buttonBar = new GUILayout.AreaScope(new Rect(5, 525, 890, 30))) { using (GUILayout.HorizontalScope layout = new GUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button(Localizer.GetStringByTag("#autoLOC_900539"), GUILayout.Width(100.0f))) // #autoLOC_900539 = Load { historian.Reload(); } if (GUILayout.Button(Localizer.GetStringByTag("#autoLOC_174778"), GUILayout.Width(100.0f))) // #autoLOC_174778 = Save { Configuration.Instance.Layout = historian.GetCurrentLayoutName(); historian.SetConfiguration(Configuration.Instance); if (!Configuration.Instance.PersistentConfigurationWindow) { Toggle(); } if (!String.IsNullOrEmpty(Configuration.Instance.CustomText)) { Configuration.Instance.TokenizedCustomText = Parser.GetTokens(Configuration.Instance.CustomText); } } GUILayout.Space(20); // GUILayout.FlexibleSpace(); } } GUI.DragWindow(); }
internal void drawWindow(int id) { if (PartCommander.Instance.settings.altSkin) { GUI.skin = PartCommander.Instance.modStyleUnity.skin; } else { GUI.skin = PartCommander.Instance.modStyle.skin; } GUILayout.BeginVertical(); GUILayout.Label("Settings", modStyle.guiStyles["titleLabel"]); GUILayout.EndVertical(); if (Event.current.type == EventType.Repaint) { dragRect = GUILayoutUtility.GetLastRect(); } GUILayout.BeginVertical(); scrollPos = GUILayout.BeginScrollView(scrollPos); GUILayout.BeginHorizontal(); bool newHideUnAct = GUILayout.Toggle(settings.hideUnAct, "Hide unactionable parts", modStyle.guiStyles["toggleText"]); if (newHideUnAct != settings.hideUnAct) { PartCommander.Instance.updateParts = true; settings.hideUnAct = newHideUnAct; settings.Save(); } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.Label("Font Size:", modStyle.guiStyles["settingsLabel"]); bool fontChanged = false; GUILayout.FlexibleSpace(); if (settings.fontSize <= 12) { GUI.enabled = false; } if (GUILayout.Button("<", modStyle.guiStyles["settingsButton"])) { settings.fontSize--; fontChanged = true; } GUI.enabled = true; string s = GUILayout.TextField(settings.fontSize.ToString(), modStyle.guiStyles["settingsLabel"]); if (settings.fontSize >= 20) { GUI.enabled = false; } if (GUILayout.Button(">", modStyle.guiStyles["settingsButton"])) { settings.fontSize++; fontChanged = true; } GUI.enabled = true; if (fontChanged) { settings.Save(); PartCommander.Instance.modStyle.UpdateFontSize(settings.fontSize); PartCommander.Instance.modStyleUnity.UpdateFontSize(settings.fontSize); } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); bool newAltSkin = GUILayout.Toggle(settings.altSkin, "Use alternate skin", modStyle.guiStyles["toggleText"]); if (newAltSkin != settings.altSkin) { settings.altSkin = newAltSkin; settings.Save(); if (PartCommander.Instance.settings.altSkin) { modStyle = PartCommander.Instance.modStyleUnity; PartCommander.Instance.modStyle = PartCommander.Instance.modStyleUnity; } else { modStyle = PartCommander.Instance.modStyleKSP; PartCommander.Instance.modStyle = PartCommander.Instance.modStyle; } } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); bool newEnableHotKey = GUILayout.Toggle(settings.enableHotKey, "Enable hot key", modStyle.guiStyles["toggleText"]); if (newEnableHotKey != settings.enableHotKey) { settings.enableHotKey = newEnableHotKey; settings.Save(); } GUILayout.EndHorizontal(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); if (settingHotKey) { GUILayout.Label("Type a new hot key...", modStyle.guiStyles["settingsLabel"]); if (Event.current.isKey) { settings.hotKey = Event.current.keyCode; settings.Save(); settingHotKey = false; } } else { if (settings.enableHotKey) { GUILayout.BeginHorizontal(); GUILayout.Label("Mod + "); if (GUILayout.Button(new GUIContent(settings.hotKey.ToString(), "Click to set new hot key"), modStyle.guiStyles["settingsButton"])) { settingHotKey = true; } GUILayout.EndHorizontal(); } } GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.Space(25f); GUILayout.EndVertical(); if (GUI.Button(new Rect(windowRect.width - 18, 3f, 15f, 15f), new GUIContent("", "Close"), modStyle.guiStyles["closeButton"])) { showWindow = false; } // Create resize button in bottom right corner if (GUI.RepeatButton(new Rect(windowRect.width - 23, windowRect.height - 23, 20, 20), "", modStyle.guiStyles["resizeButton"])) { resizingWindow = true; } GUI.DragWindow(); }