mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 12:34:05 +09:00
uis won't open or close when console is up
This commit is contained in:
@@ -14,6 +14,8 @@ import net.torvald.util.HistoryArray
|
||||
|
||||
|
||||
/**
|
||||
* Don't let the debug console have the ```toggleKeyLiteral```, this must open even when the game is paused
|
||||
*
|
||||
* Created by minjaesong on 2015-12-31.
|
||||
*/
|
||||
class ConsoleWindow : UICanvas() {
|
||||
@@ -203,11 +205,13 @@ class ConsoleWindow : UICanvas() {
|
||||
}
|
||||
|
||||
override fun endOpening(delta: Float) {
|
||||
Terrarum.ingame?.paused = true
|
||||
drawOffY = 0f
|
||||
openingTimeCounter = 0f
|
||||
}
|
||||
|
||||
override fun endClosing(delta: Float) {
|
||||
Terrarum.ingame?.paused = false
|
||||
drawOffY = -height.toFloat()
|
||||
openingTimeCounter = 0f
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
|
||||
@@ -105,23 +106,25 @@ class UIHandler(//var UI: UICanvas,
|
||||
|
||||
fun update(ui: UICanvas, delta: Float) {
|
||||
// open/close UI by key pressed
|
||||
if (toggleKey != null && Gdx.input.isKeyJustPressed(toggleKey!!)) {
|
||||
if (isClosed)
|
||||
setAsOpen()
|
||||
else if (isOpened)
|
||||
// some UIs will pause the game, and they still need to be closed
|
||||
if (Terrarum.ingame?.consoleOpened == false && (Terrarum.ingame?.paused == false || isOpened)) {
|
||||
if (toggleKey != null && Gdx.input.isKeyJustPressed(toggleKey!!)) {
|
||||
if (isClosed)
|
||||
setAsOpen()
|
||||
else if (isOpened)
|
||||
setAsClose()
|
||||
|
||||
// for the case of intermediate states, do nothing.
|
||||
}
|
||||
if (toggleButton != null) {
|
||||
/* */
|
||||
}
|
||||
|
||||
// ESC is a master key for closing
|
||||
if (allowESCtoClose && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE) && isOpened) {
|
||||
setAsClose()
|
||||
|
||||
// for the case of intermediate states, do nothing.
|
||||
}
|
||||
}
|
||||
if (toggleButton != null) {
|
||||
/* */
|
||||
}
|
||||
|
||||
// ESC is a master key for closing
|
||||
if (allowESCtoClose && Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE) && isOpened) {
|
||||
setAsClose()
|
||||
}
|
||||
|
||||
|
||||
//if (openFired && openCloseCounter > 9) openFired = false
|
||||
//if (closeFired && openCloseCounter > 9) closeFired = false
|
||||
|
||||
Reference in New Issue
Block a user