labels for inventory side buttons

This commit is contained in:
minjaesong
2024-03-17 19:51:40 +09:00
parent 7bfff29a79
commit 33671d6e52
6 changed files with 34 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ class UIItemCatBar(
private val catArrangement: IntArray,
internal val catIconsMeaning: List<Array<String>>,
internal val catIconsLabels: List<() -> String>,
internal val superLabels: List<() -> String> = listOf({ "" }, { "" }, { "" }), // ["Crafting", "Inventory", "Menu"]
val panelTransitionReqFun: (Int) -> Unit = {} // for side buttons; for the selection change, override selectionChangeListener
) : UIItem(parentUI, initialX, initialY) {
@@ -286,7 +287,28 @@ class UIItemCatBar(
// label
batch.color = Color.WHITE
catIconsLabels[selectedIndex]().let {
App.fontGame.draw(batch, it, posX + ((width - App.fontGame.getWidth(it)) / 2), posY + highlighterYPos + 4)
App.fontGame.draw(batch, it, posX + ((width - App.fontGame.getWidth(it)) / 2), posY + highlighterYPos + 0)
}
}
else {
// generic label
batch.color = Color.WHITE
superLabels[1]().let {
App.fontGame.draw(batch, it, posX + ((width - App.fontGame.getWidth(it)) / 2), posY + highlighterYPos + 0)
}
}
// label under sidebuttons
if (showSideButtons) {
batch.color = Color.WHITE
superLabels[0]().let {
Toolkit.drawTextCentered(batch, App.fontGame, it, sideButtons[0].width, sideButtons[0].posX, posY + highlighterYPos + 0)
}
superLabels[2]().let {
Toolkit.drawTextCentered(batch, App.fontGame, it, sideButtons[3].width, sideButtons[3].posX, posY + highlighterYPos + 0)
}
}

View File

@@ -21,6 +21,8 @@ class UITemplateCatBar(
catIconsMeaning: List<Array<String>>, // sortedBy: catArrangement
catIconsLabels: List<() -> String>,
superLabels: List<() -> String> = listOf({ "" }, { "" }, { "" }),
) : UITemplate(parent) {
val catBar = UIItemCatBar(
@@ -30,7 +32,7 @@ class UITemplateCatBar(
UIInventoryFull.internalWidth,
UIInventoryFull.catBarWidth,
showSidebuttons,
catIcons, catArrangement, catIconsMeaning, catIconsLabels
catIcons, catArrangement, catIconsMeaning, catIconsLabels, superLabels
)
override fun getUIitems(): List<UIItem> {