mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 06:11:50 +09:00
item tooltip descriptions
This commit is contained in:
@@ -124,7 +124,9 @@ object Lang {
|
||||
private val bindOp = ">>="
|
||||
|
||||
fun getOrNull(key: String?, capitalise: Boolean = true) =
|
||||
if (key == null) null else get(key, capitalise)
|
||||
if (key == null) null else get(key, capitalise).let {
|
||||
if (it.startsWith("$")) null else it
|
||||
}
|
||||
|
||||
/**
|
||||
* Syntax example:
|
||||
|
||||
@@ -91,7 +91,8 @@ class FixtureWorldPortal : Electric {
|
||||
|
||||
val ingame = TerrarumIngame(App.batch)
|
||||
val worldParam = TerrarumIngame.NewGameParams(player, it.worldLoadParam) { ingame ->
|
||||
val world = ingame.world
|
||||
// I SCRAP THIS IDEA: it makes the game way too easy
|
||||
/*val world = ingame.world
|
||||
|
||||
// flatten terrain
|
||||
for (x in world.spawnX - 2..world.spawnX + 2) {
|
||||
@@ -111,7 +112,7 @@ class FixtureWorldPortal : Electric {
|
||||
printdbg(this, "Portal new world callback; spawning portal at ${world.spawnX}, ${world.spawnY - 1}")
|
||||
FixtureWorldPortal().spawn(world.spawnX, world.spawnY - 1, player.uuid)
|
||||
printdbg(this, "Spawn complete")
|
||||
|
||||
*/
|
||||
}
|
||||
ingame.gameLoadInfoPayload = worldParam
|
||||
ingame.gameLoadMode = TerrarumIngame.GameLoadMode.CREATE_NEW
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.ui.InventoryCellColourTheme
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
||||
@@ -134,14 +135,13 @@ class UIItemInventoryElemSimple(
|
||||
|
||||
val grey = App.fontGame.toColorCode(11, 11, 11)
|
||||
val itemIDstr = "\n$grey(${item?.originalID}${if (item?.originalID == item?.dynamicID) "" else "/${item?.dynamicID}"})"
|
||||
val nameStr = if (item?.nameSecondary?.isNotBlank() == true) "${item?.name}\n$grey${item?.nameSecondary}" else "${item?.name}"
|
||||
val nameStr0 = if (item?.nameSecondary?.isNotBlank() == true) "${item?.name}\n$grey${item?.nameSecondary}" else "${item?.name}"
|
||||
val nameStr = if (App.IS_DEVELOPMENT_BUILD) nameStr0 + itemIDstr else nameStr0
|
||||
val descStr = Lang.getOrNull("TOOLTIP_${item?.originalID}")?.replace("\n","\n$grey")
|
||||
|
||||
INGAME.setTooltipMessage(
|
||||
if (App.IS_DEVELOPMENT_BUILD)
|
||||
nameStr + itemIDstr
|
||||
else
|
||||
nameStr
|
||||
)
|
||||
val finalStr = if (descStr != null) "$nameStr\n$grey$descStr" else nameStr
|
||||
|
||||
INGAME.setTooltipMessage(finalStr)
|
||||
|
||||
tooltipShowing[hash] = true
|
||||
// printdbg(this, tooltipShowing.entries)
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.IS_DEVELOPMENT_BUILD
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.ui.InventoryCellColourTheme
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
||||
@@ -161,19 +162,18 @@ class UIItemInventoryElemWide(
|
||||
|
||||
|
||||
// set tooltip accordingly
|
||||
if (IS_DEVELOPMENT_BUILD && tooltipShowing[hash] != true && item != null && mouseUp) {
|
||||
if (tooltipShowing[hash] != true && item != null && mouseUp) {
|
||||
// printdbg(this, "calling INGAME.setTooltipMessage by $hash")
|
||||
|
||||
val grey = App.fontGame.toColorCode(11, 11, 11)
|
||||
val itemIDstr = "\n$grey(${item?.originalID}${if (item?.originalID == item?.dynamicID) "" else "/${item?.dynamicID}"})"
|
||||
val nameStr = if (item?.nameSecondary?.isNotBlank() == true) "${item?.name}\n$grey${item?.nameSecondary}" else "${item?.name}"
|
||||
val nameStr0 = if (item?.nameSecondary?.isNotBlank() == true) "${item?.name}\n$grey${item?.nameSecondary}" else "${item?.name}"
|
||||
val nameStr = if (App.IS_DEVELOPMENT_BUILD) nameStr0 + itemIDstr else nameStr0
|
||||
val descStr = Lang.getOrNull("TOOLTIP_${item?.originalID}")?.replace("\n","\n$grey")
|
||||
|
||||
INGAME.setTooltipMessage(
|
||||
if (App.IS_DEVELOPMENT_BUILD)
|
||||
nameStr + itemIDstr
|
||||
else
|
||||
nameStr
|
||||
)
|
||||
val finalStr = if (descStr != null) "$nameStr\n$grey$descStr" else nameStr
|
||||
|
||||
INGAME.setTooltipMessage(finalStr)
|
||||
|
||||
tooltipShowing[hash] = true
|
||||
// printdbg(this, tooltipShowing.entries)
|
||||
|
||||
Reference in New Issue
Block a user