DEADSOFTWARE

Better touch inventory controls
authorfredboy <fredboy@protonmail.com>
Thu, 9 May 2024 08:19:01 +0000 (15:19 +0700)
committerfredboy <fredboy@protonmail.com>
Thu, 9 May 2024 08:19:01 +0000 (15:19 +0700)
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleControlsModeKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCraftingInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectSurvivalInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/touch/JoystickInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/ui/windows/GameWindowsManager.kt
core/src/ru/deadsoftware/cavedroid/game/ui/windows/inventory/AbstractInventoryWindow.kt
core/src/ru/deadsoftware/cavedroid/game/ui/windows/inventory/CraftingInventoryWindow.kt
core/src/ru/deadsoftware/cavedroid/game/ui/windows/inventory/CreativeInventoryWindow.kt
core/src/ru/deadsoftware/cavedroid/game/ui/windows/inventory/SurvivalInventoryWindow.kt

index 50aa5b01b5d6677865d350b61574449ecae1ebf0..ce7005408993aa621528c48a280ad77e4864b29f 100644 (file)
@@ -17,7 +17,7 @@ class OpenInventoryKeyboardInputHandler @Inject constructor(
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.OpenInventory &&
-                action.isKeyDown && gameWindowsManager.getCurrentWindow() == GameUiWindow.NONE
+                !action.isKeyDown && gameWindowsManager.getCurrentWindow() == GameUiWindow.NONE
     }
 
     override fun handle(action: KeyboardInputAction) {
index 0f656d8eac5a6ab38cb9f1e9e07a5a4d97d631e5..fc95e29b84794fb271aa3520cf09d58f0b6d7b20 100644 (file)
@@ -16,7 +16,7 @@ class ToggleControlsModeKeyboardInputHandler @Inject constructor(
 ) : IGameInputHandler<KeyboardInputAction> {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
-        return action.actionKey is KeyboardInputActionKey.SwitchControlsMode && action.isKeyDown
+        return action.actionKey is KeyboardInputActionKey.SwitchControlsMode && !action.isKeyDown
                 && mainConfig.isTouch
     }
 
index 8a7fdb46ff4559af473fb7dc1a40bcbc287c7d6d..ffda344c1e25863926cc9e1bf8ae780cfbec2b45 100644 (file)
@@ -27,7 +27,7 @@ class CloseGameWindowMouseInputHandler @Inject constructor(
     override fun checkConditions(action: MouseInputAction): Boolean {
         return gameWindowsManager.getCurrentWindow() != GameUiWindow.NONE &&
                 (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) &&
-                !action.actionKey.touchUp &&
+                action.actionKey.touchUp &&
                 !isInsideWindow(action, getCurrentWindowTexture())
     }
 
@@ -43,13 +43,12 @@ class CloseGameWindowMouseInputHandler @Inject constructor(
     override fun handle(action: MouseInputAction) {
         val selectedItem = gameWindowsManager.currentWindow?.selectedItem
         if (selectedItem != null) {
-            for (i in 1 .. selectedItem.amount) {
                 dropController.addDrop(
                     /* x = */ mobsController.player.x + (32f * mobsController.player.direction.basis),
                     /* y = */ mobsController.player.y,
-                    /* item = */ selectedItem.item
+                    /* item = */ selectedItem.item,
+                    /* count = */ selectedItem.amount,
                 )
-            }
             gameWindowsManager.currentWindow?.selectedItem = null
         }
         gameWindowsManager.closeWindow()
index 489815029f5d72da169c5a62c52a256dca6e7990..b3fb22394abadc8f151cda3cfc03f5854d570ef7 100644 (file)
@@ -10,6 +10,7 @@ import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
+import ru.deadsoftware.cavedroid.game.objects.DropController
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
 import ru.deadsoftware.cavedroid.game.ui.windows.inventory.CraftingInventoryWindow
@@ -21,6 +22,7 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val gameItemsHolder: GameItemsHolder,
+    private val dropController: DropController,
 ) : IGameInputHandler<MouseInputAction> {
 
     private val survivalWindowTexture get() = requireNotNull(Assets.textureRegions["survival"])
@@ -29,38 +31,7 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
         return gameWindowsManager.getCurrentWindow() == GameUiWindow.CRAFTING_TABLE &&
                 isInsideWindow(action, survivalWindowTexture) &&
                 (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Right || action.actionKey is MouseInputActionKey.Screen)
-                && action.actionKey.touchUp
-    }
-
-    private fun onLeftCLick(items: MutableList<InventoryItem?>, window: CraftingInventoryWindow, index: Int) {
-        val selectedItem = window.selectedItem
-        val clickedItem = items[index]
-
-        if (clickedItem != null && selectedItem != null && items[index]!!.item == selectedItem.item &&
-            items[index]!!.amount + selectedItem.amount <= selectedItem.item.params.maxStack) {
-            items[index]!!.amount += selectedItem.amount
-            window.selectedItem = null
-            return
-        }
-
-        val item = items[index]
-        items[index] = selectedItem ?: gameItemsHolder.fallbackItem.toInventoryItem()
-        window.selectedItem = item
-    }
-
-    private fun onRightClick(items: MutableList<InventoryItem?>, window: CraftingInventoryWindow, index: Int) {
-        val clickedItem = items[index]
-        val selectedItem = window.selectedItem
-            ?.takeIf { clickedItem == null || clickedItem.item.isNone() || it.item == items[index]!!.item && items[index]!!.amount + 1 < it.item.params.maxStack }
-            ?: return
-
-        val newItem = selectedItem.item.toInventoryItem((clickedItem?.takeIf { !it.item.isNone() }?.amount ?: 0) + 1)
-        items[index] = newItem
-        selectedItem.amount --
-
-        if (selectedItem.amount <= 0) {
-            window.selectedItem = null
-        }
+                && (action.actionKey.touchUp || action.actionKey is MouseInputActionKey.Screen)
     }
 
     private fun handleInsideInventoryGrid(action: MouseInputAction, xOnGrid: Int, yOnGrid: Int) {
@@ -69,14 +40,24 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
         var itemIndex = ((xOnGrid.toInt() + yOnGrid.toInt() * GameWindowsConfigs.Crafting.itemsInRow))
         itemIndex += GameWindowsConfigs.Crafting.hotbarCells
 
-        if (itemIndex >= 36) {
-            itemIndex -= 36
+        if (itemIndex >= mobsController.player.inventory.size) {
+            itemIndex -= mobsController.player.inventory.size
         }
 
-        if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
-            onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, window, itemIndex)
+        if (action.actionKey is MouseInputActionKey.Screen) {
+            if (!action.actionKey.touchUp) {
+                window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex, action.actionKey.pointer)
+            } else {
+                if (action.actionKey.pointer == window.selectItemPointer) {
+                    window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex, action.actionKey.pointer)
+                } else {
+                    window.onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, itemIndex)
+                }
+            }
+        } else if (action.actionKey is MouseInputActionKey.Left) {
+            window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex)
         } else {
-            onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, window, itemIndex)
+            window.onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, itemIndex)
         }
 
         Gdx.app.debug(
@@ -89,10 +70,20 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
         val window = gameWindowsManager.currentWindow as CraftingInventoryWindow
         val index = xOnCraft + yOnCraft * GameWindowsConfigs.Crafting.craftGridSize
 
-        if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
-            onLeftCLick(window.craftingItems, window, index)
+        if (action.actionKey is MouseInputActionKey.Screen) {
+            if (!action.actionKey.touchUp) {
+                window.onLeftCLick(window.craftingItems, gameItemsHolder, index, action.actionKey.pointer)
+            } else {
+                if (action.actionKey.pointer == window.selectItemPointer) {
+                    window.onLeftCLick(window.craftingItems, gameItemsHolder, index, action.actionKey.pointer)
+                } else {
+                    window.onRightClick(window.craftingItems, index)
+                }
+            }
+        } else if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
+            window.onLeftCLick(window.craftingItems, gameItemsHolder, index)
         } else {
-            onRightClick(window.craftingItems, window, index)
+            window.onRightClick(window.craftingItems, index)
         }
 
         window.craftResult =
@@ -131,7 +122,7 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
             handleInsideInventoryGrid(action, xOnGrid.toInt(), yOnGrid.toInt())
         } else if (isInsideCraftGrid) {
             handleInsideCraft(action, xOnCraft.toInt(), yOnCraft.toInt())
-        } else if (isInsideCraftResult) {
+        } else if (isInsideCraftResult && action.actionKey.touchUp) {
             val selectedItem = window.selectedItem
             if (selectedItem == null || selectedItem.item.isNone() ||
                 (selectedItem.item == window.craftResult?.item && selectedItem.amount + (window.craftResult?.amount ?: 0) <= selectedItem.item.params.maxStack)) {
@@ -150,6 +141,16 @@ class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
                 window.craftResult = gameItemsHolder.craftItem(window.craftingItems
                     .map { it?.item ?: gameItemsHolder.fallbackItem })
             }
+        } else if (action.actionKey.touchUp) {
+            window.selectedItem?.let { selectedItem ->
+                dropController.addDrop(
+                    /* x = */ mobsController.player.x + (32f * mobsController.player.direction.basis),
+                    /* y = */ mobsController.player.y,
+                    /* item = */ selectedItem.item,
+                    /* count = */ selectedItem.amount,
+                )
+                window.selectedItem = null
+            }
         }
 
     }
index 0d0a64771f6cf6f7097d2cd54316ff850075b448..d5858ac0d70822b6f1aa2a317669273c75f4e203 100644 (file)
@@ -10,6 +10,7 @@ import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
+import ru.deadsoftware.cavedroid.game.objects.DropController
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
 import ru.deadsoftware.cavedroid.game.ui.windows.inventory.SurvivalInventoryWindow
@@ -21,6 +22,7 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val gameItemsHolder: GameItemsHolder,
+    private val dropController: DropController,
 ) : IGameInputHandler<MouseInputAction> {
 
     private val survivalWindowTexture get() = requireNotNull(Assets.textureRegions["survival"])
@@ -29,38 +31,7 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
         return gameWindowsManager.getCurrentWindow() == GameUiWindow.SURVIVAL_INVENTORY &&
                 isInsideWindow(action, survivalWindowTexture) &&
                 (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Right || action.actionKey is MouseInputActionKey.Screen)
-                && action.actionKey.touchUp
-    }
-
-    private fun onLeftCLick(items: MutableList<InventoryItem?>, window: SurvivalInventoryWindow, index: Int) {
-        val selectedItem = window.selectedItem
-        val clickedItem = items[index]
-
-        if (clickedItem != null && selectedItem != null && items[index]!!.item == selectedItem.item &&
-            items[index]!!.amount + selectedItem.amount <= selectedItem.item.params.maxStack) {
-            items[index]!!.amount += selectedItem.amount
-            window.selectedItem = null
-            return
-        }
-
-        val item = items[index]
-        items[index] = selectedItem ?: gameItemsHolder.fallbackItem.toInventoryItem()
-        window.selectedItem = item
-    }
-
-    private fun onRightClick(items: MutableList<InventoryItem?>, window: SurvivalInventoryWindow, index: Int) {
-        val clickedItem = items[index]
-        val selectedItem = window.selectedItem
-            ?.takeIf { clickedItem == null || clickedItem.item.isNone() || it.item == items[index]!!.item && items[index]!!.amount + 1 < it.item.params.maxStack }
-            ?: return
-
-        val newItem = selectedItem.item.toInventoryItem((clickedItem?.takeIf { !it.item.isNone() }?.amount ?: 0) + 1)
-        items[index] = newItem
-        selectedItem.amount --
-
-        if (selectedItem.amount <= 0) {
-            window.selectedItem = null
-        }
+                && (action.actionKey.touchUp || action.actionKey is MouseInputActionKey.Screen)
     }
 
     private fun handleInsideInventoryGrid(action: MouseInputAction, xOnGrid: Int, yOnGrid: Int) {
@@ -69,14 +40,24 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
         var itemIndex = ((xOnGrid.toInt() + yOnGrid.toInt() * GameWindowsConfigs.Survival.itemsInRow))
         itemIndex += GameWindowsConfigs.Survival.hotbarCells
 
-        if (itemIndex >= 36) {
-            itemIndex -= 36
+        if (itemIndex >= mobsController.player.inventory.size) {
+            itemIndex -= mobsController.player.inventory.size
         }
 
-        if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
-            onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, window, itemIndex)
+        if (action.actionKey is MouseInputActionKey.Screen) {
+            if (!action.actionKey.touchUp) {
+                window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex, action.actionKey.pointer)
+            } else {
+                if (action.actionKey.pointer == window.selectItemPointer) {
+                    window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex, action.actionKey.pointer)
+                } else {
+                    window.onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, itemIndex)
+                }
+            }
+        } else if (action.actionKey is MouseInputActionKey.Left) {
+            window.onLeftCLick(mobsController.player.inventory.items as MutableList<InventoryItem?>, gameItemsHolder, itemIndex)
         } else {
-            onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, window, itemIndex)
+            window.onRightClick(mobsController.player.inventory.items as MutableList<InventoryItem?>, itemIndex)
         }
 
         Gdx.app.debug(
@@ -89,10 +70,20 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
         val window = gameWindowsManager.currentWindow as SurvivalInventoryWindow
         val index = xOnCraft + yOnCraft * GameWindowsConfigs.Crafting.craftGridSize // this is crafting on purpose!!
 
-        if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
-            onLeftCLick(window.craftingItems, window, index)
+        if (action.actionKey is MouseInputActionKey.Screen) {
+            if (!action.actionKey.touchUp) {
+                window.onLeftCLick(window.craftingItems, gameItemsHolder, index, action.actionKey.pointer)
+            } else {
+                if (action.actionKey.pointer == window.selectItemPointer) {
+                    window.onLeftCLick(window.craftingItems, gameItemsHolder, index, action.actionKey.pointer)
+                } else {
+                    window.onRightClick(window.craftingItems, index)
+                }
+            }
+        } else if (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Screen) {
+            window.onLeftCLick(window.craftingItems, gameItemsHolder, index)
         } else {
-            onRightClick(window.craftingItems, window, index)
+            window.onRightClick(window.craftingItems, index)
         }
 
         window.craftResult =
@@ -131,7 +122,7 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
             handleInsideInventoryGrid(action, xOnGrid.toInt(), yOnGrid.toInt())
         } else if (isInsideCraftGrid) {
             handleInsideCraft(action, xOnCraft.toInt(), yOnCraft.toInt())
-        } else if (isInsideCraftResult) {
+        } else if (isInsideCraftResult && action.actionKey.touchUp) {
             val selectedItem = window.selectedItem
             if (selectedItem == null || selectedItem.item.isNone() ||
                 (selectedItem.item == window.craftResult?.item && selectedItem.amount + (window.craftResult?.amount ?: 0) <= selectedItem.item.params.maxStack)) {
@@ -150,6 +141,16 @@ class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
                 window.craftResult = gameItemsHolder.craftItem(window.craftingItems
                     .map { it?.item ?: gameItemsHolder.fallbackItem })
             }
+        } else if (action.actionKey.touchUp) {
+            window.selectedItem?.let { selectedItem ->
+                dropController.addDrop(
+                    /* x = */ mobsController.player.x + (32f * mobsController.player.direction.basis),
+                    /* y = */ mobsController.player.y,
+                    /* item = */ selectedItem.item,
+                    /* count = */ selectedItem.amount,
+                )
+                window.selectedItem = null
+            }
         }
 
     }
index c175f31da86ba167d1b11a2daaaf13446585acbe..d4fb451ee761a1033aafeb6f661fe918afb76bf9 100644 (file)
@@ -1,6 +1,5 @@
 package ru.deadsoftware.cavedroid.game.input.handler.touch
 
-import com.badlogic.gdx.math.Vector2
 import com.badlogic.gdx.utils.TimeUtils
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
@@ -95,6 +94,10 @@ class JoystickInputHandler @Inject constructor(
     }
 
     private fun handleDragged() {
+        if (!active) {
+            return
+        }
+
         if (mobsController.player.controlMode == Player.ControlMode.CURSOR) {
             handleCursor()
             return
index 56d92d6f8a8de8f7dd381f7971eba99d08565a0c..05c8a9b25b24dcb72a1d985869e9fd63b4285189 100644 (file)
@@ -30,14 +30,14 @@ class GameWindowsManager @Inject constructor(
 
     fun openInventory() {
         if (mobsController.player.gameMode == 1) {
-            currentWindow = CreativeInventoryWindow(GameUiWindow.CREATIVE_INVENTORY)
+            currentWindow = CreativeInventoryWindow()
         } else {
-            currentWindow = SurvivalInventoryWindow(GameUiWindow.SURVIVAL_INVENTORY)
+            currentWindow = SurvivalInventoryWindow()
         }
     }
 
     fun openCrafting() {
-        currentWindow = CraftingInventoryWindow(GameUiWindow.CRAFTING_TABLE)
+        currentWindow = CraftingInventoryWindow()
     }
 
     fun closeWindow() {
index 9d8e0f93387fd99da2198fa9d5ead2dc7028a13e..f49ba4908d1cd91b88ce7918ce823a8fef715d57 100644 (file)
@@ -1,5 +1,6 @@
 package ru.deadsoftware.cavedroid.game.ui.windows.inventory
 
+import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
 
@@ -9,4 +10,44 @@ abstract class AbstractInventoryWindow {
 
     abstract var selectedItem: InventoryItem?
 
+    var selectItemPointer: Int = -1
+
+    fun onLeftCLick(items: MutableList<InventoryItem?>, gameItemsHolder: GameItemsHolder, index: Int, pointer: Int = -1) {
+        if (selectedItem != null && selectedItem?.item?.isNone() != true && pointer >= 0 && selectItemPointer >= 0 && pointer != selectItemPointer) {
+            return
+        }
+
+        val clickedItem = items[index]
+
+        selectedItem?.let { selectedItem ->
+            if (clickedItem != null && items[index]!!.item == selectedItem.item &&
+                items[index]!!.amount + selectedItem.amount <= selectedItem.item.params.maxStack) {
+                items[index]!!.amount += selectedItem.amount
+                this@AbstractInventoryWindow.selectedItem = null
+                selectItemPointer = -1
+                return
+            }
+        }
+
+        val item = items[index]
+        items[index] = selectedItem ?: gameItemsHolder.fallbackItem.toInventoryItem()
+        selectedItem = item
+        selectItemPointer = pointer
+    }
+
+    fun onRightClick(items: MutableList<InventoryItem?>, index: Int) {
+        val clickedItem = items[index]
+        val selectedItem = selectedItem
+            ?.takeIf { clickedItem == null || clickedItem.item.isNone() || it.item == items[index]!!.item && items[index]!!.amount + 1 < it.item.params.maxStack }
+            ?: return
+
+        val newItem = selectedItem.item.toInventoryItem((clickedItem?.takeIf { !it.item.isNone() }?.amount ?: 0) + 1)
+        items[index] = newItem
+        selectedItem.amount --
+
+        if (selectedItem.amount <= 0) {
+            this@AbstractInventoryWindow.selectedItem = null
+        }
+    }
+
 }
\ No newline at end of file
index 13dbd83ce930e526f6b0ff405d572c5dc53af487..d83f1d5d8104aab552d500088bdb3f732af0c44b 100644 (file)
@@ -3,9 +3,9 @@ package ru.deadsoftware.cavedroid.game.ui.windows.inventory
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
 
-class CraftingInventoryWindow(
-    override val type: GameUiWindow,
-) : AbstractInventoryWindow() {
+class CraftingInventoryWindow : AbstractInventoryWindow() {
+
+    override val type = GameUiWindow.CRAFTING_TABLE
 
     override var selectedItem: InventoryItem? = null
 
index 22a3d5663c7b35cf065329aa49a38d838ac0406d..a38fd2970d9c3b9c99e330047ec267f43fe049aa 100644 (file)
@@ -3,8 +3,9 @@ package ru.deadsoftware.cavedroid.game.ui.windows.inventory
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
 
-class CreativeInventoryWindow(
-    override val type: GameUiWindow,
-) : AbstractInventoryWindow() {
+class CreativeInventoryWindow() : AbstractInventoryWindow() {
+
+    override val type = GameUiWindow.CREATIVE_INVENTORY
+
     override var selectedItem: InventoryItem? = null
 }
\ No newline at end of file
index 685642c396642cebbd1054bc098eac41a8bcb882..12026d894bc4cec749b6068346858ecc761b3944 100644 (file)
@@ -3,9 +3,9 @@ package ru.deadsoftware.cavedroid.game.ui.windows.inventory
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem
 
-class SurvivalInventoryWindow(
-    override val type: GameUiWindow,
-) : AbstractInventoryWindow() {
+class SurvivalInventoryWindow() : AbstractInventoryWindow() {
+
+    override val type = GameUiWindow.SURVIVAL_INVENTORY
 
     override var selectedItem: InventoryItem? = null