DEADSOFTWARE

Add furnace, more craft and items
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / input / handler / keyboard / OpenInventoryKeyboardInputHandler.kt
1 package ru.deadsoftware.cavedroid.game.input.handler.keyboard
3 import ru.deadsoftware.cavedroid.game.GameScope
4 import ru.deadsoftware.cavedroid.game.GameUiWindow
5 import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
6 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
7 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
8 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
9 import javax.inject.Inject
11 @GameScope
12 class OpenInventoryKeyboardInputHandler @Inject constructor(
13 private val gameWindowsManager: GameWindowsManager,
14 ) : IGameInputHandler<KeyboardInputAction> {
16 override fun checkConditions(action: KeyboardInputAction): Boolean {
17 return action.actionKey is KeyboardInputActionKey.OpenInventory &&
18 !action.isKeyDown && gameWindowsManager.getCurrentWindow() == GameUiWindow.NONE
19 }
21 override fun handle(action: KeyboardInputAction) {
22 gameWindowsManager.openInventory()
23 }
24 }