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

@@ -18,7 +18,7 @@
"GAME_ACTION_QUICKSEL": "Quick Select",
"GAME_ACTION_SELECT_SLOT": "Select Slot",
"GAME_ACTION_TELEPORT": "Teleport",
"GAME_CRAFTABLE_ITEMS": "Craftable Items",
"GAME_CRAFTABLE_ITEMS": "Recipes",
"GAME_CRAFTING": "Crafting",
"GAME_INVENTORY_BLOCKS": "Blocks",
"GAME_INVENTORY_FAVORITES": "Favorites",

View File

@@ -17,7 +17,7 @@
"GAME_ACTION_QUICKSEL": "빠른 선택",
"GAME_ACTION_SELECT_SLOT": "슬롯 선택",
"GAME_ACTION_TELEPORT": "텔레포트하기",
"GAME_CRAFTABLE_ITEMS": "제작 가능한 아이템",
"GAME_CRAFTABLE_ITEMS": "제작 레시피",
"GAME_CRAFTING": "제작",
"GAME_INVENTORY_BLOCKS": "블록",
"GAME_INVENTORY_FAVORITES": "즐겨찾기",

View File

@@ -482,7 +482,7 @@ class UICraftingWorkbench(val inventoryUI: UIInventoryFull?, val parentContainer
batch.color = Color.WHITE
// text label for two inventory grids
val craftingLabel = Lang["GAME_CRAFTING"]
val craftingLabel = Lang["GAME_CRAFTABLE_ITEMS"]
val ingredientsLabel = Lang["GAME_INVENTORY_INGREDIENTS"]
App.fontGame.draw(batch, craftingLabel, thisOffsetX + (cellsWidth - App.fontGame.getWidth(craftingLabel)) / 2, thisOffsetY - INVENTORY_NAME_TEXT_GAP)

View File

@@ -241,6 +241,11 @@ class UIInventoryFull(
{ Lang["CONTEXT_ITEM_MAGIC"] },
{ Lang["GAME_GENRE_MISC"] },
),
superLabels = listOf(
{ Lang["GAME_CRAFTING"] },
{ Lang["GAME_INVENTORY"] },
{ Lang["MENU_LABEL_MENU"] }
)
) { i -> if (!panelTransitionLocked) requestTransition(i) }

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> {