diff --git a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt index 457966407..4a54305e0 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt @@ -38,7 +38,7 @@ class UIItemInventoryElemSimple( ) : UIItemInventoryCellBase(parentUI, initialX, initialY, item, amount, itemImage, quickslot, equippedSlot, keyDownFun, touchDownFun) { companion object { - val height = UIItemInventoryElem.height + val height = UIItemInventoryElemWide.height } override val width = UIItemInventoryElemSimple.height @@ -91,7 +91,7 @@ class UIItemInventoryElemSimple( // draw durability metre val barFullLen = width val barOffset = posX.toFloat() - val thickness = UIItemInventoryElem.durabilityBarThickness + val thickness = UIItemInventoryElemWide.durabilityBarThickness val percentage = item!!.durability / item!!.maxDurability val durabilityCol = UIItemInventoryCellCommonRes.getHealthMeterColour(percentage, 0f, 1f) val durabilityBack = durabilityCol mul UIItemInventoryCellCommonRes.meterBackDarkening diff --git a/src/net/torvald/terrarum/UIItemInventoryElem.kt b/src/net/torvald/terrarum/UIItemInventoryElemWide.kt similarity index 95% rename from src/net/torvald/terrarum/UIItemInventoryElem.kt rename to src/net/torvald/terrarum/UIItemInventoryElemWide.kt index 4e348548b..7160c3e13 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElem.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElemWide.kt @@ -19,7 +19,7 @@ import net.torvald.terrarum.ui.UIItemTextButton * * Created by minjaesong on 2017-03-16. */ -class UIItemInventoryElem( +class UIItemInventoryElemWide( parentUI: UICanvas, initialX: Int, initialY: Int, @@ -47,7 +47,7 @@ class UIItemInventoryElem( internal val durabilityBarThickness = 3f } - override val height = UIItemInventoryElem.height + override val height = UIItemInventoryElemWide.height private val imgOffset: Float get() = (this.height - itemImage!!.regionHeight).div(2).toFloat() // to snap to the pixel grid @@ -113,9 +113,7 @@ class UIItemInventoryElem( else { App.fontGame.draw(batch, // print name and amount in parens - item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else "") + - // TEMPORARY print eqipped slot info as well - (if (equippedSlot != null) " ${0xE081.toChar()}\$$equippedSlot" else ""), + item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""), posX + textOffsetX, posY + textOffsetY diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureStorageChest.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureStorageChest.kt index a5291a0d1..e54855983 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureStorageChest.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureStorageChest.kt @@ -152,7 +152,7 @@ internal class UIStorageChest : UICanvas( this, catBar, { INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory - INVENTORY_CELLS_OFFSET_X - halfSlotOffset + (listGap + UIItemInventoryElem.height) * 7, + INVENTORY_CELLS_OFFSET_X - halfSlotOffset + (listGap + UIItemInventoryElemWide.height) * 7, INVENTORY_CELLS_OFFSET_Y, 6, CELLS_VRT, drawScrollOnRightside = true, diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt index 92e8afdca..f76af5548 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryEquippedView.kt @@ -4,10 +4,7 @@ import com.badlogic.gdx.graphics.Camera import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.SpriteBatch import net.torvald.terrarum.* -import net.torvald.terrarum.gameactors.ActorWithBody import net.torvald.terrarum.gameitem.GameItem -import net.torvald.terrarum.itemproperties.ItemCodex -import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK_ACTIVE import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.itemListHeight @@ -58,7 +55,7 @@ class UIItemInventoryEquippedView( initialX = this.posX + (UIItemInventoryElemSimple.height + listGap) * ((it + 4) % 2), initialY = this.posY + (UIItemInventoryElemSimple.height + listGap) * ((it + 4) / 2), item = null, - amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT, + amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT, itemImage = null, mouseoverBackCol = Color(CELLCOLOUR_BLACK_ACTIVE), mouseoverBackBlendMode = BlendMode.SCREEN, diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt index 952a258e9..c1109cca0 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UIItemInventoryItemGrid.kt @@ -177,7 +177,7 @@ class UIItemInventoryItemGrid( initialX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % horizontalCells), initialY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / horizontalCells), item = null, - amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT, + amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT, itemImage = null, mouseoverBackCol = Color(CELLCOLOUR_BLACK_ACTIVE), mouseoverBackBlendMode = BlendMode.SCREEN, @@ -194,13 +194,13 @@ class UIItemInventoryItemGrid( private val actualItemCellWidth = (listGap + UIItemInventoryElemSimple.height) * horizontalCells - listGap // in pixels private val largeListWidth = ((listGap + actualItemCellWidth) / itemListColumnCount) - (itemListColumnCount - 1).coerceAtLeast(1) * listGap private val itemList = Array(verticalCells * itemListColumnCount) { - UIItemInventoryElem( + UIItemInventoryElemWide( parentUI = inventoryUI, initialX = this.posX + (largeListWidth + listGap) * (it % itemListColumnCount), - initialY = this.posY + (UIItemInventoryElem.height + listGap) * (it / itemListColumnCount), + initialY = this.posY + (UIItemInventoryElemWide.height + listGap) * (it / itemListColumnCount), width = largeListWidth, item = null, - amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT, + amount = UIItemInventoryElemWide.UNIQUE_ITEM_HAS_NO_AMOUNT, itemImage = null, mouseoverBackCol = Color(CELLCOLOUR_BLACK_ACTIVE), mouseoverBackBlendMode = BlendMode.SCREEN, @@ -228,7 +228,7 @@ class UIItemInventoryItemGrid( posX - LIST_TO_CONTROL_GAP - catBar.catIcons.tileW + 2 private fun getIconPosY(index: Int) = - posY - 2 + (4 + UIItemInventoryElem.height - catBar.catIcons.tileH) * index + posY - 2 + (4 + UIItemInventoryElemWide.height - catBar.catIcons.tileH) * index /** Long/compact mode buttons */ internal val gridModeButtons = Array(2) { index ->