a cell for items to craft will highlight when selected

This commit is contained in:
minjaesong
2022-06-29 00:02:18 +09:00
parent b34502ebd3
commit 9edfc90ad8
7 changed files with 46 additions and 34 deletions

View File

@@ -25,8 +25,8 @@ class UIItemInventoryElemSimple(
override var quickslot: Int? = null,
override var equippedSlot: Int? = null,
val drawBackOnNull: Boolean = true,
keyDownFun: (GameItem?, Long, Int, Any?) -> Unit, // Item, Amount, Keycode, extra info
touchDownFun: (GameItem?, Long, Int, Any?) -> Unit, // Item, Amount, Button, extra info
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
extraInfo: Any? = null
) : UIItemInventoryCellBase(parentUI, initialX, initialY, item, amount, itemImage, quickslot, equippedSlot, keyDownFun, touchDownFun, extraInfo) {
@@ -55,7 +55,7 @@ class UIItemInventoryElemSimple(
Toolkit.fillArea(batch, posX, posY, width, height)
}
// cell border
batch.color = if (equippedSlot != null) Toolkit.Theme.COL_HIGHLIGHT
batch.color = if (equippedSlot != null || forceHighlighted) Toolkit.Theme.COL_HIGHLIGHT
else if (mouseUp) Toolkit.Theme.COL_ACTIVE
else Toolkit.Theme.COL_INVENTORY_CELL_BORDER
Toolkit.drawBoxBorder(batch, posX, posY, width, height)
@@ -95,7 +95,7 @@ class UIItemInventoryElemSimple(
// if mouse is over, text lights up
// highlight item count (blocks/walls) if the item is equipped
batch.color = item!!.nameColour mul (
if (equippedSlot != null) Toolkit.Theme.COL_HIGHLIGHT
if (equippedSlot != null || forceHighlighted) Toolkit.Theme.COL_HIGHLIGHT
else if (mouseUp) Toolkit.Theme.COL_ACTIVE
else Color.WHITE
)