jukebox ui: names over the inventory slots

This commit is contained in:
minjaesong
2024-01-16 03:54:37 +09:00
parent 2bd1b61a35
commit f05cfe3cbb
3 changed files with 42 additions and 8 deletions

View File

@@ -31,6 +31,7 @@
"ITEM_INGOT_STEEL": "Steel Ingot",
"ITEM_INGOT_TIN": "Tin Ingot",
"ITEM_INGOT_ZINC": "Zinc Ingot",
"ITEM_JUKEBOX": "Jukebox",
"ITEM_LOGIC_SIGNAL_EMITTER": "Logic Signal Emitter",
"ITEM_LOGS_BIRCH": "Birch Logs",
"ITEM_LOGS_EBONY": "Ebony Logs",

View File

@@ -5,6 +5,7 @@
"ITEM_DOOR_EBONY": "흑단 문",
"ITEM_DOOR_BIRCH": "백단 문",
"ITEM_DOOR_ROSEWOOD": "자단 문",
"ITEM_FURNACE_AND_ANVIL": "화로와 모루",
"ITEM_GEM_RUBY": "홍옥석",
"ITEM_GEM_EMERALD": "취옥석",
"ITEM_GEM_SAPPHIRE": "청옥석",
@@ -16,6 +17,21 @@
"ITEM_HATCHET_STEEL": "강철 도끼",
"ITEM_HATCHET_STONE": "돌 도끼",
"ITEM_HATCHET_WOODEN": "나무 도끼",
"ITEM_INGOT_BRASS": "황동괴",
"ITEM_INGOT_BRONZE": "청동괴",
"ITEM_INGOT_COPPER": "구리괴",
"ITEM_INGOT_ELECTRUM": "호박금괴",
"ITEM_INGOT_GOLD": "금괴",
"ITEM_INGOT_IRON": "철괴",
"ITEM_INGOT_LEAD": "납괴",
"ITEM_INGOT_ROSEGOLD": "분홍금괴",
"ITEM_INGOT_SILVER": "은괴",
"ITEM_INGOT_SILVER_BILLON": "은동괴",
"ITEM_INGOT_SOLDER": "땜납",
"ITEM_INGOT_STEEL": "강철괴",
"ITEM_INGOT_TIN": "주석괴",
"ITEM_INGOT_ZINC": "아연괴",
"ITEM_JUKEBOX": "주크박스",
"ITEM_LOGIC_SIGNAL_EMITTER": "신호발생기",
"ITEM_LOGS_BIRCH": "백단 통나무",
"ITEM_LOGS_EBONY": "흑단 통나무",
@@ -41,6 +57,7 @@
"ITEM_SLEDGEHAMMER_COPPER": "구리 해머",
"ITEM_SLEDGEHAMMER_IRON": "철 해머",
"ITEM_SLEDGEHAMMER_STEEL": "강철 해머",
"ITEM_SMELTER_SMALL": "소형 고로",
"ITEM_STORAGE_CHEST": "보관상자",
"ITEM_TIKI_TORCH": "티키 토치",
"ITEM_TYPEWRITER": "타자기",

View File

@@ -4,6 +4,8 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.*
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
import net.torvald.terrarum.modulebasegame.gameitems.ItemFileRef
@@ -12,6 +14,12 @@ import net.torvald.terrarum.modulebasegame.ui.UIJukebox.Companion.SLOT_SIZE
import net.torvald.terrarum.ui.*
import net.torvald.terrarum.ui.UIItemInventoryElemWide
private val songButtonColourTheme = defaultInventoryCellTheme.copy(
cellHighlightNormalCol = Color(0xfec753c8.toInt()),
cellBackgroundCol = Color(0x704c20c8.toInt())
)
/**
* Created by minjaesong on 2024-01-13.
*/
@@ -21,8 +29,11 @@ class UIJukeboxInventory(val parent: UIJukebox) : UICanvas() {
override var height = App.scr.height
private val halfSlotOffset = (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) / 2
private val thisOffsetX = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() + UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap - halfSlotOffset
private val thisOffsetY = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y()
private val thisOffsetX2 = thisOffsetX + (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 7
private val thisOffsetY = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y()
private val cellsWidth = (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 6 - UIItemInventoryItemGrid.listGap
// private var currentFreeSlot: Int
@@ -32,7 +43,7 @@ class UIJukeboxInventory(val parent: UIJukebox) : UICanvas() {
private val fixtureDiscCell: Array<UIItemInventoryElemWide> = (0 until SLOT_SIZE).map { index ->
UIItemInventoryElemWide(this,
thisOffsetX, thisOffsetY + (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) * index,
6 * UIItemInventoryElemSimple.height + 5 * UIItemInventoryItemGrid.listGap,
cellsWidth,
showItemCount = false,
keyDownFun = { _, _, _, _, _ -> Unit },
touchDownFun = { _, _, _, _, _ -> Unit },
@@ -103,6 +114,15 @@ class UIJukeboxInventory(val parent: UIJukebox) : UICanvas() {
override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
uiItems.forEach { it.render(frameDelta, batch, camera) }
// chest name text
val chestName = Lang["ITEM_JUKEBOX"]
val playerName = INGAME.actorNowPlaying!!.actorValue.getAsString(AVKey.NAME).orEmpty().let { it.ifBlank { Lang["GAME_INVENTORY"] } }
batch.color = Color.WHITE
App.fontGame.draw(batch, chestName, thisOffsetX + (cellsWidth - App.fontGame.getWidth(chestName)) / 2, thisOffsetY - 30)
App.fontGame.draw(batch, playerName, thisOffsetX2 + (cellsWidth - App.fontGame.getWidth(playerName)) / 2, thisOffsetY - 30)
}
override fun dispose() {
@@ -138,11 +158,7 @@ class UIJukeboxSonglistPanel(val parent: UIJukebox) : UICanvas() {
private val thisOffsetX = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() + UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap - halfSlotOffset
private val thisOffsetX2 = thisOffsetX + (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 7
private val songButtonColourTheme = defaultInventoryCellTheme.copy(
cellHighlightNormalCol = Color(0xfec753c8.toInt()),
cellBackgroundCol = Color(0x704c20c8.toInt())
)
private val cellsWidth = (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 6 - UIItemInventoryItemGrid.listGap
private val rows = SLOT_SIZE / 2
private val vgap = 48
@@ -157,7 +173,7 @@ class UIJukeboxSonglistPanel(val parent: UIJukebox) : UICanvas() {
UIItemJukeboxSonglist(this,
if (index % 2 == 0) thisOffsetX else thisOffsetX2,
ys[index.shr(1)],
6 * UIItemInventoryElemSimple.height + 5 * UIItemInventoryItemGrid.listGap,
cellsWidth,
index = index,
colourTheme = songButtonColourTheme,
keyDownFun = { _, _, _ -> Unit },