summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca67da5)
raw | patch | inline | side by side (parent: ca67da5)
author | fredboy <fredboy@protonmail.com> | |
Tue, 14 May 2024 16:35:57 +0000 (23:35 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Tue, 14 May 2024 16:35:57 +0000 (23:35 +0700) |
37 files changed:
diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index 2ae4756f54ab06b08b1c309ca3330348f4726d3c..0dcbefcc575e7d3c2c0a1ded8b533bc5278dd3a6 100644 (file)
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.TimeUtils;
import ru.deadsoftware.cavedroid.MainConfig;
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler;
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler;
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler;
import ru.deadsoftware.cavedroid.game.input.Joystick;
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction;
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction;
private final CursorMouseInputHandler mCursorMouseInputHandler;
private final MouseInputActionMapper mMouseInputActionMapper;
private final KeyboardInputActionMapper mKeyboardInputActionMapper;
- private final Set<IGameInputHandler<MouseInputAction>> mMouseInputHandlers;
- private final Set<IGameInputHandler<KeyboardInputAction>> mKeyboardInputHandlers;
+ private final Set<IMouseInputHandler> mMouseInputHandlers;
+ private final Set<IKeyboardInputHandler> mKeyboardInputHandlers;
private final GameWindowsManager mGameWindowsManager;
private final TooltipManager mTooltipManager;
CursorMouseInputHandler cursorMouseInputHandler,
MouseInputActionMapper mouseInputActionMapper,
KeyboardInputActionMapper keyboardInputActionMapper,
- Set<IGameInputHandler<MouseInputAction>> mouseInputHandlers,
- Set<IGameInputHandler<KeyboardInputAction>> keyboardInputHandlers,
+ Set<IMouseInputHandler> mouseInputHandlers,
+ Set<IKeyboardInputHandler> keyboardInputHandlers,
GameWindowsManager gameWindowsManager,
TooltipManager tooltipManager) {
super(mainConfig.getWidth(), mainConfig.getHeight());
boolean anyProcessed = false;
- for (IGameInputHandler<MouseInputAction> handler : mMouseInputHandlers) {
+ for (IMouseInputHandler handler : mMouseInputHandlers) {
final boolean conditions = handler.checkConditions(action);
if (conditions) {
anyProcessed = true;
boolean anyProcessed = false;
- for (IGameInputHandler<KeyboardInputAction> handler : mKeyboardInputHandlers) {
+ for (IKeyboardInputHandler handler : mKeyboardInputHandlers) {
final boolean conditions = handler.checkConditions(action);
if (conditions) {
anyProcessed = true;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/GameInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/GameInputHandler.kt
--- /dev/null
@@ -0,0 +1,40 @@
+package ru.deadsoftware.cavedroid.game.input
+
+import ru.deadsoftware.cavedroid.game.input.action.IGameInputAction
+import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
+import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
+import ru.fredboy.cavedroid.ksp.annotations.GenerateSetMultibindingsModule
+
+@GenerateSetMultibindingsModule(
+ interfaceClass = IKeyboardInputHandler::class,
+ modulePackage = "ru.deadsoftware.cavedroid.game.input",
+ moduleName = "KeyboardInputHandlersModule"
+)
+annotation class KeyboardInputHandler
+
+@GenerateSetMultibindingsModule(
+ interfaceClass = IMouseInputHandler::class,
+ modulePackage = "ru.deadsoftware.cavedroid.game.input",
+ moduleName = "MouseInputHandlersModule"
+)
+annotation class MouseInputHandler
+
+interface IKeyboardInputHandler : IGameInputHandler<KeyboardInputAction>
+
+interface IMouseInputHandler : IGameInputHandler<MouseInputAction>
+
+interface IGameInputHandler<A : IGameInputAction> {
+
+ /**
+ * Implementation should check if conditions for handling an input are satisfied
+ * For example - inventory input handler should return false if inventory is closed
+ */
+ fun checkConditions(action: A): Boolean
+
+ /**
+ * Handle given input action.
+ * This will not be called if [checkConditions] returned false
+ */
+ fun handle(action: A)
+
+}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/IGameInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/IGameInputHandler.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import ru.deadsoftware.cavedroid.game.input.action.IGameInputAction
-
-interface IGameInputHandler<A : IGameInputAction> {
-
- /**
- * Implementation should check if conditions for handling an input are satisfied
- * For example - inventory input handler should return false if inventory is closed
- */
- fun checkConditions(action: A): Boolean
-
- /**
- * Handle given input action.
- * This will not be called if [checkConditions] returned false
- */
- fun handle(action: A)
-
-}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/KeyboardInputHandlersModule.kt b/core/src/ru/deadsoftware/cavedroid/game/input/KeyboardInputHandlersModule.kt
+++ /dev/null
@@ -1,139 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import dagger.Binds
-import dagger.Module
-import dagger.multibindings.IntoSet
-import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
-import ru.deadsoftware.cavedroid.game.input.handler.keyboard.*
-
-@Module
-object KeyboardInputHandlersModule {
-
- @Binds
- @IntoSet
- @GameScope
- fun bindGoLeftKeyboardInputHandler(handler: GoLeftKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindGoRightKeyboardInputHandler(handler: GoRightKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindJumpKeyboardActionHandler(handler: JumpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindFlyUpKeyboardActionHandler(handler: FlyUpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindTurnOnFlyModeKeyboardActionHandler(handler: TurnOnFlyModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindFlyDownKeyboardActionHandler(handler: FlyDownKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindOpenInventoryKeyboardInputHandler(handler: OpenInventoryKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindCloseGameWindowKeyboardInputHandler(handler: CloseGameWindowKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindToggleDebugInfoKeyboardInputHandler(handler: ToggleDebugInfoKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindToggleMinimapKeyboardInputHandler(handler: ToggleMinimapKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindToggleGameModeKeyboardInputHandler(handler: ToggleGameModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindPauseGameKeyboardInputHandler(handler: PauseGameKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindToggleControlsModeKeyboardInputHandler(handler: ToggleControlsModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindMoveCursorControlsModeKeyboardInputHandler(handler: MoveCursorControlsModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindOpenCraftingKeyboardInputHandler(handler: DropItemKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSwimUpKeyboardInputHandler(handler: SwimUpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindStopSwimKeyboardInputHandler(handler: StopSwimKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectHotbarSlotKeyboardInputHandler(handler: SelectHotbarSlotKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
- return handler
- }
-
-}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/MouseInputHandlersModule.kt b/core/src/ru/deadsoftware/cavedroid/game/input/MouseInputHandlersModule.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import dagger.Binds
-import dagger.Module
-import dagger.multibindings.IntoSet
-import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
-import ru.deadsoftware.cavedroid.game.input.handler.touch.JoystickInputHandler
-import ru.deadsoftware.cavedroid.game.input.handler.mouse.*
-
-@Module
-object MouseInputHandlersModule {
-
- @Binds
- @IntoSet
- @GameScope
- fun bindCursorMouseInputHandler(handler: CursorMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindHoldHotbarMouseInputHandler(handler: HotbarMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindCloseGameWindowMouseActionHandler(handler: CloseGameWindowMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindCreativeInventoryScrollMouseInputHandler(handler: CreativeInventoryScrollMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectCreativeInventoryItemMouseActionHandler(handler: SelectCreativeInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindAttackMouseInputHandler(handler: AttackMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindUseItemMouseInputActionHandler(handler: UseItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectSurvivalInventoryItemMouseInputHandler(handler: SelectSurvivalInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectCraftingInventoryItemMouseInputHandler(handler: SelectCraftingInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectFurnaceInventoryItemMouseInputHandler(handler: SelectFurnaceInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindJoystickInputHandler(handler: JoystickInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-
- @Binds
- @IntoSet
- @GameScope
- fun bindSelectChestInventoryItemMouseInputHandler(handler: SelectChestInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
- return handler
- }
-}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/CloseGameWindowKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/CloseGameWindowKeyboardInputHandler.kt
index 89a7b693c02492243440ca4385805bc462e47924..cbc254e9d8ff6e910c142acb9d8555c692d70764 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class CloseGameWindowKeyboardInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
private val dropController: DropController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.OpenInventory &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/DropItemKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/DropItemKeyboardInputHandler.kt
index 04f5520af367a3123bb331181e265dc20aaf0855..01a0c1f162e8e95622a9dedebd6c96b11636954f 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/DropItemKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/DropItemKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class DropItemKeyboardInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
private val dropController: DropController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.DropItem &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyDownKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyDownKeyboardInputHandler.kt
index 0bb0a772e8d0ae54f51f21464a46c02289cfb128..8e41dfec9bd8e30ca1867dba349a6fad0a540f45 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class FlyDownKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Down &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyUpKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyUpKeyboardInputHandler.kt
index bf12c1ad14aed9a0068ef42b9f2ba5e212148bbe..976b069692325453bfea465caee772b84be2cd06 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class FlyUpKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Up &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoLeftKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoLeftKeyboardInputHandler.kt
index 421e47e5a56ce72de6a3fc6ea602c19583edca48..823447617d01721a4cdf7f3c091b953e3cffe5b5 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.Mob
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class GoLeftKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Left &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoRightKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoRightKeyboardInputHandler.kt
index e3f5bf99f054c658aa6e402994794578f9d707e1..3139a179742ecc4924666246bb1be8486395cc87 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.Mob
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class GoRightKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Right &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/JumpKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/JumpKeyboardInputHandler.kt
index 1e68cea9f4ca2639f882544553c359d673039268..30f12dd383de0e4f37f4340d088a6f81771797e5 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class JumpKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Up &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt
index 0cb74d7d0ff20bd0d01ceafa873b46f5bdea863c..98d3e0aa913e7b9acb4c4cd52ce2e81998c4b2fb 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class MoveCursorControlsModeKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return mainConfig.isTouch &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt
index ec8190a40c2a3902888a404463ab5fc0e0eb9d03..a1ca3da81d67099ec85a5aefe3173b5078d3b328 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class OpenInventoryKeyboardInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.OpenInventory &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/PauseGameKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/PauseGameKeyboardInputHandler.kt
index b39ee7403ee30f69ca8676f8c3906b63e4c3a79c..e4d670738853bcf4405e8a2e9949d1f0c9af7a1f 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/PauseGameKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/PauseGameKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.game.GameSaver
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class PauseGameKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val dropController: DropController,
private val gameWorld: GameWorld,
private val containerController: ContainerController,
private val gameWindowsManager: GameWindowsManager,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Pause && action.isKeyDown
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SelectHotbarSlotKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SelectHotbarSlotKeyboardInputHandler.kt
index 45e04da208433324c6463a6f4ccef974510bbe4d..0c7ea74c2474d5a47b7425f34a6201b63a246305 100644 (file)
package ru.deadsoftware.cavedroid.game.input.handler.keyboard
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class SelectHotbarSlotKeyboardInputHandler @Inject constructor(
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.SelectHotbarSlot &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/StopSwimKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/StopSwimKeyboardInputHandler.kt
index e25a99f7216551c151abb9b6a134c0db6d6f4ac3..7256c5402274b911b4cc95b33bc77f35355e4c7d 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/StopSwimKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/StopSwimKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class StopSwimKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.Up && !action.isKeyDown &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SwimUpKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SwimUpKeyboardInputHandler.kt
index 3159e7fb363f321d95469748a69d07851ab048b4..9dc4777e0374dc7d0e28b54647273dd7fd5b587e 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class SwimUpKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
private fun checkSwim(): Boolean {
return gameWorld.getForeMap(mobsController.player.mapX, mobsController.player.lowerMapY).isFluid()
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleControlsModeKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleControlsModeKeyboardInputHandler.kt
index fc95e29b84794fb271aa3520cf09d58f0b6d7b20..a933c80e488537c214522ea0be9d9a2fbf2790ce 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class ToggleControlsModeKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.SwitchControlsMode && !action.isKeyDown
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleDebugInfoKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleDebugInfoKeyboardInputHandler.kt
index 96bc21d9719433bf027bb7ec96b75cb859964d9e..065b28cd63e1e21f122f0f5fcef8db761eb02936 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class ToggleDebugInfoKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.ShowDebug && action.isKeyDown
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleGameModeKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleGameModeKeyboardInputHandler.kt
index ef4e696c2833613708f25c8ee99a2e458ffae5e4..a17e6d253c960154dabdafa71daf38f2937a827c 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleGameModeKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleGameModeKeyboardInputHandler.kt
package ru.deadsoftware.cavedroid.game.input.handler.keyboard
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class ToggleGameModeKeyboardInputHandler @Inject constructor(
private val mobsController: MobsController
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleMinimapKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleMinimapKeyboardInputHandler.kt
index d39dfdbc818c618608dc2a69637c40a3e1bd88a6..6f22e4ca2ac84353e46d0d8fe42710a3f7b8e4c5 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleMinimapKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleMinimapKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class ToggleMinimapKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return action.actionKey is KeyboardInputActionKey.ShowMap && action.isKeyDown
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/TurnOnFlyModeKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/TurnOnFlyModeKeyboardInputHandler.kt
index f3b65eb0a226899e466dda68814586f56e574ca2..3b43d31b00daf8058c0a6ca6d9b49fd083c0bb66 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/TurnOnFlyModeKeyboardInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/TurnOnFlyModeKeyboardInputHandler.kt
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import javax.inject.Inject
@GameScope
+@KeyboardInputHandler
class TurnOnFlyModeKeyboardInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
override fun checkConditions(action: KeyboardInputAction): Boolean {
return mobsController.player.gameMode == 1 && action.actionKey is KeyboardInputActionKey.Up &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AbstractInventoryItemsMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AbstractInventoryItemsMouseInputHandler.kt
index dec8b7db0a65c8b32a530e655b5537ce17c9590a..3b925b09b58f53bcb5b7de2865f3e37b4a87f3fb 100644 (file)
import com.badlogic.gdx.graphics.g2d.TextureRegion
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideWindow
private val gameItemsHolder: GameItemsHolder,
private val gameWindowsManager: GameWindowsManager,
private val windowType: GameUiWindow,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
protected abstract val windowTexture: TextureRegion
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AttackMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AttackMouseInputHandler.kt
index 2afc3d5b1bbb50d6310f0fa4a247926c29bd9d3b..c2a22ede8b003fc1c5352555af6acde44ea661ca 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class AttackMouseInputHandler @Inject constructor(
private val mobsController: MobsController,
private val gameWorld: GameWorld,
private val gameWindowsManager: GameWindowsManager
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
override fun checkConditions(action: MouseInputAction): Boolean {
return gameWindowsManager.getCurrentWindow() == GameUiWindow.NONE &&
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt
index f6f6cfc97eeb83ad0a126225decd6d84b260e685..b5ff2c5a069b0b98cad49888f5934bdfaee1c9e7 100644 (file)
--- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt
+++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideWindow
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class CloseGameWindowMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
private val dropController: DropController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
private val survivalInventoryTexture get() = requireNotNull(Assets.textureRegions["survival"])
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CreativeInventoryScrollMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CreativeInventoryScrollMouseInputHandler.kt
index 11f76e9a691fd8a34c2086fdc21c4023ab592481..bf6ba3721e5e9f685f223aae67dd44040d872e88 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideWindow
import kotlin.math.abs
@GameScope
+@MouseInputHandler
class CreativeInventoryScrollMouseInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val gameWindowsManager: GameWindowsManager,
private val gameItemsHolder: GameItemsHolder,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CursorMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CursorMouseInputHandler.kt
index 454337eefb744f6f8a4803283299ddd28a2e694a..5d5c79f78e2e94d6d475920dfd11be332636b2ff 100644 (file)
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.mobs.Mob
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class CursorMouseInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
private val gameWindowsManager: GameWindowsManager,
private val gameItemsHolder: GameItemsHolder,
private val tooltipManager: TooltipManager,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private val player get() = mobsController.player
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/HotbarMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/HotbarMouseInputHandler.kt
index 18cd41ddb2d36401321b83acf84364c1c4317afa..45ae49b4747de4a0f3265797c51a3275a065c04b 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.handler.keyboard.DropItemKeyboardInputHandler.Companion.DROP_DISTANCE
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class HotbarMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
private val dropController: DropController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private val hotbarTexture get() = requireNotNull(Assets.textureRegions["hotbar"])
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectChestInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectChestInventoryItemMouseInputHandler.kt
index d47202e181bfe330a010c991668a54b15032f300..3118e9fdf705ddc4ef798b19681bfc3f825d3858 100644 (file)
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class SelectChestInventoryItemMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCraftingInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCraftingInventoryItemMouseInputHandler.kt
index 88e362005316a756b7e0aaf829493fe20d5a3747..cc993c99a5e81f3afcd1d761a0cbd57ad72873e2 100644 (file)
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCreativeInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCreativeInventoryItemMouseInputHandler.kt
index 272a17874b69897af5f4b3376131cdc61cfca5ea..5c6975fbb5c5aa9ab9d0f344306167f80b673525 100644 (file)
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideWindow
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class SelectCreativeInventoryItemMouseInputHandler @Inject constructor(
private val gameItemsHolder: GameItemsHolder,
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectFurnaceInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectFurnaceInventoryItemMouseInputHandler.kt
index f4a00eb9b18d22ed512557393bde5ba1e1342790..164b0c1dcb3d54fe3bfb287eb4984a57cdb6d538 100644 (file)
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import ru.deadsoftware.cavedroid.game.model.item.InventoryItem.Companion.isNoneOrNull
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class SelectFurnaceInventoryItemMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectSurvivalInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectSurvivalInventoryItemMouseInputHandler.kt
index 0a455ab2c70c47e53824d4225a0d395078c0809e..9f25b9adc9b59942f3622b3e74e6f503921f534d 100644 (file)
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
private val gameWindowsManager: GameWindowsManager,
private val mobsController: MobsController,
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/UseItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/UseItemMouseInputHandler.kt
index 04bc6198295fcf3fede52cfa413b685f3c6b6d9b..c0ff332e393509e174edf0c1e1fb57e0fab1254a 100644 (file)
import ru.deadsoftware.cavedroid.game.actions.placeblock.IPlaceBlockAction
import ru.deadsoftware.cavedroid.game.actions.useblock.IUseBlockAction
import ru.deadsoftware.cavedroid.game.actions.useitem.IUseItemAction
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class UseItemMouseInputHandler @Inject constructor(
private val mobsController: MobsController,
private val useItemActionMap: Map<String, @JvmSuppressWildcards IUseItemAction>,
private val useBlockActionMap: Map<String, @JvmSuppressWildcards IUseBlockAction>,
private val gameWindowsManager: GameWindowsManager,
private val gameWorld: GameWorld,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private var buttonHoldTask: Timer.Task? = null
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/touch/JoystickInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/touch/JoystickInputHandler.kt
index 1c020a5c189bd982493cd21b46f49c6687b62224..b6f31a3bd77e1b3e7e4bdbc5f6667e8ee8c00c8c 100644 (file)
import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
-import ru.deadsoftware.cavedroid.game.input.Joystick
+import ru.deadsoftware.cavedroid.game.input.*
import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
-import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
import ru.deadsoftware.cavedroid.game.mobs.Mob
import ru.deadsoftware.cavedroid.game.mobs.MobsController
import ru.deadsoftware.cavedroid.game.mobs.player.Player
import javax.inject.Inject
@GameScope
+@MouseInputHandler
class JoystickInputHandler @Inject constructor(
private val mainConfig: MainConfig,
private val mobsController: MobsController,
private val gameWindowsManager: GameWindowsManager,
private val gameWorld: GameWorld,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
private var activateTimeMs = 0L
private var cursorTimeoutMs = 100L
diff --git a/desktop/build.gradle b/desktop/build.gradle
index 58553a37aa12bf8a975da701cb9d299b03bef8a7..912734500bc8b2c2b414039e17cc9ef830176306 100644 (file)
--- a/desktop/build.gradle
+++ b/desktop/build.gradle
project.ext.mainClassName = "ru.deadsoftware.cavedroid.desktop.DesktopLauncher"
project.ext.assetsDir = new File("../android/assets")
-task run(dependsOn: classes, type: JavaExec) {
+task run(dependsOn: build, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
args "--debug"
}
-task runTouch(dependsOn: classes, type: JavaExec) {
+task runTouch(dependsOn: build, type: JavaExec) {
main = project.mainClassName
classpath = sourceSets.main.runtimeClasspath
standardInput = System.in
args "--touch", "--debug"
}
-task debug(dependsOn: classes, type: JavaExec) {
- main = project.mainClassName
- classpath = sourceSets.main.runtimeClasspath
- standardInput = System.in
- workingDir = project.assetsDir
- ignoreExitValue = true as JavaExecSpec
- debug = true
-}
-
-task dist(type: Jar) {
+task dist(dependsOn: build, type: Jar) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': project.mainClassName
with jar
}
-dist.dependsOn build
-
dependencies {
implementation project(":core")
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion"