diff --git a/src/net/torvald/terrarum/UIItemInventoryElem.kt b/src/net/torvald/terrarum/UIItemInventoryElem.kt index 4a3eb7835..e2482973d 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElem.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElem.kt @@ -10,7 +10,7 @@ import net.torvald.terrarum.itemproperties.GameItem import net.torvald.terrarum.modulebasegame.Ingame import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase -import net.torvald.terrarum.ui.* +import net.torvald.terrarum.ui.UIItemTextButton /*** * Note that the UI will not render if either item or itemImage is null. @@ -136,7 +136,7 @@ class UIItemInventoryElem( } override fun keyDown(keycode: Int): Boolean { - if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) { + if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_0..Input.Keys.NUM_9) { val player = (Terrarum.ingame!! as Ingame).actorNowPlaying if (player == null) return false @@ -163,7 +163,7 @@ class UIItemInventoryElem( } } - return true + return super.keyDown(keycode) } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { @@ -189,7 +189,7 @@ class UIItemInventoryElem( inventoryUI.rebuildList() - return true + return super.touchDown(screenX, screenY, pointer, button) } diff --git a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt index 42858727b..89ddae38e 100644 --- a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt +++ b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt @@ -9,7 +9,7 @@ import net.torvald.terrarum.itemproperties.GameItem import net.torvald.terrarum.modulebasegame.Ingame import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryCellBase -import net.torvald.terrarum.ui.* +import net.torvald.terrarum.ui.UIItemTextButton /** * Created by minjaesong on 2017-10-20. @@ -121,8 +121,7 @@ class UIItemInventoryElemSimple( } override fun keyDown(keycode: Int): Boolean { - if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) { - println("keydown elemgrid") + if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_0..Input.Keys.NUM_9) { val player = (Terrarum.ingame!! as Ingame).actorNowPlaying if (player == null) return false @@ -149,7 +148,7 @@ class UIItemInventoryElemSimple( } } - return true + return super.keyDown(keycode) } override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { @@ -172,7 +171,7 @@ class UIItemInventoryElemSimple( inventoryUI.rebuildList() - return true + return super.touchDown(screenX, screenY, pointer, button) } diff --git a/src/net/torvald/terrarum/gamecontroller/IngameController.kt b/src/net/torvald/terrarum/gamecontroller/IngameController.kt index fbaf2c9c3..7ab965303 100644 --- a/src/net/torvald/terrarum/gamecontroller/IngameController.kt +++ b/src/net/torvald/terrarum/gamecontroller/IngameController.kt @@ -72,7 +72,7 @@ class IngameController(val ingame: Ingame) : InputAdapter() { if (ingame.canPlayerControl) { ingame.actorNowPlaying?.keyDown(keycode) - // quickslot (quickbar) + // quickslot by number keys val quickslotKeys = AppLoader.getConfigIntArray("keyquickslots") if (keycode in quickslotKeys) { ingame.actorNowPlaying?.actorValue?.set(AVKey.__PLAYER_QUICKSLOTSEL, quickslotKeys.indexOf(keycode)) @@ -145,6 +145,16 @@ class IngameController(val ingame: Ingame) : InputAdapter() { } override fun scrolled(amount: Int): Boolean { + if (ingame.canPlayerControl) { + // quickslot by wheel + if (ingame.actorNowPlaying != null) { + ingame.actorNowPlaying!!.actorValue.set( + AVKey.__PLAYER_QUICKSLOTSEL, + (ingame.actorNowPlaying!!.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)!! - amount) % ingame.actorNowPlaying!!.inventory.quickSlot.size + ) + } + } + ingame.uiContainer.forEach { it.scrolled(amount) } return true }