mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-17 00:56:07 +09:00
fix: inventory cell quickslot indicator not readily updating
This commit is contained in:
@@ -97,7 +97,7 @@ internal class UIInventoryCells(
|
|||||||
INVENTORY_CELLS_OFFSET_X(),
|
INVENTORY_CELLS_OFFSET_X(),
|
||||||
INVENTORY_CELLS_OFFSET_Y(),
|
INVENTORY_CELLS_OFFSET_Y(),
|
||||||
CELLS_HOR, CELLS_VRT,
|
CELLS_HOR, CELLS_VRT,
|
||||||
keyDownFun = createInvCellGenericKeyDownFun(),
|
keyDownFun = createInvCellGenericKeyDownFun { rebuildList() },
|
||||||
touchDownFun = createInvCellGenericTouchDownFun { rebuildList() },
|
touchDownFun = createInvCellGenericTouchDownFun { rebuildList() },
|
||||||
wheelFun = { _, _, _, _, _, _ -> },
|
wheelFun = { _, _, _, _, _, _ -> },
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class UIItemInventoryEquippedView(
|
|||||||
amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
itemImage = null,
|
itemImage = null,
|
||||||
drawBackOnNull = true,
|
drawBackOnNull = true,
|
||||||
keyDownFun = createInvCellGenericKeyDownFun(),
|
keyDownFun = { _, _, _, _, _ -> },
|
||||||
touchDownFun = createInvCellGenericTouchDownFun(inventoryListRebuildFun), // to "unselect" the equipped item and main item grid would "untick" accordingly
|
touchDownFun = createInvCellGenericTouchDownFun(inventoryListRebuildFun), // to "unselect" the equipped item and main item grid would "untick" accordingly
|
||||||
wheelFun = { _, _, _, _, _, _ -> },
|
wheelFun = { _, _, _, _, _, _ -> },
|
||||||
emptyCellIcon = equipPosIcon.get(cellToIcon[it], 1),
|
emptyCellIcon = equipPosIcon.get(cellToIcon[it], 1),
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ open class UIItemInventoryItemGrid(
|
|||||||
fun getEstimatedW(horizontalCells: Int) = horizontalCells * UIItemInventoryElemSimple.height + (horizontalCells - 1) * listGap
|
fun getEstimatedW(horizontalCells: Int) = horizontalCells * UIItemInventoryElemSimple.height + (horizontalCells - 1) * listGap
|
||||||
fun getEstimatedH(verticalCells: Int) = verticalCells * UIItemInventoryElemSimple.height + (verticalCells - 1) * listGap
|
fun getEstimatedH(verticalCells: Int) = verticalCells * UIItemInventoryElemSimple.height + (verticalCells - 1) * listGap
|
||||||
|
|
||||||
fun createInvCellGenericKeyDownFun(): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit {
|
fun createInvCellGenericKeyDownFun(listRebuildFun: () -> Unit): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit {
|
||||||
return { item: GameItem?, amount: Long, keycode: Int, _, _ ->
|
return { item: GameItem?, amount: Long, keycode: Int, _, _ ->
|
||||||
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_0..Input.Keys.NUM_9) {
|
if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_0..Input.Keys.NUM_9) {
|
||||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||||
@@ -139,6 +139,8 @@ open class UIItemInventoryItemGrid(
|
|||||||
inventory.setQuickslotItem(it, null)
|
inventory.setQuickslotItem(it, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listRebuildFun()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user