diff --git a/ItemChecklist.cs b/ItemChecklist.cs index 998a1ad..c2a1093 100644 --- a/ItemChecklist.cs +++ b/ItemChecklist.cs @@ -113,8 +113,6 @@ namespace ItemChecklist ItemChecklistInterface?.Update(gameTime); } - int lastSeenScreenWidth; - int lastSeenScreenHeight; public override void ModifyInterfaceLayers(List layers) { int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); @@ -124,16 +122,9 @@ namespace ItemChecklist "ItemChecklist: Item Checklist", delegate { - if (ItemChecklistUI.visible) + if (ItemChecklistUI.Visible) { - if (lastSeenScreenWidth != Main.screenWidth || lastSeenScreenHeight != Main.screenHeight) - { - ItemChecklistInterface.Recalculate(); - lastSeenScreenWidth = Main.screenWidth; - lastSeenScreenHeight = Main.screenHeight; - } - - ItemChecklistUI.Draw(Main.spriteBatch); + ItemChecklistInterface?.Draw(Main.spriteBatch, new GameTime()); if (ItemChecklistUI.hoverText != "") { diff --git a/ItemChecklistPlayer.cs b/ItemChecklistPlayer.cs index 87264e9..dd15378 100644 --- a/ItemChecklistPlayer.cs +++ b/ItemChecklistPlayer.cs @@ -36,11 +36,11 @@ namespace ItemChecklist { if (ItemChecklist.ToggleChecklistHotKey.JustPressed) { - if (!ItemChecklistUI.visible) + if (!ItemChecklistUI.Visible) { ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(); } - ItemChecklistUI.visible = !ItemChecklistUI.visible; + ItemChecklistUI.Visible = !ItemChecklistUI.Visible; // Debug assistance, allows for reinitializing RecipeBrowserUI //if (!ItemChecklistUI.visible) //{ @@ -55,7 +55,7 @@ namespace ItemChecklist public override void OnEnterWorld(Player player) { var itemChecklistPlayer = Main.LocalPlayer.GetModPlayer(mod); - ItemChecklistUI.visible = false; + ItemChecklistUI.Visible = false; ItemChecklistUI.announce = announcePreference; ItemChecklistUI.collectChestItems = findChestItemsPreference; //ItemChecklistUI.sortMode = sortModePreference; diff --git a/ItemChecklistUI.cs b/ItemChecklistUI.cs index 97b9e46..73229ea 100644 --- a/ItemChecklistUI.cs +++ b/ItemChecklistUI.cs @@ -32,7 +32,11 @@ namespace ItemChecklist //public static SortModes sortMode = SortModes.TerrariaSort; float spacing = 8f; - public static bool visible = false; + public static bool Visible + { + get { return ItemChecklist.ItemChecklistInterface.CurrentState == ItemChecklist.instance.ItemChecklistUI; } + set { ItemChecklist.ItemChecklistInterface.SetState(value ? ItemChecklist.instance.ItemChecklistUI : null); } + } public static int showCompleted = 0; // 0: both, 1: unfound, 2: found public static bool announce = true; public static bool collectChestItems = true; diff --git a/build.txt b/build.txt index e07d9d7..fee0848 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = jopojelly -version = 0.5.1 +version = 0.5.2 displayName = Item Checklist homepage = https://forums.terraria.org/index.php?threads/item-checklist-in-game-100-item-collection-checklist.52786/ hideCode = false