greater number of inventory cells

This commit is contained in:
minjaesong
2019-01-23 00:09:31 +09:00
parent 6d638e1269
commit 12b42799e1
3 changed files with 34 additions and 23 deletions

View File

@@ -30,8 +30,10 @@ class UIInventoryFull(
override var width: Int = Terrarum.WIDTH
override var height: Int = Terrarum.HEIGHT
val internalWidth: Int = 686
val internalHeight: Int = 558 // grad_begin..grad_end..contents..grad_begin..grad_end
private val itemListToEquipViewGap = 24
val internalWidth: Int = UIItemInventoryDynamicList.WIDTH + UIItemInventoryEquippedView.WIDTH + itemListToEquipViewGap
val internalHeight: Int = 166 + UIItemInventoryDynamicList.HEIGHT // grad_begin..grad_end..contents..grad_begin..grad_end
@@ -62,7 +64,7 @@ class UIInventoryFull(
val categoryBar = UIItemInventoryCatBar(
this,
(Terrarum.WIDTH - catBarWidth) / 2,
66 + (Terrarum.HEIGHT - internalHeight) / 2,
42 + (Terrarum.HEIGHT - internalHeight) / 2,
catBarWidth
)
val catSelection: Int
@@ -91,7 +93,7 @@ class UIInventoryFull(
this,
actor!!.inventory,
actor as ActorWBMovable,
internalWidth - UIItemInventoryEquippedView.width + (Terrarum.WIDTH - internalWidth) / 2,
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
109 + (Terrarum.HEIGHT - internalHeight) / 2
)
}
@@ -174,7 +176,7 @@ class UIInventoryFull(
// control hints
blendNormal(batch)
batch.color = Color.WHITE
Terrarum.fontGame.draw(batch, listControlHelp, offsetX, offsetY + internalHeight)
Terrarum.fontGame.draw(batch, listControlHelp, offsetX, yEnd-20)
// encumbrance meter
@@ -184,7 +186,7 @@ class UIInventoryFull(
Terrarum.fontGame.draw(batch,
encumbranceText,
xEnd - 9 - Terrarum.fontGame.getWidth(encumbranceText) - weightBarWidth,
yEnd
yEnd-20
)
// encumbrance bar background
@@ -192,7 +194,7 @@ class UIInventoryFull(
batch.color = Color(0xa0a0a0_ff.toInt())
batch.fillRect(
xEnd - 3 - weightBarWidth,
yEnd + 3f,
yEnd-20 + 3f,
weightBarWidth,
controlHelpHeight - 6f
)
@@ -201,7 +203,7 @@ class UIInventoryFull(
batch.color = if (isEncumbered) Color(0xff0000_cc.toInt()) else Color(0x00ff00_cc.toInt())
batch.fillRect(
xEnd - 3 - weightBarWidth,
yEnd + 3f,
yEnd-20 + 3f,
if (actor?.inventory?.capacityMode == CAPACITY_MODE_NO_ENCUMBER)
1f
else // make sure 1px is always be seen

View File

@@ -74,13 +74,21 @@ class UIItemInventoryDynamicList(
val defaultTextColour = Color(0xeaeaea_ff.toInt())
private val listGap = 8
private val itemList = Array<UIItemInventoryCellBase>(7 * 2) {
UIItemInventoryElem(
companion object {
const val listGap = 8
const val horizontalCells = 12
const val verticalCells = 8
val largeListWidth = (horizontalCells * UIItemInventoryElemSimple.height + (horizontalCells - 2) * listGap) / 2
val WIDTH = horizontalCells * UIItemInventoryElemSimple.height + (horizontalCells - 1) * listGap
val HEIGHT = verticalCells * UIItemInventoryElemSimple.height + (verticalCells - 1) * listGap
}
private val itemGrid = Array<UIItemInventoryCellBase>(horizontalCells * verticalCells) {
UIItemInventoryElemSimple(
parentUI = inventoryUI,
posX = this.posX + (272 + listGap) * (it % 2),
posY = this.posY + (UIItemInventoryElem.height + listGap) * (it / 2),
width = 272,
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % horizontalCells),
posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / horizontalCells),
item = null,
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
itemImage = null,
@@ -92,11 +100,12 @@ class UIItemInventoryDynamicList(
inactiveTextCol = defaultTextColour
)
}
private val itemGrid = Array<UIItemInventoryCellBase>(7 * 10) {
UIItemInventoryElemSimple(
private val itemList = Array<UIItemInventoryCellBase>(verticalCells * 2) {
UIItemInventoryElem(
parentUI = inventoryUI,
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % 10),
posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / 10),
posX = this.posX + (largeListWidth + listGap) * (it % 2),
posY = this.posY + (UIItemInventoryElem.height + listGap) * (it / 2),
width = largeListWidth,
item = null,
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
itemImage = null,

View File

@@ -21,12 +21,12 @@ class UIItemInventoryEquippedView(
override var posY: Int
) : UIItem(parentUI) {
override val width = 104
override val height = 384
override val width = WIDTH
override val height = HEIGHT
companion object {
val width = 104
val height = 384
val WIDTH = 2 * UIItemInventoryElemSimple.height + UIItemInventoryDynamicList.listGap
val HEIGHT = UIItemInventoryDynamicList.HEIGHT
}
private val listGap = 8
@@ -39,7 +39,7 @@ class UIItemInventoryEquippedView(
val spriteViewBackCol: Color; get() = Color(0x404040_88.toInt())//Color(0xd4d4d4_ff.toInt())
private val itemGrid = Array<UIItemInventoryCellBase>(2 * 5) {
private val itemGrid = Array<UIItemInventoryCellBase>(2 * 6) {
UIItemInventoryElemSimple(
parentUI = parentUI,
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * ((it + 4) % 2),