fixed uiItem stupidity with uiCanvas; it activated even if its parent is invisible

This commit is contained in:
minjaesong
2017-10-24 07:25:05 +09:00
parent d1f3a491f1
commit 977df44316
7 changed files with 110 additions and 36 deletions

View File

@@ -111,39 +111,60 @@ abstract class UICanvas(
}
open fun mouseMoved(screenX: Int, screenY: Int): Boolean {
uiItems.forEach { it.mouseMoved(screenX, screenY) }
handler.subUIs.forEach { it.mouseMoved(screenX, screenY) }
return true
if (this.isVisible) {
uiItems.forEach { it.mouseMoved(screenX, screenY) }
handler.subUIs.forEach { it.mouseMoved(screenX, screenY) }
return true
}
else return false
}
open fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
uiItems.forEach { it.touchDragged(screenX, screenY, pointer) }
handler.subUIs.forEach { it.touchDragged(screenX, screenY, pointer) }
return true
if (this.isVisible) {
uiItems.forEach { it.touchDragged(screenX, screenY, pointer) }
handler.subUIs.forEach { it.touchDragged(screenX, screenY, pointer) }
return true
}
else return false
}
open fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
uiItems.forEach { it.touchDown(screenX, screenY, pointer, button) }
handler.subUIs.forEach { it.touchDown(screenX, screenY, pointer, button) }
return true
if (this.isVisible) {
uiItems.forEach { it.touchDown(screenX, screenY, pointer, button) }
handler.subUIs.forEach { it.touchDown(screenX, screenY, pointer, button) }
return true
}
else return false
}
open fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) }
handler.subUIs.forEach { it.touchUp(screenX, screenY, pointer, button) }
return true
if (this.isVisible) {
uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) }
handler.subUIs.forEach { it.touchUp(screenX, screenY, pointer, button) }
return true
}
else return false
}
open fun scrolled(amount: Int): Boolean {
uiItems.forEach { it.scrolled(amount) }
handler.subUIs.forEach { it.scrolled(amount) }
return true
if (this.isVisible) {
uiItems.forEach { it.scrolled(amount) }
handler.subUIs.forEach { it.scrolled(amount) }
return true
}
else return false
}
open fun keyDown(keycode: Int): Boolean {
uiItems.forEach { it.keyDown(keycode) }
handler.subUIs.forEach { it.keyDown(keycode) }
return true
if (this.isVisible) {
uiItems.forEach { it.keyDown(keycode) }
handler.subUIs.forEach { it.keyDown(keycode) }
return true
}
else return false
}
open fun keyUp(keycode: Int): Boolean {
uiItems.forEach { it.keyUp(keycode) }
handler.subUIs.forEach { it.keyUp(keycode) }
return true
if (this.isVisible) {
uiItems.forEach { it.keyUp(keycode) }
handler.subUIs.forEach { it.keyUp(keycode) }
return true
}
else return false
}
open fun keyTyped(character: Char): Boolean {
return false