mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 21:14:04 +09:00
uiitem and template refactoring; new smelter ui wip
This commit is contained in:
@@ -35,6 +35,8 @@ class UIItemInventoryElemSimple(
|
||||
highlightEquippedItem: Boolean = true, // for some UIs that only cares about getting equipped slot number but not highlighting
|
||||
colourTheme: InventoryCellColourTheme = defaultInventoryCellTheme,
|
||||
var showItemCount: Boolean = true,
|
||||
var emptyCellIcon: TextureRegion? = null, // icon to draw when the cell is empty
|
||||
var emptyCellIconColour: Color = Color(0xdddddd7f.toInt()),
|
||||
) : UIItemInventoryCellBase(parentUI, initialX, initialY, item, amount, itemImage, quickslot, equippedSlot, keyDownFun, touchDownFun, extraInfo, highlightEquippedItem, colourTheme) {
|
||||
|
||||
companion object {
|
||||
@@ -52,6 +54,9 @@ class UIItemInventoryElemSimple(
|
||||
private val imgOffsetX: Float
|
||||
get() = (this.height - itemImageOrDefault.regionWidth).div(2).toFloat() // to snap to the pixel grid
|
||||
|
||||
private val emptyCellIconOffsetX = (this.height - (emptyCellIcon?.regionWidth ?: 0)).div(2).toFloat()
|
||||
private val emptyCellIconOffsetY = (this.height - (emptyCellIcon?.regionHeight ?: 0)).div(2).toFloat()
|
||||
|
||||
override fun update(delta: Float) {
|
||||
|
||||
}
|
||||
@@ -123,6 +128,15 @@ class UIItemInventoryElemSimple(
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
// empty cell image
|
||||
emptyCellIcon?.let {
|
||||
batch.color = emptyCellIconColour
|
||||
batch.draw(it, posX + emptyCellIconOffsetX, posY + emptyCellIconOffsetY)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// see IFs above?
|
||||
|
||||
Reference in New Issue
Block a user