mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
inventory screen doesn't need two char info display
This commit is contained in:
@@ -319,9 +319,6 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
logo.texture.dispose()
|
logo.texture.dispose()
|
||||||
|
|
||||||
IngameRenderer.dispose()
|
|
||||||
|
|
||||||
uiMenu.dispose()
|
uiMenu.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -586,6 +586,8 @@ object IngameRenderer {
|
|||||||
lightmapFboB.dispose()
|
lightmapFboB.dispose()
|
||||||
|
|
||||||
LightmapRenderer.dispose()
|
LightmapRenderer.dispose()
|
||||||
|
BlocksDrawer.dispose()
|
||||||
|
WeatherMixer.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun worldCamToRenderPos(): Pair<Float, Float> {
|
private fun worldCamToRenderPos(): Pair<Float, Float> {
|
||||||
|
|||||||
@@ -7,18 +7,16 @@ import com.badlogic.gdx.graphics.GL20
|
|||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.Terrarum.PLAYER_REF_ID
|
import net.torvald.terrarum.AppLoader.printdbg
|
||||||
import net.torvald.terrarum.gameactors.Actor
|
|
||||||
import net.torvald.terrarum.gameactors.ActorWBMovable
|
import net.torvald.terrarum.gameactors.ActorWBMovable
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.modulebasegame.Ingame
|
import net.torvald.terrarum.modulebasegame.Ingame
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory.Companion.CAPACITY_MODE_NO_ENCUMBER
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||||
import net.torvald.terrarum.serialise.ReadWorldInfo
|
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItem
|
import net.torvald.terrarum.ui.UIItem
|
||||||
import net.torvald.terrarum.ui.UIItemTextButtonList
|
import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||||
|
import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_LINE_HEIGHT
|
||||||
import net.torvald.terrarum.ui.UIUtils
|
import net.torvald.terrarum.ui.UIUtils
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
@@ -113,14 +111,13 @@ class UIInventoryFull(
|
|||||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
|
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
|
||||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
||||||
)
|
)
|
||||||
|
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
|
||||||
|
private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size
|
||||||
private val gameMenuListWidth = 400
|
private val gameMenuListWidth = 400
|
||||||
private val gameMenuListHeight = UIItemPlayerInfoCell.HEIGHT
|
|
||||||
private val gameMenuCharInfoHeight = 64 + 40 // no top margin, 40 bottom margin
|
|
||||||
private val gameMenuListTotalHeight = gameMenuListHeight + gameMenuCharInfoHeight
|
|
||||||
private val gameMenuButtons = UIItemTextButtonList(
|
private val gameMenuButtons = UIItemTextButtonList(
|
||||||
this, arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS"),
|
this, gameMenu,
|
||||||
Terrarum.WIDTH + (Terrarum.WIDTH - gameMenuListWidth) / 2,
|
Terrarum.WIDTH + (Terrarum.WIDTH - gameMenuListWidth) / 2,
|
||||||
(itemList.height - gameMenuListTotalHeight) / 2 + itemList.posY + gameMenuCharInfoHeight,
|
(itemList.height - gameMenuListHeight) / 2 + itemList.posY,
|
||||||
gameMenuListWidth, gameMenuListHeight,
|
gameMenuListWidth, gameMenuListHeight,
|
||||||
readFromLang = true,
|
readFromLang = true,
|
||||||
textAreaWidth = gameMenuListWidth,
|
textAreaWidth = gameMenuListWidth,
|
||||||
@@ -160,8 +157,6 @@ class UIInventoryFull(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val testPlayerInfoCell: UIItemPlayerInfoCell
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addItem(categoryBar)
|
addItem(categoryBar)
|
||||||
itemList.let { addItem(it) }
|
itemList.let { addItem(it) }
|
||||||
@@ -174,16 +169,6 @@ class UIInventoryFull(
|
|||||||
itemList.rebuild() // have to manually rebuild, too!
|
itemList.rebuild() // have to manually rebuild, too!
|
||||||
}
|
}
|
||||||
|
|
||||||
testPlayerInfoCell = UIItemPlayerInfoCell(
|
|
||||||
this,
|
|
||||||
ReadWorldInfo.SaveMetaData("The Yucky Panopticon", 0L,0L,0L,0L,0L, (actor as Actor).referenceID!!, 84873L, 1500000000L, 2000000000L, 2, byteArrayOf(0), byteArrayOf(0), byteArrayOf(0), playerWallet = 13372),
|
|
||||||
gameMenuListWidth,
|
|
||||||
Terrarum.WIDTH + ((Terrarum.WIDTH - 400) / 2) + menuScrOffX.toInt(),
|
|
||||||
(itemList.height - gameMenuListTotalHeight) / 2 + itemList.posY,
|
|
||||||
false,
|
|
||||||
Terrarum.ingame!!.getActorByID(PLAYER_REF_ID) as IngamePlayer
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
rebuildList()
|
rebuildList()
|
||||||
|
|
||||||
@@ -191,7 +176,6 @@ class UIInventoryFull(
|
|||||||
addToTransitionalGroup(itemList)
|
addToTransitionalGroup(itemList)
|
||||||
addToTransitionalGroup(equipped)
|
addToTransitionalGroup(equipped)
|
||||||
addToTransitionalGroup(gameMenuButtons)
|
addToTransitionalGroup(gameMenuButtons)
|
||||||
addToTransitionalGroup(testPlayerInfoCell)
|
|
||||||
|
|
||||||
// make gameMenuButtons work
|
// make gameMenuButtons work
|
||||||
gameMenuButtons.selectionChangeListener = { old, new ->
|
gameMenuButtons.selectionChangeListener = { old, new ->
|
||||||
@@ -358,9 +342,6 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
// text buttons
|
// text buttons
|
||||||
gameMenuButtons.render(batch, camera)
|
gameMenuButtons.render(batch, camera)
|
||||||
|
|
||||||
// character info window
|
|
||||||
testPlayerInfoCell.render(batch, camera)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderScreenInventory(batch: SpriteBatch, camera: Camera) {
|
private fun renderScreenInventory(batch: SpriteBatch, camera: Camera) {
|
||||||
@@ -408,6 +389,8 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
|
|
||||||
fun rebuildList() {
|
fun rebuildList() {
|
||||||
|
printdbg(this, "rebuilding list")
|
||||||
|
|
||||||
itemList.rebuild()
|
itemList.rebuild()
|
||||||
equipped.rebuild()
|
equipped.rebuild()
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import net.torvald.terrarum.Yaml
|
|||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItemTextButton
|
import net.torvald.terrarum.ui.UIItemTextButton
|
||||||
import net.torvald.terrarum.ui.UIItemTextButtonList
|
import net.torvald.terrarum.ui.UIItemTextButtonList
|
||||||
import kotlin.collections.ArrayList
|
import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_LINE_HEIGHT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2018-08-29.
|
* Created by minjaesong on 2018-08-29.
|
||||||
@@ -297,8 +297,8 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val remoConWidth = 304
|
val remoConWidth = 304
|
||||||
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
|
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
|
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()
|
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,4 +267,8 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
extraImages = extraImages
|
extraImages = extraImages
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class UIItemTextButtonList(
|
|||||||
override var posX: Int,
|
override var posX: Int,
|
||||||
override var posY: Int,
|
override var posY: Int,
|
||||||
override var width: Int,
|
override var width: Int,
|
||||||
override var height: Int,
|
override var height: Int = DEFAULT_LINE_HEIGHT * labelsList.size,
|
||||||
val readFromLang: Boolean = false,
|
val readFromLang: Boolean = false,
|
||||||
val defaultSelection: Int? = null, // negative: INVALID, positive: valid, null: no select
|
val defaultSelection: Int? = null, // negative: INVALID, positive: valid, null: no select
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ class UIItemTextButtonList(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_BACKGROUNDCOL = Color(0x242424_80)
|
val DEFAULT_BACKGROUNDCOL = Color(0x242424_80)
|
||||||
|
val DEFAULT_LINE_HEIGHT = 36
|
||||||
}
|
}
|
||||||
|
|
||||||
// deal with the moving position
|
// deal with the moving position
|
||||||
|
|||||||
@@ -863,6 +863,18 @@ internal object BlocksDrawer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dispose() {
|
||||||
|
printdbg(this, "dispose called by")
|
||||||
|
Thread.currentThread().stackTrace.forEach {
|
||||||
|
printdbg(this, it)
|
||||||
|
}
|
||||||
|
|
||||||
|
weatherTerrains.forEach { it.dispose() }
|
||||||
|
tilesWire.dispose()
|
||||||
|
tileItemWall.dispose()
|
||||||
|
tilesFluid.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
fun getRenderStartX(): Int = WorldCamera.x / TILE_SIZE
|
fun getRenderStartX(): Int = WorldCamera.x / TILE_SIZE
|
||||||
fun getRenderStartY(): Int = WorldCamera.y / TILE_SIZE
|
fun getRenderStartY(): Int = WorldCamera.y / TILE_SIZE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user