mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
fix: inventory cells not tangible
This commit is contained in:
@@ -46,6 +46,11 @@ internal class UIInventoryCells(
|
|||||||
107 + (AppLoader.screenH - full.internalHeight) / 2
|
107 + (AppLoader.screenH - full.internalHeight) / 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
uiItems.add(itemList)
|
||||||
|
uiItems.add(equipped)
|
||||||
|
}
|
||||||
|
|
||||||
fun rebuildList() {
|
fun rebuildList() {
|
||||||
AppLoader.printdbg(this, "rebuilding list")
|
AppLoader.printdbg(this, "rebuilding list")
|
||||||
|
|
||||||
|
|||||||
@@ -564,40 +564,5 @@ class UIInventoryFull(
|
|||||||
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||||
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun keyDown(keycode: Int): Boolean {
|
|
||||||
return super.keyDown(keycode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun keyTyped(character: Char): Boolean {
|
|
||||||
return super.keyTyped(character)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
|
||||||
return super.touchDown(screenX, screenY, pointer, button)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun keyUp(keycode: Int): Boolean {
|
|
||||||
return super.keyUp(keycode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
|
||||||
return super.mouseMoved(screenX, screenY)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
|
||||||
return super.touchDragged(screenX, screenY, pointer)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
|
||||||
return super.touchUp(screenX, screenY, pointer, button)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun scrolled(amount: Int): Boolean {
|
|
||||||
return super.scrolled(amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ open class UIItemTransitionContainer(
|
|||||||
|
|
||||||
private val epsilon = 0.001f
|
private val epsilon = 0.001f
|
||||||
|
|
||||||
|
private fun timeToUpdate(index: Int) = true//(currentPosition > index - 1 + epsilon && currentPosition < index + 1 - epsilon)
|
||||||
|
|
||||||
fun requestTransition(target: Int) {
|
fun requestTransition(target: Int) {
|
||||||
if (!transitionOngoing) {
|
if (!transitionOngoing) {
|
||||||
transitionRequested = true
|
transitionRequested = true
|
||||||
@@ -37,12 +39,7 @@ open class UIItemTransitionContainer(
|
|||||||
|
|
||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
super.update(delta)
|
super.update(delta)
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.update(delta) }
|
||||||
uis.forEachIndexed { index, ui ->
|
|
||||||
if (currentPosition > index - 1 + epsilon && currentPosition < index + 1 - epsilon) {
|
|
||||||
ui.update(delta)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onTransition(currentPosition: Float, uis: Array<out UICanvas>) {}
|
open fun onTransition(currentPosition: Float, uis: Array<out UICanvas>) {}
|
||||||
@@ -89,6 +86,41 @@ open class UIItemTransitionContainer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun keyDown(keycode: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.keyDown(keycode) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun keyUp(keycode: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.keyUp(keycode) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.mouseMoved(screenX, screenY) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.touchDragged(screenX, screenY, pointer) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.touchDown(screenX, screenY, pointer, button) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.touchUp(screenX, screenY, pointer, button) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun scrolled(amount: Int): Boolean {
|
||||||
|
uis.forEachIndexed { index, ui -> if (timeToUpdate(index)) ui.scrolled(amount) }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
uis.forEach { it.dispose() }
|
uis.forEach { it.dispose() }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user