able to "lock" the toggle key of the UI to prevent them from being closed while saving

This commit is contained in:
minjaesong
2021-09-14 23:24:21 +09:00
parent 1b71aa1760
commit 16a0b28696
4 changed files with 46 additions and 23 deletions

View File

@@ -117,6 +117,8 @@ void main() {
private val shader = App.loadShaderInline(SHADER_PROG_VERT, SHADER_PROG_FRAG)
private var uiToggleLocked = false
init {
//UI.handler = this
}
@@ -150,11 +152,18 @@ void main() {
subUIs.remove(ui)
}
fun lockToggle() {
uiToggleLocked = true
}
fun unlockToggle() {
uiToggleLocked = false
}
fun update(ui: UICanvas, delta: Float) {
// open/close UI by key pressed
// some UIs will pause the game, and they still need to be closed
if (Terrarum.ingame?.consoleOpened == false && (Terrarum.ingame?.paused == false || isOpened)) {
if (!uiToggleLocked && (Terrarum.ingame?.consoleOpened == false && (Terrarum.ingame?.paused == false || isOpened))) {
if (toggleKey != null && Gdx.input.isKeyJustPressed(toggleKey!!)) {
if (isClosed)
setAsOpen()