mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
inventoryui: adjusting inventory gap magic number so that inventory look pretty on 720p
This commit is contained in:
@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameitem.GameItem
|
|||||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||||
|
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText
|
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellCommonRes.toItemCountText
|
||||||
@@ -105,7 +106,7 @@ class UIItemInventoryElem(
|
|||||||
// this one-liner sets color
|
// this one-liner sets color
|
||||||
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
|
||||||
// draw name of the item
|
// draw name of the item
|
||||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
if (INVEN_DEBUG_MODE) {
|
||||||
AppLoader.fontGame.draw(batch,
|
AppLoader.fontGame.draw(batch,
|
||||||
// print static id, dynamic id, and count
|
// print static id, dynamic id, and count
|
||||||
"${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""),
|
"${item!!.originalID}/${item!!.dynamicID}" + (if (amount > 0 && item!!.stackable) "$fwsp($amountString)" else if (amount != 1) "$fwsp!!$amountString!!" else ""),
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.torvald.terrarum.*
|
|||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
||||||
|
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ internal class UIInventoryCells(
|
|||||||
)
|
)
|
||||||
// debug text
|
// debug text
|
||||||
batch.color = Color.LIGHT_GRAY
|
batch.color = Color.LIGHT_GRAY
|
||||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
if (INVEN_DEBUG_MODE) {
|
||||||
AppLoader.fontSmallNumbers.draw(batch,
|
AppLoader.fontSmallNumbers.draw(batch,
|
||||||
"${full.actor.inventory.capacity}/${full.actor.inventory.maxCapacity}",
|
"${full.actor.inventory.capacity}/${full.actor.inventory.maxCapacity}",
|
||||||
encumbBarTextXPos,
|
encumbBarTextXPos,
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ class UIInventoryFull(
|
|||||||
override var height: Int = AppLoader.screenH
|
override var height: Int = AppLoader.screenH
|
||||||
override var openCloseTime: Second = 0.0f
|
override var openCloseTime: Second = 0.0f
|
||||||
|
|
||||||
val REQUIRED_MARGIN = 166 // hard-coded value. Don't know the details
|
val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
|
||||||
|
|
||||||
val CELLS_HOR = 10
|
val CELLS_HOR = 10
|
||||||
val CELLS_VRT = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryDynamicList.listGap) / // 134 is another magic number
|
val CELLS_VRT: Int; get() = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryDynamicList.listGap) / // 134 is another magic number
|
||||||
(UIItemInventoryElemSimple.height + UIItemInventoryDynamicList.listGap)
|
(UIItemInventoryElemSimple.height + UIItemInventoryDynamicList.listGap)
|
||||||
|
|
||||||
private val itemListToEquipViewGap = UIItemInventoryDynamicList.listGap // used to be 24; figured out that the extra gap does nothig
|
private val itemListToEquipViewGap = UIItemInventoryDynamicList.listGap // used to be 24; figured out that the extra gap does nothig
|
||||||
@@ -46,9 +46,9 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryDynamicList.Companion.listGap
|
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryDynamicList.Companion.listGap
|
||||||
|
|
||||||
val INVENTORY_CELLS_UI_HEIGHT = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryDynamicList.listGap
|
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryDynamicList.listGap
|
||||||
val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.screenW - internalWidth) / 2
|
val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.screenW - internalWidth) / 2
|
||||||
val INVENTORY_CELLS_OFFSET_Y = 107 + (AppLoader.screenH - internalHeight) / 2
|
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenH - internalHeight) / 2
|
||||||
|
|
||||||
init {
|
init {
|
||||||
handler.allowESCtoClose = true
|
handler.allowESCtoClose = true
|
||||||
@@ -253,5 +253,9 @@ class UIInventoryFull(
|
|||||||
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||||
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val INVEN_DEBUG_MODE = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
|||||||
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
|
import net.torvald.terrarum.modulebasegame.gameactors.InventoryPair
|
||||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK
|
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK
|
||||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK_ACTIVE
|
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_BLACK_ACTIVE
|
||||||
|
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
|
||||||
import net.torvald.terrarum.ui.UIItem
|
import net.torvald.terrarum.ui.UIItem
|
||||||
import net.torvald.terrarum.ui.UIItemImageButton
|
import net.torvald.terrarum.ui.UIItemImageButton
|
||||||
import net.torvald.terrarum.ui.UIItemTextButton.Companion.defaultActiveCol
|
import net.torvald.terrarum.ui.UIItemTextButton.Companion.defaultActiveCol
|
||||||
@@ -309,7 +310,7 @@ class UIItemInventoryDynamicList(
|
|||||||
// set tooltip accordingly
|
// set tooltip accordingly
|
||||||
if (isCompactMode && it.item != null && it.mouseUp && !tooltipSet) {
|
if (isCompactMode && it.item != null && it.mouseUp && !tooltipSet) {
|
||||||
(Terrarum.ingame as? TerrarumIngame)?.setTooltipMessage(
|
(Terrarum.ingame as? TerrarumIngame)?.setTooltipMessage(
|
||||||
if (AppLoader.IS_DEVELOPMENT_BUILD) {
|
if (INVEN_DEBUG_MODE) {
|
||||||
it.item?.name + "/Mat: ${it.item?.material?.identifier}"
|
it.item?.name + "/Mat: ${it.item?.material?.identifier}"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
SortRole=type
|
|
||||||
Timestamp=2020,2,22,4,4,10
|
|
||||||
Version=4
|
|
||||||
ViewMode=1
|
|
||||||
VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_type,CustomizedDetails
|
|
||||||
|
|
||||||
[Settings]
|
|
||||||
HiddenFilesShown=true
|
|
||||||
Reference in New Issue
Block a user