From 2aa0f9d650b57e35d123fc25b4073359cc4dda32 Mon Sep 17 00:00:00 2001
From: Falki-git <72734856+Falki-git@users.noreply.github.com>
Date: Mon, 1 May 2023 20:44:17 +0200
Subject: [PATCH] Fix popped out windows sometimes getting bugged
---
.../MicroEngineer/Entries/BodyEntries.cs | 2 +-
MicroEngineerProject/MicroEngineer/Managers/UI.cs | 12 ++++--------
.../MicroEngineer/MicroEngineerMod.cs | 2 +-
Staging/BepInEx/plugins/micro_engineer/swinfo.json | 2 +-
4 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs
index 37fbab7..8721465 100644
--- a/MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs
+++ b/MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs
@@ -58,7 +58,7 @@ public ReferenceBodyConstants_StandardGravitationParameter()
Category = MicroEntryCategory.Body;
IsDefault = false;
BaseUnit = "μ";
- NumberOfDecimalDigits = 4;
+ NumberOfDecimalDigits = 3;
Formatting = "e";
}
diff --git a/MicroEngineerProject/MicroEngineer/Managers/UI.cs b/MicroEngineerProject/MicroEngineer/Managers/UI.cs
index fb111a2..b35bb75 100644
--- a/MicroEngineerProject/MicroEngineer/Managers/UI.cs
+++ b/MicroEngineerProject/MicroEngineer/Managers/UI.cs
@@ -64,7 +64,7 @@ private void OnGUI_Flight()
if (!ShowGuiFlight || Utility.ActiveVessel == null) return;
- MainGuiWindow mainGui = (MainGuiWindow)Windows.Find(w => w is MainGuiWindow); // window => window.MainWindow == MainWindow.MainGui);
+ MainGuiWindow mainGui = (MainGuiWindow)Windows.Find(w => w is MainGuiWindow);
// Draw main GUI that contains docked windows
mainGui.FlightRect = GUILayout.Window(
@@ -96,11 +96,10 @@ private void OnGUI_Flight()
// If window is locked set alpha to 20%
if (window.IsLocked)
GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.2f);
-
window.FlightRect = GUILayout.Window(
- index,
+ GUIUtility.GetControlID(FocusType.Passive),
window.FlightRect,
- DrawPopoutWindow,
+ (id) => DrawPopoutWindow(window),
"",
Styles.PopoutWindowStyle,
GUILayout.Height(0),
@@ -345,11 +344,8 @@ private void FillMainGUI(int windowID)
/// Draws all windows that are toggled and popped out
///
///
- private void DrawPopoutWindow(int windowIndex)
+ private void DrawPopoutWindow(EntryWindow w)
{
- List entryWindows = Windows.FindAll(w => w is EntryWindow).Cast().ToList();
- EntryWindow w = Windows.FindAll(w => w is EntryWindow).Cast().ToList()[windowIndex];
-
GUILayout.Space(-5);
DrawSectionHeader(w.Name, ref w.IsFlightPoppedOut, w.IsLocked);
diff --git a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs
index 5fdb7e9..7851b08 100644
--- a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs
+++ b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs
@@ -8,7 +8,7 @@
namespace MicroMod
{
- [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.0.1")]
+ [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.0.2")]
[BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)]
public class MicroEngineerMod : BaseSpaceWarpPlugin
{
diff --git a/Staging/BepInEx/plugins/micro_engineer/swinfo.json b/Staging/BepInEx/plugins/micro_engineer/swinfo.json
index 7d1300d..022d37b 100644
--- a/Staging/BepInEx/plugins/micro_engineer/swinfo.json
+++ b/Staging/BepInEx/plugins/micro_engineer/swinfo.json
@@ -4,7 +4,7 @@
"name": "Micro Engineer",
"description": "Get in-flight and VAB information about your current vessel",
"source": "https://github.com/Micrologist/MicroEngineer",
- "version": "1.0.1",
+ "version": "1.0.2",
"version_check": "https://raw.githubusercontent.com/Micrologist/MicroEngineer/main/Staging/BepInEx/plugins/micro_engineer/swinfo.json",
"dependencies": [
{