mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
UIItemInventoryElemWide: removed temporary equippedslot marker: is unnecessary as we've already got UIItemInventoryEquippedView
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<UIItemInventoryCellBase>(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<UIItemImageButton>(2) { index ->
|
||||
|
||||
Reference in New Issue
Block a user