catbar and grid: updates and renders as intended

This commit is contained in:
minjaesong
2017-10-24 00:21:13 +09:00
parent 77b563396e
commit a506269906
5 changed files with 44 additions and 31 deletions

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameactors.Pocketed
import net.torvald.terrarum.gameactors.Second
import net.torvald.terrarum.itemproperties.GameItem
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import java.util.ArrayList
/**
@@ -32,6 +33,11 @@ class UIInventoryFull(
internal val catIcons: TextureRegionPack = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20)
internal val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8)
private val SP = "${0x3000.toChar()}${0x3000.toChar()}"
val listControlHelp: String
get() = if (Terrarum.environment == RunningEnvironment.PC)
@@ -50,7 +56,7 @@ class UIInventoryFull(
private var isEncumbered = false
val catBarWidth = 328
val catBarWidth = 330
val catBar = UIItemInventoryCatBar(
this,
(Terrarum.WIDTH - catBarWidth) / 2,
@@ -87,7 +93,8 @@ class UIInventoryFull(
override fun updateUI(delta: Float) {
catBar.update(delta)
itemList?.update(delta)
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {

View File

@@ -35,6 +35,7 @@ class UIItemInventoryDynamicList(
override val width = 496
override val height = 384
private val catArrangement = parentUI.catArrangement
@@ -58,7 +59,7 @@ class UIItemInventoryDynamicList(
private val selectedIcon: Int
get() = inventoryUI.catSelectedIcon
private val compactViewCat = setOf(6, 7, 9) // blocks, walls, all (spritesheet order)
private val compactViewCat = setOf(4, 6, 7, 9) // potions, blocks, walls, all (spritesheet order)
var itemPage = 0
var itemPageCount = 1 // TODO total size of current category / items.size
@@ -106,7 +107,7 @@ class UIItemInventoryDynamicList(
)
private val items: Array<UIItemInventoryCellBase>
get() = if (selection in compactViewCat) itemGrid else itemList
get() = if (catArrangement[selection] in compactViewCat) itemGrid else itemList