mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
fix: title screen UIs can be closed using ESC
This commit is contained in:
@@ -7,7 +7,9 @@ import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
@@ -15,7 +15,9 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2021-09-09.
|
||||
*/
|
||||
class UIFakeGradOverlay : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
override var width: Int
|
||||
get() = App.scr.width
|
||||
set(value) {}
|
||||
@@ -67,7 +69,9 @@ class UIFakeGradOverlay : UICanvas() {
|
||||
}
|
||||
|
||||
class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
override var width: Int
|
||||
get() = App.scr.width
|
||||
set(value) {}
|
||||
|
||||
@@ -9,6 +9,10 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2017-03-13.
|
||||
*/
|
||||
object NullUI : UICanvas() {
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width: Int = 0
|
||||
override var height: Int = 0
|
||||
override var openCloseTime = 0f
|
||||
|
||||
@@ -23,6 +23,8 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
override var width = 560
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
ControlPanelCommon.register(this, width, "basegame.graphicscontrolpanel", arrayOf(
|
||||
arrayOf("", { Lang["CREDITS_VFX"] }, "h1"),
|
||||
arrayOf("fx_dither", { Lang["MENU_OPTIONS_DITHER"] }, "toggle"),
|
||||
|
||||
@@ -20,6 +20,10 @@ import net.torvald.terrarum.ui.*
|
||||
*/
|
||||
class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width = 480
|
||||
override var height = 600
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ import java.io.File
|
||||
* Created by minjaesong on 2023-08-24.
|
||||
*/
|
||||
class UIImportAvatar(val remoCon: UIRemoCon) : Advanceable() {
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width = 480 // SAVE_CELL_WIDTH
|
||||
override var height = 480
|
||||
|
||||
@@ -330,7 +330,6 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
override fun doClosing(delta: Float) {
|
||||
super.doClosing(delta)
|
||||
screen = 0
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
|
||||
@@ -16,6 +16,9 @@ import net.torvald.terrarum.ui.*
|
||||
*/
|
||||
class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width = 480
|
||||
override var height = 600
|
||||
|
||||
@@ -20,6 +20,10 @@ import kotlin.math.roundToInt
|
||||
*/
|
||||
class UILoadList(val full: UILoadSavegame) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width: Int = Toolkit.drawWidth
|
||||
override var height: Int = App.scr.height
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ import java.util.*
|
||||
*/
|
||||
class UILoadManage(val full: UILoadSavegame) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width: Int = Toolkit.drawWidth
|
||||
override var height: Int = App.scr.height
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2023-07-05.
|
||||
*/
|
||||
class UILoadNewCharacter(val full: UILoadSavegame) : UICanvas() {
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width: Int = Toolkit.drawWidth
|
||||
override var height: Int = App.scr.height
|
||||
|
||||
@@ -25,6 +25,8 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
||||
// private val hash = RandomWordsName(3)
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
CommonResourcePool.addToLoadingList("terrarum-defaultsavegamethumb") {
|
||||
TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/savegame_thumb_placeholder.png")))
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@ import java.io.File
|
||||
*/
|
||||
class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width = 480
|
||||
override var height = 480
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ import kotlin.math.roundToInt
|
||||
* Created by minjaesong on 2021-10-25.
|
||||
*/
|
||||
class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
private var newPlayerCreationThread = Thread {}
|
||||
private var existingPlayer: DiskSkimmer? = null
|
||||
|
||||
@@ -23,6 +23,8 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
override var width = 560
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
ControlPanelCommon.register(this, width, "basegame.performancecontrolpanel", arrayOf(
|
||||
arrayOf("", { Lang["MENU_OPTIONS_GAMEPLAY"] }, "h1"),
|
||||
arrayOf("autosaveinterval", { Lang["MENU_OPTIONS_AUTOSAVE"] + " (${Lang["CONTEXT_TIME_MINUTE_PLURAL"]})" }, "spinnerimul,5,120,5,60000"),
|
||||
|
||||
@@ -24,7 +24,9 @@ import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_LINE_HEIGH
|
||||
* Created by minjaesong on 2018-08-29.
|
||||
*/
|
||||
open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
override var openCloseTime = 0f
|
||||
|
||||
private var remoConTray: UIRemoConElement // this remocon is dynamically generated
|
||||
@@ -196,6 +198,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
||||
ui.setPosition(0,0)
|
||||
parent.uiFakeBlurOverlay.setAsOpen()
|
||||
ui.setAsOpen()
|
||||
ui.handler.allowESCtoClose = false
|
||||
openUI = ui
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
override var width = 560
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
ControlPanelCommon.register(this, width, "basegame.soundcontrolpanel", arrayOf(
|
||||
arrayOf("mastervolume", { Lang["MENU_OPTIONS_SOUND_VOLUME"] }, "sliderd,0,1"),
|
||||
arrayOf("", { "" }, "p"),
|
||||
|
||||
@@ -16,6 +16,10 @@ import kotlin.math.max
|
||||
|
||||
class UITitleLanguage(remoCon: UIRemoCon?) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
val menuLabels = arrayOf(
|
||||
"MENU_LABEL_RETURN"
|
||||
)
|
||||
|
||||
@@ -22,6 +22,9 @@ val MODULEINFO_CELL_HEIGHT = 24*3
|
||||
* Created by minjaesong on 2017-08-01.
|
||||
*/
|
||||
class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
override var width: Int
|
||||
get() = Toolkit.drawWidth
|
||||
|
||||
@@ -11,7 +11,9 @@ import net.torvald.terrarum.ui.*
|
||||
import java.util.TreeMap
|
||||
|
||||
open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
override var width = 600
|
||||
|
||||
@@ -14,6 +14,10 @@ import kotlin.math.roundToInt
|
||||
*/
|
||||
class UIAutosaveNotifier : UICanvas() {
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val WIDTH = 180
|
||||
const val HEIGHT = 24
|
||||
|
||||
@@ -67,6 +67,7 @@ class UINSMenu(
|
||||
var invocationArgument: Array<Any> = arrayOf(this)
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = false
|
||||
addSubMenu(tree)
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) {
|
||||
// appear (e.g. getting garbage values when it fucking shouldn't)
|
||||
|
||||
// using ifs instead of assertions: inactive assert statements still slows down the app
|
||||
// if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
|
||||
// if (index !in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
|
||||
if (destroyed) { throw DanglingPointerException("The pointer is already destroyed ($this)") }
|
||||
if (index !in 0 until size) { throw AddressOverflowException("Index: $index; alloc size: $size") }
|
||||
}
|
||||
|
||||
operator fun get(index: Long): Byte {
|
||||
|
||||
Reference in New Issue
Block a user