mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
better item names for discs
This commit is contained in:
@@ -16,6 +16,7 @@ import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.savegame.toHex
|
||||
import net.torvald.terrarum.utils.JsonFetcher
|
||||
import net.torvald.terrarum.worlddrawer.toRGBA
|
||||
import net.torvald.unicode.EMDASH
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-01-13.
|
||||
@@ -45,9 +46,10 @@ open class MusicDiscPrototype(originalID: ItemID, module: String, path: String)
|
||||
|
||||
init {
|
||||
val meta = MusicDiscHelper.getMetadata(getAsGdxFile())
|
||||
name = meta.title
|
||||
originalName = meta.title
|
||||
author = meta.author
|
||||
collection = meta.album
|
||||
name = "$author $EMDASH $originalName"
|
||||
}
|
||||
|
||||
@Transient override val itemImage: TextureRegion = generateSprite()
|
||||
|
||||
@@ -175,12 +175,14 @@ class UIJukeboxSonglistPanel(val parent: UIJukebox) : UICanvas() {
|
||||
if (index in parent.discInventory.indices) {
|
||||
parent.discInventory[index].let {
|
||||
val item = ItemCodex[it] as? ItemFileRef
|
||||
button.title = item?.name ?: ""
|
||||
button.title = item?.originalName ?: ""
|
||||
button.album = item?.collection ?: ""
|
||||
button.artist = item?.author ?: ""
|
||||
}
|
||||
}
|
||||
else {
|
||||
button.title = ""
|
||||
button.album = ""
|
||||
button.artist = ""
|
||||
}
|
||||
}
|
||||
@@ -219,6 +221,7 @@ class UIItemJukeboxSonglist(
|
||||
override val width: Int,
|
||||
val index: Int,
|
||||
var title: String = "",
|
||||
var album: String = "",
|
||||
var artist: String = "",
|
||||
|
||||
var keyDownFun: (Int, Int, UIItemJukeboxSonglist) -> Unit, // Index, Keycode, self
|
||||
@@ -298,7 +301,7 @@ class UIItemJukeboxSonglist(
|
||||
Toolkit.drawTextCentered(batch, App.fontGame, title, width, posX, posY + textOffsetY)
|
||||
// draw artist
|
||||
batch.color = batch.color.cpy().mul(0.75f, 0.75f, 0.75f, 1f)
|
||||
Toolkit.drawTextCentered(batch, App.fontGame, artist, width, posX, posY + App.fontGame.lineHeight.toInt() - 2*textOffsetY)
|
||||
Toolkit.drawTextCentered(batch, App.fontGame, album, width, posX, posY + App.fontGame.lineHeight.toInt() - 2*textOffsetY)
|
||||
}
|
||||
|
||||
// see IFs above?
|
||||
|
||||
Reference in New Issue
Block a user