mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-10 13:51:53 +09:00
inventory navbar to its own uiitem
This commit is contained in:
@@ -203,8 +203,8 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
||||
)
|
||||
|
||||
// make sure grid buttons for ingredients do nothing (even if they are hidden!)
|
||||
itemListIngredients.gridModeButtons[0].touchDownListener = { _,_,_,_ -> }
|
||||
itemListIngredients.gridModeButtons[1].touchDownListener = { _,_,_,_ -> }
|
||||
itemListIngredients.navRemoCon.listButtonListener = { _,_, -> }
|
||||
itemListIngredients.navRemoCon.gridButtonListener = { _,_, -> }
|
||||
itemListIngredients.isCompactMode = true
|
||||
itemListIngredients.setCustomHighlightRuleSub {
|
||||
it.item?.let { ingredient ->
|
||||
|
||||
@@ -86,13 +86,18 @@ open class UIItemInventoryItemGrid(
|
||||
|
||||
private val inventoryUI = parentUI
|
||||
|
||||
var itemPage = 0
|
||||
var itemPage
|
||||
set(value) {
|
||||
field = if (itemPageCount == 0) 0 else (value).fmod(itemPageCount)
|
||||
navRemoCon.itemPage = if (itemPageCount == 0) 0 else (value).fmod(itemPageCount)
|
||||
rebuild(currentFilter)
|
||||
}
|
||||
var itemPageCount = 1 // TODO total size of current category / items.size
|
||||
protected set
|
||||
get() = navRemoCon.itemPage
|
||||
|
||||
var itemPageCount // TODO total size of current category / items.size
|
||||
protected set(value) {
|
||||
navRemoCon.itemPageCount = value
|
||||
}
|
||||
get() = navRemoCon.itemPageCount
|
||||
|
||||
var inventorySortList = ArrayList<InventoryPair>()
|
||||
protected var rebuildList = true
|
||||
@@ -223,50 +228,9 @@ open class UIItemInventoryItemGrid(
|
||||
}
|
||||
|
||||
private val iconPosX = if (drawScrollOnRightside)
|
||||
posX + width + LIST_TO_CONTROL_GAP
|
||||
posX + width
|
||||
else
|
||||
posX - LIST_TO_CONTROL_GAP - catBar.catIcons.tileW
|
||||
|
||||
|
||||
/** Long/compact mode buttons */
|
||||
val gridModeButtons = Array<UIItemImageButton>(2) { index ->
|
||||
UIItemImageButton(
|
||||
parentUI,
|
||||
catBar.catIcons.get(index + 14, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(index),
|
||||
highlightable = true
|
||||
)
|
||||
}
|
||||
|
||||
private val scrollUpButton = UIItemImageButton(
|
||||
parentUI,
|
||||
catBar.catIcons.get(18, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(2),
|
||||
highlightable = false
|
||||
)
|
||||
|
||||
private val scrollDownButton = UIItemImageButton(
|
||||
parentUI,
|
||||
catBar.catIcons.get(19, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(3),
|
||||
highlightable = false
|
||||
)
|
||||
posX - UIItemListNavBarVertical.LIST_TO_CONTROL_GAP - UIItemListNavBarVertical.WIDTH - 4
|
||||
|
||||
fun setCustomHighlightRuleMain(predicate: ((UIItemInventoryCellBase) -> Boolean)?) {
|
||||
itemGrid.forEach { it.customHighlightRuleMain = predicate }
|
||||
@@ -282,63 +246,53 @@ open class UIItemInventoryItemGrid(
|
||||
itemPage = if (itemPageCount == 0) 0 else (itemPage + relativeAmount).fmod(itemPageCount)
|
||||
}
|
||||
|
||||
val navRemoCon = UIItemListNavBarVertical(parentUI, iconPosX, posY + 8, height, true, if (isCompactMode) 1 else 0)
|
||||
|
||||
init {
|
||||
// initially highlight grid mode buttons
|
||||
if (!hideSidebar) {
|
||||
gridModeButtons[if (isCompactMode) 1 else 0].highlighted = true
|
||||
|
||||
|
||||
gridModeButtons[0].touchDownListener = { _, _, _, _ ->
|
||||
navRemoCon.listButtonListener = { _, _ ->
|
||||
isCompactMode = false
|
||||
gridModeButtons[0].highlighted = true
|
||||
gridModeButtons[1].highlighted = false
|
||||
itemPage = 0
|
||||
rebuild(currentFilter)
|
||||
}
|
||||
gridModeButtons[1].touchDownListener = { _, _, _, _ ->
|
||||
navRemoCon.gridButtonListener = { _, _ ->
|
||||
isCompactMode = true
|
||||
gridModeButtons[0].highlighted = false
|
||||
gridModeButtons[1].highlighted = true
|
||||
itemPage = 0
|
||||
rebuild(currentFilter)
|
||||
}
|
||||
|
||||
scrollUpButton.clickOnceListener = { _, _, _ ->
|
||||
scrollUpButton.highlighted = false
|
||||
navRemoCon.scrollUpListener = { _, it ->
|
||||
it.highlighted = false
|
||||
scrollItemPage(-1)
|
||||
}
|
||||
scrollDownButton.clickOnceListener = { _, _, _ ->
|
||||
scrollDownButton.highlighted = false
|
||||
navRemoCon.scrollDownListener = { _, it ->
|
||||
it.highlighted = false
|
||||
scrollItemPage(1)
|
||||
}
|
||||
|
||||
// if (is.mouseUp) handled by this.touchDown()
|
||||
// draw wallet text
|
||||
navRemoCon.extraDrawOpOnBottom = { ui, batch ->
|
||||
if (drawWallet) {
|
||||
batch.color = Color.WHITE
|
||||
walletText.forEachIndexed { index, it ->
|
||||
batch.draw(
|
||||
walletFont.get(0, it - '0'),
|
||||
ui.gridModeButtons[0].posX - 1f, // scroll button size: 20px, font width: 20 px
|
||||
ui.gridModeButtons[0].posY + height - index * walletFont.tileH - 18f
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val upDownButtonGapToDots = 7 // apparent gap may vary depend on the texture itself
|
||||
// private val upDownButtonGapToDots = 7 // apparent gap may vary depend on the texture itself
|
||||
|
||||
private fun getIconPosY(index: Int) =
|
||||
posY + 8 + 26 * index
|
||||
// private fun getIconPosY(index: Int) =
|
||||
// posY + 8 + 26 * index
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
val posXDelta = posX - oldPosX
|
||||
itemGrid.forEach { it.posX += posXDelta }
|
||||
itemList.forEach { it.posX += posXDelta }
|
||||
if (!hideSidebar) {
|
||||
gridModeButtons.forEach { it.posX += posXDelta }
|
||||
scrollUpButton.posX += posXDelta
|
||||
scrollDownButton.posX += posXDelta
|
||||
}
|
||||
|
||||
|
||||
fun getScrollDotYHeight(i: Int) = scrollUpButton.posY + 14 + upDownButtonGapToDots + 10 * i
|
||||
|
||||
|
||||
scrollDownButton.posY = getScrollDotYHeight(itemPageCount) + upDownButtonGapToDots
|
||||
|
||||
|
||||
// define each button's highlighted status from the list of forceHighlighted, then render the button
|
||||
items.forEach {
|
||||
if (useHighlightingManager) it.forceHighlighted = forceHighlightList.contains(it.item?.dynamicID)
|
||||
@@ -346,41 +300,7 @@ open class UIItemInventoryItemGrid(
|
||||
}
|
||||
|
||||
if (!hideSidebar) {
|
||||
// draw the tray
|
||||
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||
Toolkit.fillArea(batch, iconPosX - 4, getIconPosY(0) - 8, 28, height)
|
||||
// cell border
|
||||
batch.color = colourTheme.cellHighlightNormalCol
|
||||
Toolkit.drawBoxBorder(batch, iconPosX - 4, getIconPosY(0) - 8, 28, height)
|
||||
|
||||
gridModeButtons.forEach { it.render(batch, camera) }
|
||||
scrollUpButton.render(batch, camera)
|
||||
scrollDownButton.render(batch, camera)
|
||||
|
||||
// draw scroll dots
|
||||
for (i in 0 until itemPageCount) {
|
||||
val colour = if (i == itemPage) Color.WHITE else Color(0xffffff7f.toInt())
|
||||
|
||||
batch.color = colour
|
||||
batch.draw(
|
||||
catBar.catIcons.get(if (i == itemPage) 20 else 21, 0),
|
||||
iconPosX.toFloat(),
|
||||
getScrollDotYHeight(i).toFloat()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// draw wallet text
|
||||
if (drawWallet) {
|
||||
batch.color = Color.WHITE
|
||||
walletText.forEachIndexed { index, it ->
|
||||
batch.draw(
|
||||
walletFont.get(0, it - '0'),
|
||||
gridModeButtons[0].posX - 1f, // scroll button size: 20px, font width: 20 px
|
||||
gridModeButtons[0].posY + height - index * walletFont.tileH - 18f
|
||||
)
|
||||
}
|
||||
navRemoCon.render(batch, camera)
|
||||
}
|
||||
|
||||
super.render(batch, camera)
|
||||
@@ -424,9 +344,7 @@ open class UIItemInventoryItemGrid(
|
||||
|
||||
|
||||
if (!hideSidebar) {
|
||||
gridModeButtons.forEach { it.update(delta) }
|
||||
scrollUpButton.update(delta)
|
||||
scrollDownButton.update(delta)
|
||||
navRemoCon.update(delta)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,9 +467,7 @@ open class UIItemInventoryItemGrid(
|
||||
|
||||
items.forEach { if (it.mouseUp) it.touchDown(screenX, screenY, pointer, button) }
|
||||
if (!hideSidebar) {
|
||||
gridModeButtons.forEach { if (it.mouseUp) it.touchDown(screenX, screenY, pointer, button) }
|
||||
if (scrollUpButton.mouseUp) scrollUpButton.touchDown(screenX, screenY, pointer, button)
|
||||
if (scrollDownButton.mouseUp) scrollDownButton.touchDown(screenX, screenY, pointer, button)
|
||||
navRemoCon.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.BlendMode
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.toInt
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItem
|
||||
import net.torvald.terrarum.ui.UIItemImageButton
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2023-06-17.
|
||||
*/
|
||||
class UIItemListNavBarVertical(
|
||||
parentUI: UICanvas, initialX: Int, initialY: Int,
|
||||
override val height: Int,
|
||||
hasGridModeButtons: Boolean, initialModeSelection: Int = 0,
|
||||
private val colourTheme: InventoryCellColourTheme = UIItemInventoryCellCommonRes.defaultInventoryCellTheme,
|
||||
var extraDrawOpOnBottom: (UIItemListNavBarVertical, SpriteBatch) -> Unit = { _,_ -> }
|
||||
) : UIItem(parentUI, initialX, initialY) {
|
||||
|
||||
override val width = UIItemListNavBarVertical.WIDTH
|
||||
|
||||
companion object {
|
||||
const val WIDTH = 28
|
||||
const val LIST_TO_CONTROL_GAP = 12
|
||||
}
|
||||
|
||||
private fun getIconPosY(index: Int) =
|
||||
posY + 26 * index
|
||||
private val catIcons = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||
private val iconPosX = posX + LIST_TO_CONTROL_GAP
|
||||
|
||||
val gridModeButtons = Array<UIItemImageButton>(2) { index ->
|
||||
UIItemImageButton(
|
||||
parentUI,
|
||||
catIcons.get(index + 14, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(index),
|
||||
highlightable = true
|
||||
)
|
||||
}
|
||||
|
||||
val scrollUpButton = UIItemImageButton(
|
||||
parentUI,
|
||||
catIcons.get(18, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(2 - (!hasGridModeButtons).toInt(1)),
|
||||
highlightable = false
|
||||
)
|
||||
|
||||
val scrollDownButton = UIItemImageButton(
|
||||
parentUI,
|
||||
catIcons.get(19, 0),
|
||||
backgroundCol = Color(0),
|
||||
activeBackCol = Color(0),
|
||||
activeBackBlendMode = BlendMode.NORMAL,
|
||||
activeCol = Toolkit.Theme.COL_MOUSE_UP,
|
||||
initialX = iconPosX,
|
||||
initialY = getIconPosY(3 - (!hasGridModeButtons).toInt(1)),
|
||||
highlightable = false
|
||||
)
|
||||
|
||||
private val upDownButtonGapToDots = 7 // apparent gap may vary depend on the texture itself
|
||||
|
||||
init {
|
||||
gridModeButtons[initialModeSelection].highlighted = true
|
||||
|
||||
gridModeButtons[0].touchDownListener = { _, _, _, _ ->
|
||||
gridModeButtons[0].highlighted = true
|
||||
gridModeButtons[1].highlighted = false
|
||||
itemPage = 0
|
||||
listButtonListener(this, gridModeButtons[0])
|
||||
}
|
||||
gridModeButtons[1].touchDownListener = { _, _, _, _ ->
|
||||
gridModeButtons[0].highlighted = false
|
||||
gridModeButtons[1].highlighted = true
|
||||
itemPage = 0
|
||||
gridButtonListener(this, gridModeButtons[1])
|
||||
}
|
||||
|
||||
scrollUpButton.clickOnceListener = { _, _, _ ->
|
||||
scrollUpButton.highlighted = false
|
||||
scrollUpListener(this, scrollUpButton)
|
||||
}
|
||||
scrollDownButton.clickOnceListener = { _, _, _ ->
|
||||
scrollDownButton.highlighted = false
|
||||
scrollDownListener(this, scrollDownButton)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var listButtonListener: (UIItemListNavBarVertical, UIItemImageButton) -> Unit = { _,_ -> }
|
||||
var gridButtonListener: (UIItemListNavBarVertical, UIItemImageButton) -> Unit = { _,_ -> }
|
||||
var scrollUpListener: (UIItemListNavBarVertical, UIItemImageButton) -> Unit = { _,_ -> }
|
||||
var scrollDownListener: (UIItemListNavBarVertical, UIItemImageButton) -> Unit = { _,_ -> }
|
||||
var itemPageCount = 0
|
||||
var itemPage = 0
|
||||
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
val posXDelta = posX - oldPosX
|
||||
|
||||
gridModeButtons.forEach { it.posX += posXDelta }
|
||||
scrollUpButton.posX += posXDelta
|
||||
scrollDownButton.posX += posXDelta
|
||||
|
||||
fun getScrollDotYHeight(i: Int) = scrollUpButton.posY + 14 + upDownButtonGapToDots + 10 * i
|
||||
|
||||
scrollDownButton.posY = getScrollDotYHeight(itemPageCount) + upDownButtonGapToDots
|
||||
|
||||
|
||||
|
||||
// draw the tray
|
||||
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||
Toolkit.fillArea(batch, iconPosX - 4, getIconPosY(0) - 8, width, height)
|
||||
// cell border
|
||||
batch.color = colourTheme.cellHighlightNormalCol
|
||||
Toolkit.drawBoxBorder(batch, iconPosX - 4, getIconPosY(0) - 8, width, height)
|
||||
|
||||
gridModeButtons.forEach { it.render(batch, camera) }
|
||||
scrollUpButton.render(batch, camera)
|
||||
scrollDownButton.render(batch, camera)
|
||||
|
||||
// draw scroll dots
|
||||
for (i in 0 until itemPageCount) {
|
||||
val colour = if (i == itemPage) Color.WHITE else Color(0xffffff7f.toInt())
|
||||
|
||||
batch.color = colour
|
||||
batch.draw(
|
||||
catIcons.get(if (i == itemPage) 20 else 21, 0),
|
||||
iconPosX.toFloat(),
|
||||
getScrollDotYHeight(i) - 2f
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
extraDrawOpOnBottom(this, batch)
|
||||
|
||||
super.render(batch, camera)
|
||||
}
|
||||
|
||||
override fun update(delta: Float) {
|
||||
|
||||
gridModeButtons.forEach { it.update(delta) }
|
||||
scrollUpButton.update(delta)
|
||||
scrollDownButton.update(delta)
|
||||
|
||||
super.update(delta)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
gridModeButtons.forEach { if (it.mouseUp) it.touchDown(screenX, screenY, pointer, button) }
|
||||
if (scrollUpButton.mouseUp) scrollUpButton.touchDown(screenX, screenY, pointer, button)
|
||||
if (scrollDownButton.mouseUp) scrollDownButton.touchDown(screenX, screenY, pointer, button)
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -79,8 +79,8 @@ internal class UIStorageChest : UICanvas(
|
||||
}
|
||||
)
|
||||
// make grid mode buttons work together
|
||||
itemListChest.gridModeButtons[0].touchDownListener = { _,_,_,_ -> setCompact(false) }
|
||||
itemListChest.gridModeButtons[1].touchDownListener = { _,_,_,_ -> setCompact(true) }
|
||||
itemListChest.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
||||
itemListChest.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
||||
|
||||
itemListPlayer = UIItemInventoryItemGrid(
|
||||
this,
|
||||
@@ -99,8 +99,8 @@ internal class UIStorageChest : UICanvas(
|
||||
itemListUpdate()
|
||||
}
|
||||
)
|
||||
itemListPlayer.gridModeButtons[0].touchDownListener = { _,_,_,_ -> setCompact(false) }
|
||||
itemListPlayer.gridModeButtons[1].touchDownListener = { _,_,_,_ -> setCompact(true) }
|
||||
itemListPlayer.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
|
||||
itemListPlayer.navRemoCon.gridButtonListener = { _,_ -> setCompact(true) }
|
||||
|
||||
handler.allowESCtoClose = true
|
||||
|
||||
@@ -132,14 +132,14 @@ internal class UIStorageChest : UICanvas(
|
||||
|
||||
private fun setCompact(yes: Boolean) {
|
||||
itemListChest.isCompactMode = yes
|
||||
itemListChest.gridModeButtons[0].highlighted = !yes
|
||||
itemListChest.gridModeButtons[1].highlighted = yes
|
||||
itemListChest.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||
itemListChest.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||
itemListChest.itemPage = 0
|
||||
itemListChest.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
||||
|
||||
itemListPlayer.isCompactMode = yes
|
||||
itemListPlayer.gridModeButtons[0].highlighted = !yes
|
||||
itemListPlayer.gridModeButtons[1].highlighted = yes
|
||||
itemListPlayer.navRemoCon.gridModeButtons[0].highlighted = !yes
|
||||
itemListPlayer.navRemoCon.gridModeButtons[1].highlighted = yes
|
||||
itemListPlayer.itemPage = 0
|
||||
itemListPlayer.rebuild(catBar.catIconsMeaning[catBar.selectedIcon])
|
||||
|
||||
|
||||
@@ -59,12 +59,9 @@ class UIWorldPortal : UICanvas(
|
||||
private val SP = "\u3000 "
|
||||
val portalListingControlHelp: String
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${getKeycapPC(App.getConfigInt("control_key_up"))}${getKeycapPC(App.getConfigInt("control_key_down"))}" +
|
||||
" ${Lang["MENU_CONTROLS_SCROLL"]}" +
|
||||
"$SP${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}"
|
||||
else
|
||||
"${getKeycapConsole('R')} ${Lang["MENU_CONTROLS_SCROLL"]}" +
|
||||
"$SP${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]}" +
|
||||
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]}" +
|
||||
"$SP${App.gamepadLabelLT} ${Lang["GAME_WORLD_SEARCH"]}" +
|
||||
"$SP${App.gamepadLabelRT} ${Lang["GAME_INVENTORY"]}"
|
||||
|
||||
|
||||
@@ -54,10 +54,11 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
|
||||
private val memoryGaugeWidth = textAreaW
|
||||
private val deleteButtonWidth = (thumbw - gridGap) / 2
|
||||
private val buttonsY = y + listHeight + gridGap
|
||||
private val buttonDeleteWorld = UIItemTextButton(this,
|
||||
"MENU_LABEL_DELETE",
|
||||
hx - gridGap/2 - deleteButtonWidth,
|
||||
y + listHeight - buttonHeight,
|
||||
buttonsY,
|
||||
deleteButtonWidth,
|
||||
readFromLang = true,
|
||||
hasBorder = true,
|
||||
@@ -66,12 +67,36 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
private val buttonRenameWorld = UIItemTextButton(this,
|
||||
"MENU_LABEL_RENAME",
|
||||
buttonDeleteWorld.posX - gridGap - deleteButtonWidth,
|
||||
y + listHeight - buttonHeight,
|
||||
buttonsY,
|
||||
deleteButtonWidth,
|
||||
readFromLang = true,
|
||||
hasBorder = true,
|
||||
alignment = UIItemTextButton.Companion.Alignment.CENTRE
|
||||
)
|
||||
private val buttonTeleport = UIItemTextButton(this,
|
||||
"CONTEXT_GAME_TELEPORT",
|
||||
hx + gridGap/2,
|
||||
buttonsY,
|
||||
deleteButtonWidth,
|
||||
readFromLang = true,
|
||||
hasBorder = true,
|
||||
alignment = UIItemTextButton.Companion.Alignment.CENTRE
|
||||
)
|
||||
private val buttonCancel = UIItemTextButton(this,
|
||||
"MENU_LABEL_CANCEL",
|
||||
hx + gridGap/2 + deleteButtonWidth + gridGap,
|
||||
buttonsY,
|
||||
deleteButtonWidth,
|
||||
readFromLang = true,
|
||||
hasBorder = true,
|
||||
alignment = UIItemTextButton.Companion.Alignment.CENTRE
|
||||
).also {
|
||||
it.clickOnceListener = { _, _, _ ->
|
||||
selected = null
|
||||
selectedIndex = null
|
||||
updateUIbyButtonSelection()
|
||||
}
|
||||
}
|
||||
|
||||
private val worldList = ArrayList<WorldInfo>()
|
||||
data class WorldInfo(
|
||||
@@ -97,6 +122,8 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
|
||||
addUIitem(buttonRenameWorld)
|
||||
addUIitem(buttonDeleteWorld)
|
||||
addUIitem(buttonTeleport)
|
||||
addUIitem(buttonCancel)
|
||||
|
||||
}
|
||||
|
||||
@@ -231,7 +258,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
val memoryGaugeXpos = hx - memoryGaugeWidth - gridGap/2
|
||||
val memoryGaugeYpos = y + listHeight - buttonHeight - gridGap - buttonHeight
|
||||
val memoryGaugeYpos = y + listHeight - buttonHeight
|
||||
val textXpos = memoryGaugeXpos + 3
|
||||
|
||||
// draw background //
|
||||
@@ -295,7 +322,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
|
||||
// control hints
|
||||
batch.color = Color.WHITE
|
||||
App.fontGame.draw(batch, full.portalListingControlHelp, hx - thumbw - gridGap/2 + 2, (full.yEnd - 20).toInt())
|
||||
App.fontGame.draw(batch, full.portalListingControlHelp, hx - thumbw - gridGap/2 + 2, (full.yEnd + 8).toInt())
|
||||
}
|
||||
|
||||
override fun hide() {
|
||||
|
||||
Reference in New Issue
Block a user