mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
worldportal: showing tooltip to tell why the button is disabled
This commit is contained in:
@@ -493,7 +493,7 @@ class UIItemPlayerCells(
|
||||
override val width = SAVE_CELL_WIDTH
|
||||
override val height = SAVE_CELL_HEIGHT
|
||||
|
||||
override var clickOnceListener: ((Int, Int) -> Unit)? = { _: Int, _: Int ->
|
||||
override var clickOnceListener: ((Int, Int) -> Unit) = { _: Int, _: Int ->
|
||||
UILoadGovernor.playerDisk = skimmer
|
||||
UILoadGovernor.playerUUID = playerUUID
|
||||
UILoadGovernor.worldUUID = worldUUID
|
||||
@@ -756,7 +756,7 @@ class UIItemWorldCells(
|
||||
|
||||
private var highlightCol: Color = Toolkit.Theme.COL_LIST_DEFAULT
|
||||
|
||||
override var clickOnceListener: ((Int, Int) -> Unit)? = { _: Int, _: Int ->
|
||||
override var clickOnceListener: ((Int, Int) -> Unit) = { _: Int, _: Int ->
|
||||
UILoadGovernor.worldDisk = skimmer
|
||||
parent.advanceMode(this)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
@@ -94,6 +95,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
selected?.worldInfo?.diskSkimmer, null
|
||||
)
|
||||
full.setAsClose()
|
||||
printdbg(this, "Teleport target set: ${full.host.teleportRequest}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +139,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
buttonRename.isActive = false
|
||||
buttonDelete.isActive = false
|
||||
buttonTeleport.isActive = false
|
||||
currentWorldSelected = false
|
||||
}
|
||||
|
||||
private fun highlightListEditButtons(info: WorldInfo?) {
|
||||
@@ -147,9 +150,12 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
buttonRename.isActive = true
|
||||
buttonDelete.isActive = info.uuid != INGAME.world.worldIndex
|
||||
buttonTeleport.isActive = info.uuid != INGAME.world.worldIndex
|
||||
currentWorldSelected = info.uuid == INGAME.world.worldIndex
|
||||
}
|
||||
}
|
||||
|
||||
private var currentWorldSelected = false
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("terrarum-basegame-worldportalicons") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "gui/worldportal_catbar.tga"), 30, 20)
|
||||
@@ -296,6 +302,10 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
||||
override fun updateUI(delta: Float) {
|
||||
uiItems.forEach { it.update(delta) }
|
||||
if (::worldCells.isInitialized) worldCells.forEach { it.update(delta) }
|
||||
|
||||
if (currentWorldSelected) {
|
||||
INGAME.setTooltipMessage(if (buttonTeleport.mouseUp || buttonDelete.mouseUp) Lang["CONTEXT_THIS_IS_A_WORLD_CURRENTLY_PLAYING"] else null)
|
||||
}
|
||||
}
|
||||
|
||||
private val iconGap = 12f
|
||||
|
||||
Reference in New Issue
Block a user