hit q to close the storage chest gui

This commit is contained in:
minjaesong
2021-08-07 00:27:32 +09:00
parent f7ce911c9e
commit ce9b86d637
6 changed files with 19 additions and 13 deletions

View File

@@ -331,10 +331,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// >- queue up game UIs that should pause the world -<
uiInventoryPlayer = UIInventoryFull(actorNowPlaying!!,
toggleKeyLiteral = AppLoader.getConfigInt("config_keyinventory"),
toggleButtonLiteral = AppLoader.getConfigInt("config_gamepadstart")
)
uiInventoryPlayer = UIInventoryFull()
uiInventoryPlayer.setPosition(0, 0)
// >- lesser UIs -<
@@ -357,7 +354,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
//uiVitalItem = UIVitalMetre(player, { null }, { null }, Color(0xffcc00), 0, customPositioning = true)
//uiVitalItem.setAsAlwaysVisible()
uiWatchTierOne = UITierOneWatch(actorNowPlaying)
uiWatchTierOne = UITierOneWatch()
uiWatchTierOne.setAsAlwaysVisible()
uiWatchTierOne.setPosition(
((AppLoader.screenSize.screenW - AppLoader.screenSize.tvSafeActionWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
@@ -365,7 +362,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
)
// basic watch-style notification bar (temperature, new mail)
uiBasicInfo = UIBasicInfo(actorNowPlaying)
uiBasicInfo = UIBasicInfo()
uiBasicInfo.setAsAlwaysVisible()
uiBasicInfo.setPosition((uiQuickBar.posX - uiBasicInfo.width - AppLoader.screenSize.tvSafeActionWidth) / 2 + AppLoader.screenSize.tvSafeActionWidth, uiWatchTierOne.posY)

View File

@@ -55,7 +55,10 @@ internal class FixtureStorageChest(nameFun: () -> String) : FixtureBase(
}
internal class UIStorageChest : UICanvas(), HasInventory {
internal class UIStorageChest : UICanvas(
toggleKeyLiteral = AppLoader.getConfigInt("config_keyinventory"),
toggleButtonLiteral = AppLoader.getConfigInt("config_gamepadstart"),
), HasInventory {
lateinit var chestInventory: FixtureInventory
lateinit var chestNameFun: () -> String

View File

@@ -15,7 +15,11 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
* Created by minjaesong on 2017-06-10.
*/
class UIBasicInfo(private val player: ActorHumanoid?) : UICanvas() {
class UIBasicInfo() : UICanvas() {
val player: ActorHumanoid?
get() = Terrarum.ingame?.actorNowPlaying
override var width = 93
override var height = 23
override var openCloseTime: Second = 0f
@@ -51,7 +55,7 @@ class UIBasicInfo(private val player: ActorHumanoid?) : UICanvas() {
private val temperature: Int
get() {
if (player != null) {
val playerTilePos = player.hIntTilewiseHitbox
val playerTilePos = player!!.hIntTilewiseHitbox
val tempCelsius = -273f + ((Terrarum.ingame as? TerrarumIngame)?.world?.getTemperature(playerTilePos.centeredX.toInt(), playerTilePos.centeredY.toInt()) ?: 288f)
return if (tempCelsius < -10)

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.AppLoader.*
import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
import net.torvald.terrarum.ui.*
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
@@ -17,14 +18,15 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
* Created by minjaesong on 2017-10-21.
*/
class UIInventoryFull(
var actor: Pocketed,
toggleKeyLiteral: Int? = null, toggleButtonLiteral: Int? = null,
toggleKeyLiteral: Int? = AppLoader.getConfigInt("config_keyinventory"), toggleButtonLiteral: Int? = AppLoader.getConfigInt("config_gamepadstart"),
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
customPositioning: Boolean = false, // mainly used by vital meter
doNotWarnConstant: Boolean = false
) : UICanvas(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant) {
val actor: ActorHumanoid
get() = Terrarum.ingame!!.actorNowPlaying!!
override var width: Int = AppLoader.screenSize.screenW
override var height: Int = AppLoader.screenSize.screenH
override var openCloseTime: Second = 0.0f

View File

@@ -16,7 +16,7 @@ import kotlin.math.roundToInt
/**
* Created by minjaesong on 2017-06-11.
*/
class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
class UITierOneWatch() : UICanvas() {
override var width = 160
override var height = 23
override var openCloseTime: Second = 0f