mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 18:14:06 +09:00
barely managed to fix inventory UI
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -165,7 +165,6 @@ object ModMgr {
|
|||||||
val langPath = "locales/"
|
val langPath = "locales/"
|
||||||
|
|
||||||
@JvmStatic operator fun invoke(module: String) {
|
@JvmStatic operator fun invoke(module: String) {
|
||||||
println("arstneitars")
|
|
||||||
Lang.load(getPath(module, langPath))
|
Lang.load(getPath(module, langPath))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ class StateInGameGDX(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
|
|
||||||
fun enter() {
|
fun enter() {
|
||||||
|
|
||||||
Gdx.input.inputProcessor = GameController
|
Gdx.input.inputProcessor = GameController
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
|||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||||
import com.google.gson.JsonArray
|
import com.google.gson.JsonArray
|
||||||
import com.google.gson.JsonPrimitive
|
import com.google.gson.JsonPrimitive
|
||||||
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.gameactors.ActorWithPhysics.Companion.TILE_SIZE
|
import net.torvald.terrarum.gameactors.ActorWithPhysics.Companion.TILE_SIZE
|
||||||
import net.torvald.terrarum.gamecontroller.GameController
|
import net.torvald.terrarum.gamecontroller.GameController
|
||||||
import net.torvald.terrarum.imagefont.TinyAlphNum
|
import net.torvald.terrarum.imagefont.TinyAlphNum
|
||||||
|
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||||
import net.torvald.terrarum.utils.JsonFetcher
|
import net.torvald.terrarum.utils.JsonFetcher
|
||||||
import net.torvald.terrarum.utils.JsonWriter
|
import net.torvald.terrarum.utils.JsonWriter
|
||||||
import net.torvald.terrarum.worlddrawer.RGB10
|
import net.torvald.terrarum.worlddrawer.RGB10
|
||||||
@@ -287,6 +289,10 @@ object TerrarumGDX : ApplicationAdapter() {
|
|||||||
fontSmallNumbers = TinyAlphNum
|
fontSmallNumbers = TinyAlphNum
|
||||||
|
|
||||||
|
|
||||||
|
ModMgr // invoke Module Manager, will also invoke BlockCodex
|
||||||
|
ItemCodex // invoke Item Codex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ingame = StateInGameGDX(batch)
|
ingame = StateInGameGDX(batch)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
|||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.colourutil.CIELabUtil.darkerLab
|
import net.torvald.colourutil.CIELabUtil.darkerLab
|
||||||
|
import net.torvald.terrarum.blockproperties.BlockCodex
|
||||||
import net.torvald.terrarum.itemproperties.GameItem
|
import net.torvald.terrarum.itemproperties.GameItem
|
||||||
import net.torvald.terrarum.ui.UIInventory
|
import net.torvald.terrarum.ui.UIInventory
|
||||||
import net.torvald.terrarum.ui.UIItem
|
import net.torvald.terrarum.ui.UIItem
|
||||||
@@ -49,7 +50,7 @@ class UIItemInventoryElem(
|
|||||||
private val textOffsetY = 8f
|
private val textOffsetY = 8f
|
||||||
|
|
||||||
|
|
||||||
private val durabilityCol = Color(0x22ff11)
|
private val durabilityCol = Color(0x22ff11_ff)
|
||||||
private val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
|
private val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
|
||||||
private val durabilityBarOffY = 35f
|
private val durabilityBarOffY = 35f
|
||||||
|
|
||||||
@@ -84,7 +85,10 @@ class UIItemInventoryElem(
|
|||||||
if (item != null && itemImage != null) {
|
if (item != null && itemImage != null) {
|
||||||
blendNormal()
|
blendNormal()
|
||||||
|
|
||||||
|
//println("orgID: ${item!!.originalID}, nameKey: ${BlockCodex[item!!.originalID].nameKey}, itemOrgName: ${item!!.originalName}")
|
||||||
|
|
||||||
// item image
|
// item image
|
||||||
|
batch.color = Color.WHITE
|
||||||
batch.draw(itemImage, posX + imgOffset, posY + imgOffset)
|
batch.draw(itemImage, posX + imgOffset, posY + imgOffset)
|
||||||
|
|
||||||
// if mouse is over, text lights up
|
// if mouse is over, text lights up
|
||||||
@@ -111,15 +115,19 @@ class UIItemInventoryElem(
|
|||||||
|
|
||||||
|
|
||||||
// quickslot marker (TEMPORARY UNTIL WE GET BETTER DESIGN)
|
// quickslot marker (TEMPORARY UNTIL WE GET BETTER DESIGN)
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
if (quickslot != null) {
|
if (quickslot != null) {
|
||||||
val label = quickslot!!.plus(0xE010).toChar()
|
val label = quickslot!!.plus(0xE010).toChar()
|
||||||
val labelW = TerrarumGDX.fontGame.getWidth("$label")
|
val labelW = TerrarumGDX.fontGame.getWidth("$label")
|
||||||
batch.color = Color.WHITE
|
|
||||||
TerrarumGDX.fontGame.draw(batch, "$label", barOffset + barFullLen - labelW, posY + textOffsetY)
|
TerrarumGDX.fontGame.draw(batch, "$label", barOffset + barFullLen - labelW, posY + textOffsetY)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see IFs above?
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun keyDown(keycode: Int): Boolean {
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
|
|||||||
/**
|
/**
|
||||||
* OriginalName is always read from Language files.
|
* OriginalName is always read from Language files.
|
||||||
*/
|
*/
|
||||||
abstract protected val originalName: String
|
abstract val originalName: String
|
||||||
|
|
||||||
private var newName: String = "I AM VITTUN PLACEHOLDER"
|
|
||||||
|
var newName: String = "I AM VITTUN PLACEHOLDER"
|
||||||
|
private set
|
||||||
|
|
||||||
var name: String
|
var name: String
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ object ItemCodex {
|
|||||||
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
println("[ItemCodex] recording item ID $originalID")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun primaryUse(delta: Float): Boolean {
|
override fun primaryUse(delta: Float): Boolean {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class UIInventory(
|
|||||||
iconSpriteSheet = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20),
|
iconSpriteSheet = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20),
|
||||||
iconSpriteSheetIndices = intArrayOf(9,6,7,1,0,2,3,4,5,8),
|
iconSpriteSheetIndices = intArrayOf(9,6,7,1,0,2,3,4,5,8),
|
||||||
iconCol = defaultTextColour,
|
iconCol = defaultTextColour,
|
||||||
highlightBackCol = Color(0xb8b8b8),
|
highlightBackCol = Color(0xb8b8b8_ff.toInt()),
|
||||||
highlightBackBlendMode = BlendMode.MULTIPLY,
|
highlightBackBlendMode = BlendMode.MULTIPLY,
|
||||||
backgroundCol = Color(0), // will use custom background colour!
|
backgroundCol = Color(0), // will use custom background colour!
|
||||||
backgroundBlendMode = BlendMode.NORMAL,
|
backgroundBlendMode = BlendMode.NORMAL,
|
||||||
@@ -102,9 +102,9 @@ class UIInventory(
|
|||||||
item = null,
|
item = null,
|
||||||
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
|
||||||
itemImage = null,
|
itemImage = null,
|
||||||
mouseoverBackCol = Color(0x282828),
|
mouseoverBackCol = Color(0x282828_ff),
|
||||||
mouseoverBackBlendMode = BlendMode.SCREEN,
|
mouseoverBackBlendMode = BlendMode.SCREEN,
|
||||||
backCol = Color(0xd4d4d4),
|
backCol = Color(0xd4d4d4_ff.toInt()),
|
||||||
backBlendMode = BlendMode.MULTIPLY,
|
backBlendMode = BlendMode.MULTIPLY,
|
||||||
drawBackOnNull = true,
|
drawBackOnNull = true,
|
||||||
inactiveTextCol = defaultTextColour
|
inactiveTextCol = defaultTextColour
|
||||||
@@ -167,7 +167,7 @@ class UIInventory(
|
|||||||
|
|
||||||
// cat bar background
|
// cat bar background
|
||||||
blendMul()
|
blendMul()
|
||||||
batch.color = Color(0xcccccc)
|
batch.color = Color(0xcccccc_ff.toInt())
|
||||||
batch.fillRect(0f, 0f, catButtons.width.toFloat(), height.toFloat())
|
batch.fillRect(0f, 0f, catButtons.width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
catButtons.render(batch)
|
catButtons.render(batch)
|
||||||
@@ -196,7 +196,7 @@ class UIInventory(
|
|||||||
|
|
||||||
// encumbrance bar background
|
// encumbrance bar background
|
||||||
blendMul()
|
blendMul()
|
||||||
batch.color = Color(0xa0a0a0)
|
batch.color = Color(0xa0a0a0_ff.toInt())
|
||||||
batch.fillRect(
|
batch.fillRect(
|
||||||
width - 3 - weightBarWidth,
|
width - 3 - weightBarWidth,
|
||||||
height - controlHelpHeight + 3f,
|
height - controlHelpHeight + 3f,
|
||||||
@@ -205,7 +205,7 @@ class UIInventory(
|
|||||||
)
|
)
|
||||||
// encumbrance bar
|
// encumbrance bar
|
||||||
blendNormal()
|
blendNormal()
|
||||||
batch.color = if (isEncumbered) Color(0xccff0000.toInt()) else Color(0xcc00ff00.toInt())
|
batch.color = if (isEncumbered) Color(0xff0000_cc.toInt()) else Color(0x00ff00_cc.toInt())
|
||||||
batch.fillRect(
|
batch.fillRect(
|
||||||
width - 3 - weightBarWidth,
|
width - 3 - weightBarWidth,
|
||||||
height - controlHelpHeight + 3f,
|
height - controlHelpHeight + 3f,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class UIItemTextButtonList(
|
|||||||
val highlightCol: Color = Color(0x00f8ff_ff),
|
val highlightCol: Color = Color(0x00f8ff_ff),
|
||||||
val highlightBackCol: Color = Color(0xb0b0b0_ff.toInt()),
|
val highlightBackCol: Color = Color(0xb0b0b0_ff.toInt()),
|
||||||
val highlightBackBlendMode: String = BlendMode.MULTIPLY,
|
val highlightBackBlendMode: String = BlendMode.MULTIPLY,
|
||||||
val inactiveCol: Color = Color(0xc0c0c0),
|
val inactiveCol: Color = Color(0xc0c0c0_ff.toInt()),
|
||||||
val backgroundCol: Color = Color(0),
|
val backgroundCol: Color = Color(0),
|
||||||
val backgroundBlendMode: String = BlendMode.NORMAL,
|
val backgroundBlendMode: String = BlendMode.NORMAL,
|
||||||
val kinematic: Boolean = false
|
val kinematic: Boolean = false
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user