DEADSOFTWARE

Add survival inventory
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / GameInput.java
index a45e7045446eb51feef1afb024dc211a54b3da5a..85fd63bcba6f6b615ce654aed624c9109784b7a1 100644 (file)
@@ -282,13 +282,24 @@ public class GameInput {
                         mMainConfig.getWidth() / 2 + (float) hotbar.getRegionWidth() / 2).contains(x);
     }
 
+    private void openInventory() {
+        switch (mPlayer.gameMode) {
+            case 0:
+                mMainConfig.setGameUiWindow(GameUiWindow.SURVIVAL_INVENTORY);
+                break;
+            case 1:
+                mMainConfig.setGameUiWindow(GameUiWindow.CREATIVE_INVENTORY);
+                break;
+        }
+    }
+
     private void holdMB() {
         if (mTouchDownBtn == Input.Buttons.RIGHT) {
             useItem(mPlayer.cursorX, mPlayer.cursorY, mPlayer.inventory[mPlayer.slot].getItem(), true);
             mTouchedDown = false;
         } else {
             if (insideHotbar(mTouchDownX, mTouchDownY)) {
-                mMainConfig.setGameUiWindow(GameUiWindow.CREATIVE_INVENTORY);
+                openInventory();
                 mTouchedDown = false;
             }
         }
@@ -315,14 +326,7 @@ public class GameInput {
 
             case Input.Keys.E:
                 if (mMainConfig.checkGameUiWindow(GameUiWindow.NONE)) {
-                    switch (mPlayer.gameMode) {
-                        case 0:
-                            //TODO survival inv
-                            break;
-                        case 1:
-                            mMainConfig.setGameUiWindow(GameUiWindow.CREATIVE_INVENTORY);
-                            break;
-                    }
+                    openInventory();
                 } else {
                     mMainConfig.setGameUiWindow(GameUiWindow.NONE);
                 }