fixing bug where the crafting table (or something) would placed and ui opened at the same time

This commit is contained in:
minjaesong
2021-02-25 14:31:36 +09:00
parent 2a72cc03bb
commit e4c7ed581c
2 changed files with 10 additions and 1 deletions

View File

@@ -46,6 +46,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
} }
} }
private var worldPrimaryClickLatched = false
fun update(delta: Float) { fun update(delta: Float) {
/////////////////// ///////////////////
@@ -61,13 +63,18 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
// also, some UIs should NOT affect item usage (e.g. quickslot) and ingame's uiOpened property is doing // also, some UIs should NOT affect item usage (e.g. quickslot) and ingame's uiOpened property is doing
// the very job. // the very job.
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) { if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !worldPrimaryClickLatched) {
terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE) terrarumIngame.worldPrimaryClickStart(AppLoader.UPDATE_RATE)
worldPrimaryClickLatched = true
} }
/*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary")) { /*if Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary")) {
ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE) ingame.worldSecondaryClickStart(AppLoader.UPDATE_RATE)
}*/ }*/
if (!Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
worldPrimaryClickLatched = false
}
} }

View File

@@ -399,6 +399,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}// END enter }// END enter
override fun worldPrimaryClickStart(delta: Float) { override fun worldPrimaryClickStart(delta: Float) {
//println("[Ingame] worldPrimaryClickStart $delta")
// bring up the UIs of the fixtures (e.g. crafting menu from a crafting table) // bring up the UIs of the fixtures (e.g. crafting menu from a crafting table)
var uiOpened = false var uiOpened = false