crafting ui item cell highlighting works as intended

This commit is contained in:
minjaesong
2022-07-02 18:06:52 +09:00
parent 60497e4201
commit 4eb3ad07f3
5 changed files with 22 additions and 13 deletions

View File

@@ -28,7 +28,8 @@ abstract class UIItemInventoryCellBase(
open var equippedSlot: Int? = null,
val keyDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Keycode, extra info, self
val touchDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Button, extra info, self
open var extraInfo: Any?
open var extraInfo: Any?,
open protected val highlightEquippedItem: Boolean = true // for some UIs that only cares about getting equipped slot number but not highlighting
) : UIItem(parentUI, initialX, initialY) {
abstract override fun update(delta: Float)
abstract override fun render(batch: SpriteBatch, camera: Camera)

View File

@@ -45,7 +45,8 @@ open class UIItemInventoryItemGrid(
val hideSidebar: Boolean = false,
keyDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Keycode, extra info, self
touchDownFun: (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit, // Item, Amount, Button, extra info, self
protected val useHighlightingManager: Boolean = true // only used by UIItemCraftingCandidateGrid which addresses buttons directly to set highlighting
protected val useHighlightingManager: Boolean = true, // only used by UIItemCraftingCandidateGrid which addresses buttons directly to set highlighting
open protected val highlightEquippedItem: Boolean = true // for some UIs that only cares about getting equipped slot number but not highlighting
) : UIItem(parentUI, initialX, initialY) {
// deal with the moving position
@@ -184,7 +185,8 @@ open class UIItemInventoryItemGrid(
itemImage = null,
drawBackOnNull = true,
keyDownFun = keyDownFun,
touchDownFun = touchDownFun
touchDownFun = touchDownFun,
highlightEquippedItem = highlightEquippedItem
)
}
// automatically determine how much columns are needed. Minimum Width = 5 grids
@@ -202,7 +204,8 @@ open class UIItemInventoryItemGrid(
itemImage = null,
drawBackOnNull = true,
keyDownFun = keyDownFun,
touchDownFun = touchDownFun
touchDownFun = touchDownFun,
highlightEquippedItem = highlightEquippedItem
)
}