From f7ce911c9e51169f7867b58d37b65d02a64a5d3f Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 7 Aug 2021 00:14:33 +0900 Subject: [PATCH] fixed a bug where inventory's cat icons would unloaded when you load the ingame second time --- src/net/torvald/terrarum/UIItemInventoryCatBar.kt | 6 +++--- .../torvald/terrarum/modulebasegame/ui/UIInventoryFull.kt | 2 +- .../modulebasegame/ui/UIItemInventoryEquippedView.kt | 4 ++-- .../terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt | 8 +------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/net/torvald/terrarum/UIItemInventoryCatBar.kt b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt index 0a14d60d0..72594c068 100644 --- a/src/net/torvald/terrarum/UIItemInventoryCatBar.kt +++ b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt @@ -31,7 +31,7 @@ class UIItemInventoryCatBar( const val CAT_ALL = "__all__" } - internal val catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_caticons") + internal val catIcons: TextureRegionPack = CommonResourcePool.getAsTextureRegionPack("inventory_category") internal val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8) internal val catIconsMeaning = listOf( // sortedBy: catArrangement arrayOf(GameItem.Category.WEAPON), @@ -278,7 +278,7 @@ class UIItemInventoryCatBar( override fun dispose() { underlineIndTex.dispose() //catIcons.dispose() // disposed of by the AppLoader - mainButtons.forEach { it.dispose() } - sideButtons.forEach { it.dispose() } + //mainButtons.forEach { it.dispose() } // disposed of by the AppLoader + //sideButtons.forEach { it.dispose() } // disposed of by the AppLoader } } \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryFull.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryFull.kt index b40a8019b..ffe19ce1a 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryFull.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIInventoryFull.kt @@ -76,7 +76,7 @@ class UIInventoryFull( init { handler.allowESCtoClose = true - CommonResourcePool.addToLoadingList("inventory_caticons") { + CommonResourcePool.addToLoadingList("inventory_category") { TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20) } CommonResourcePool.loadAll() diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt index 886a46b82..d7e5758bb 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt @@ -50,7 +50,7 @@ class UIItemInventoryEquippedView( val spriteViewBackCol: Color = CELLCOLOUR_BLACK - private val equipPosIcon = CommonResourcePool.getAsTextureRegionPack("inventory_caticons") + private val equipPosIcon = CommonResourcePool.getAsTextureRegionPack("inventory_category") private val cellToIcon = intArrayOf(0,1,2,3,4,5,6,7,6,7,6,7) private val equipPosIconCol = Color(0xdddddd7f.toInt()) @@ -150,7 +150,7 @@ class UIItemInventoryEquippedView( override fun dispose() { itemGrid.forEach { it.dispose() } - equipPosIcon.dispose() + // equipPosIcon.dispose() // disposed of by the AppLoader } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt index c0cb02d59..688359a77 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt @@ -478,13 +478,7 @@ class UIItemInventoryItemGrid( } override fun dispose() { - itemList.forEach { it.dispose() } - itemGrid.forEach { it.dispose() } - // the icons are using common resources that are disposed when the app quits - //gridModeButtons.forEach { it.dispose() } - //scrollUpButton.dispose() - //scrollDownButton.dispose() - //walletFont.dispose() + } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {