Skip to content

Commit

Permalink
Fix popped out windows sometimes getting bugged
Browse files Browse the repository at this point in the history
  • Loading branch information
Falki-git committed May 1, 2023
1 parent 1844ff5 commit 2aa0f9d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public ReferenceBodyConstants_StandardGravitationParameter()
Category = MicroEntryCategory.Body;
IsDefault = false;
BaseUnit = "μ";
NumberOfDecimalDigits = 4;
NumberOfDecimalDigits = 3;
Formatting = "e";
}

Expand Down
12 changes: 4 additions & 8 deletions MicroEngineerProject/MicroEngineer/Managers/UI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -345,11 +344,8 @@ private void FillMainGUI(int windowID)
/// Draws all windows that are toggled and popped out
/// </summary>
/// <param name="windowIndex"></param>
private void DrawPopoutWindow(int windowIndex)
private void DrawPopoutWindow(EntryWindow w)
{
List<EntryWindow> entryWindows = Windows.FindAll(w => w is EntryWindow).Cast<EntryWindow>().ToList();
EntryWindow w = Windows.FindAll(w => w is EntryWindow).Cast<EntryWindow>().ToList()[windowIndex];

GUILayout.Space(-5);
DrawSectionHeader(w.Name, ref w.IsFlightPoppedOut, w.IsLocked);

Expand Down
2 changes: 1 addition & 1 deletion MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Staging/BepInEx/plugins/micro_engineer/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit 2aa0f9d

Please sign in to comment.