Skip to content

Commit

Permalink
v0.6.6.3, fix some reload/cancel issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Apr 2, 2021
1 parent 56cc3e8 commit 17e5a5d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 9 deletions.
19 changes: 19 additions & 0 deletions CheatSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ public override void Load()
herosPermissions[NPCButcher_Permission] = true;
herosPermissions[CheatSheetExtensions_Permission] = true;
herosPermissions[QuickTeleport_Permission] = true;

GenericItemSlot.backgroundTexture = Main.inventoryBack9Texture;
NPCSlot.backgroundTexture = Main.inventoryBack9Texture;
NPCSlot.filteredBackgroundTexture = Main.inventoryBack5Texture;
RecipeQuerySlot.backgroundTexture = Main.inventoryBack9Texture;
RecipeQuerySlot.backgroundTextureFake = Main.inventoryBack8Texture;
RecipeSlot.backgroundTexture = Main.inventoryBack9Texture;
RecipeSlot.selectedBackgroundTexture = Main.inventoryBack15Texture;
Slot.backgroundTexture = Main.inventoryBack9Texture;
}

public override void Unload()
Expand All @@ -113,6 +122,14 @@ public override void Unload()
ButtonTexture.Clear();
ButtonTooltip.Clear();

GenericItemSlot.backgroundTexture = null;
NPCSlot.backgroundTexture = null;
NPCSlot.filteredBackgroundTexture = null;
RecipeQuerySlot.backgroundTexture = null;
RecipeQuerySlot.backgroundTextureFake = null;
RecipeSlot.backgroundTexture = null;
RecipeSlot.selectedBackgroundTexture = null;
Slot.backgroundTexture = null;
PaintToolsSlot.CurrentSelect = null;
AllItemsMenu.singleSlotArray = null;
UI.UICheckbox.checkboxTexture = null;
Expand Down Expand Up @@ -155,6 +172,8 @@ public override void Unload()

internal static string CSText(string category, string key)
{
if (translations == null)
return "";
return translations[$"Mods.CheatSheet.{category}.{key}"].GetTranslation(Language.ActiveCulture);
// This isn't good until after load....can revert after fixing static initializers for string[]
// return Language.GetTextValue($"Mods.CheatSheet.{category}.{key}");
Expand Down
2 changes: 1 addition & 1 deletion Menus/GenericItemSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace CheatSheet.Menus
{
internal class GenericItemSlot : UIView
{
public static Texture2D backgroundTexture = Main.inventoryBack9Texture;
public static Texture2D backgroundTexture;

public Item item = null;

Expand Down
1 change: 1 addition & 0 deletions Menus/ItemBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ internal enum ItemBrowserCategories
internal class ItemBrowser : UISlideWindow
{
internal static string CSText(string key, string category = "ItemBrowser") => CheatSheet.CSText(category, key);
// TODO: static stuff like this is bad when unload/cancel happens before translations are ready.
private static string[] categNames = new string[]
{
CSText("AllItems"),
Expand Down
4 changes: 2 additions & 2 deletions Menus/NPCSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ internal class NPCSlot : UIView

public int index = 0;

public static Texture2D backgroundTexture = Main.inventoryBack9Texture;
public static Texture2D filteredBackgroundTexture = Main.inventoryBack5Texture;
public static Texture2D backgroundTexture;
public static Texture2D filteredBackgroundTexture;

public bool functionalSlot;
private bool rightClicking;
Expand Down
4 changes: 2 additions & 2 deletions Menus/RecipeQuerySlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace CheatSheet.Menus
{
internal class RecipeQuerySlot : UIView
{
public static Texture2D backgroundTexture = Main.inventoryBack9Texture;
public static Texture2D backgroundTextureFake = Main.inventoryBack8Texture;
public static Texture2D backgroundTexture;
public static Texture2D backgroundTextureFake;

public Item item = new Item();
internal bool real = true;
Expand Down
4 changes: 2 additions & 2 deletions Menus/RecipeSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace CheatSheet.Menus
{
internal class RecipeSlot : UIView
{
public static Texture2D backgroundTexture = Main.inventoryBack9Texture;
public static Texture2D selectedBackgroundTexture = Main.inventoryBack15Texture;
public static Texture2D backgroundTexture;
public static Texture2D selectedBackgroundTexture;

public int recipeIndex = -1;
public Recipe recipe;
Expand Down
2 changes: 1 addition & 1 deletion Menus/Slot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class Slot : UIView

public int index = -1;

public static Texture2D backgroundTexture = Main.inventoryBack9Texture;
public static Texture2D backgroundTexture;

public bool functionalSlot;
private bool rightClicking;
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = jopojelly, jofairden, rrryutaro
version = 0.6.6.2
version = 0.6.6.3
displayName = Cheat Sheet
homepage = http://forums.terraria.org/index.php?threads/cheat-sheet.41407/
buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*
Expand Down

0 comments on commit 17e5a5d

Please sign in to comment.