Skip to content

Commit

Permalink
Fixes #53 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack authored and blushiemagic committed Aug 11, 2018
1 parent bcd3499 commit 2f46840
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
19 changes: 15 additions & 4 deletions CraftingGUI.cs
Expand Up @@ -36,17 +36,17 @@ public static bool MouseClicked
}
}

private static UIPanel basePanel = new UIPanel();
private static UIPanel basePanel;
private static float panelTop;
private static float panelLeft;
private static float panelWidth;
private static float panelHeight;

private static UIElement topBar = new UIElement();
private static UIElement topBar;
internal static UISearchBar searchBar;
private static UIButtonChoice sortButtons;
private static UIButtonChoice recipeButtons;
private static UIElement topBar2 = new UIElement();
private static UIElement topBar2;
private static UIButtonChoice filterButtons;
internal static UISearchBar searchBar2;

Expand Down Expand Up @@ -80,7 +80,7 @@ public static bool MouseClicked
private static UIElement bottomBar = new UIElement();
private static UIText capacityText;

private static UIPanel recipePanel = new UIPanel();
private static UIPanel recipePanel;
private static float recipeTop;
private static float recipeLeft;
private static float recipeWidth;
Expand Down Expand Up @@ -141,6 +141,7 @@ public static void Initialize()

panelTop = Main.instance.invBottom + 60;
panelLeft = 20f;
basePanel = new UIPanel();
float innerPanelLeft = panelLeft + basePanel.PaddingLeft;
float innerPanelWidth = numColumns * (itemSlotWidth + padding) + 20f + padding;
panelWidth = basePanel.PaddingLeft + innerPanelWidth + basePanel.PaddingRight;
Expand All @@ -151,6 +152,7 @@ public static void Initialize()
basePanel.Height.Set(panelHeight, 0f);
basePanel.Recalculate();

recipePanel = new UIPanel();
recipeTop = panelTop;
recipeLeft = panelLeft + panelWidth;
recipeWidth = numColumns2 * (smallSlotWidth + padding) + 20f + padding;
Expand All @@ -162,6 +164,7 @@ public static void Initialize()
recipePanel.Height.Set(recipeHeight, 0f);
recipePanel.Recalculate();

topBar = new UIElement();
topBar.Width.Set(0f, 1f);
topBar.Height.Set(32f, 0f);
basePanel.Append(topBar);
Expand All @@ -180,6 +183,7 @@ public static void Initialize()
searchBar.Height.Set(0f, 1f);
topBar.Append(searchBar);

topBar2 = new UIElement();
topBar2.Width.Set(0f, 1f);
topBar2.Height.Set(32f, 0f);
topBar2.Top.Set(36f, 0f);
Expand Down Expand Up @@ -347,6 +351,13 @@ private static void InitLangStuff()
}
}

internal static void Unload()
{
sortButtons = null;
filterButtons = null;
recipeButtons = null;
}

private static void InitSortButtons()
{
if (sortButtons == null)
Expand Down
2 changes: 2 additions & 0 deletions MagicStorage.cs
Expand Up @@ -36,6 +36,8 @@ public override void Unload()
Instance = null;
bluemagicMod = null;
legendMod = null;
StorageGUI.Unload();
CraftingGUI.Unload();
}

private void AddTranslations()
Expand Down
15 changes: 12 additions & 3 deletions StorageGUI.cs
Expand Up @@ -30,17 +30,17 @@ public static bool MouseClicked
}
}

private static UIPanel basePanel = new UIPanel();
private static UIPanel basePanel;
private static float panelTop;
private static float panelLeft;
private static float panelWidth;
private static float panelHeight;

private static UIElement topBar = new UIElement();
private static UIElement topBar;
internal static UISearchBar searchBar;
private static UIButtonChoice sortButtons;
internal static UITextPanel<LocalizedText> depositButton;
private static UIElement topBar2 = new UIElement();
private static UIElement topBar2;
private static UIButtonChoice filterButtons;
internal static UISearchBar searchBar2;

Expand Down Expand Up @@ -73,6 +73,7 @@ public static void Initialize()

panelTop = Main.instance.invBottom + 60;
panelLeft = 20f;
basePanel = new UIPanel();
float innerPanelLeft = panelLeft + basePanel.PaddingLeft;
float innerPanelWidth = numColumns * (itemSlotWidth + padding) + 20f + padding;
panelWidth = basePanel.PaddingLeft + innerPanelWidth + basePanel.PaddingRight;
Expand All @@ -83,6 +84,7 @@ public static void Initialize()
basePanel.Height.Set(panelHeight, 0f);
basePanel.Recalculate();

topBar = new UIElement();
topBar.Width.Set(0f, 1f);
topBar.Height.Set(32f, 0f);
basePanel.Append(topBar);
Expand All @@ -103,6 +105,7 @@ public static void Initialize()
searchBar.Height.Set(0f, 1f);
topBar.Append(searchBar);

topBar2 = new UIElement();
topBar2.Width.Set(0f, 1f);
topBar2.Height.Set(32f, 0f);
topBar2.Top.Set(36f, 0f);
Expand Down Expand Up @@ -180,6 +183,12 @@ private static void InitLangStuff()
}
}

internal static void Unload()
{
sortButtons = null;
filterButtons = null;
}

private static void InitSortButtons()
{
if (sortButtons == null)
Expand Down

0 comments on commit 2f46840

Please sign in to comment.