diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 3996812ecf..6429793b4e 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -641,8 +641,6 @@ category.multiplayer.name = Multiplayer command.attack = Attack command.rally = Rally command.retreat = Retreat -keybind.gridMode.name = Block Select -keybind.gridModeShift.name = Category Select keybind.clear_building.name = Clear Building keybind.press = Press a key... keybind.press.axis = Press an axis or key... diff --git a/core/src/io/anuke/mindustry/entities/type/Player.java b/core/src/io/anuke/mindustry/entities/type/Player.java index e974c65db6..229fa1f1f8 100644 --- a/core/src/io/anuke/mindustry/entities/type/Player.java +++ b/core/src/io/anuke/mindustry/entities/type/Player.java @@ -585,7 +585,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{ float xa = Core.input.axis(Binding.move_x); float ya = Core.input.axis(Binding.move_y); - if(!Core.input.keyDown(Binding.gridMode) && !(Core.scene.getKeyboardFocus() instanceof TextField)){ + if(!(Core.scene.getKeyboardFocus() instanceof TextField)){ movement.y += ya * speed; movement.x += xa * speed; } diff --git a/core/src/io/anuke/mindustry/input/Binding.java b/core/src/io/anuke/mindustry/input/Binding.java index bd7cc9b4ac..24421b26cd 100644 --- a/core/src/io/anuke/mindustry/input/Binding.java +++ b/core/src/io/anuke/mindustry/input/Binding.java @@ -23,8 +23,6 @@ public enum Binding implements KeyBind{ schematic_flip_y(KeyCode.X), schematic_menu(KeyCode.T), dash(KeyCode.SHIFT_LEFT), - gridMode(KeyCode.BACKTICK), - gridModeShift(KeyCode.ALT_LEFT), zoom_hold(KeyCode.CONTROL_LEFT, "view"), zoom(new Axis(KeyCode.SCROLL)), menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE), diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index ac20cb6f26..ee496be14f 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -131,7 +131,7 @@ public class HudFragment extends Fragment{ } cont.update(() -> { - if(!Core.input.keyDown(Binding.gridMode) && Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.chatOpen() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ + if(Core.input.keyTap(Binding.toggle_menus) && !ui.chatfrag.chatOpen() && !Core.scene.hasDialog() && !(Core.scene.getKeyboardFocus() instanceof TextField)){ toggleMenus(); } }); diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java index ac6cfe8edf..aa033b2873 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/PlacementFragment.java @@ -3,7 +3,6 @@ package io.anuke.mindustry.ui.fragments; import io.anuke.arc.*; import io.anuke.arc.collection.*; import io.anuke.arc.graphics.*; -import io.anuke.arc.input.*; import io.anuke.arc.math.geom.*; import io.anuke.arc.scene.*; import io.anuke.arc.scene.event.*; @@ -37,19 +36,6 @@ public class PlacementFragment extends Fragment{ Table blockTable, toggler, topTable; boolean lastGround; - //not configurable, no plans to make it configurable - final KeyCode[] inputGrid = { - KeyCode.NUM_1, KeyCode.NUM_2, KeyCode.NUM_3, KeyCode.NUM_4, - KeyCode.Q, KeyCode.W, KeyCode.E, KeyCode.R, - KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.F, - KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V - }, inputCatGrid = { - KeyCode.NUM_1, KeyCode.NUM_2, - KeyCode.Q, KeyCode.W, - KeyCode.A, KeyCode.S, - KeyCode.Z, KeyCode.X, KeyCode.C, KeyCode.V - }; - public PlacementFragment(){ Events.on(WorldLoadEvent.class, event -> { Core.app.post(() -> { @@ -92,27 +78,6 @@ public class PlacementFragment extends Fragment{ return true; } } - - if(!Core.input.keyDown(Binding.gridMode) || ui.chatfrag.chatOpen()) return false; - if(Core.input.keyDown(Binding.gridModeShift)){ //select category - int i = 0; - for(KeyCode key : inputCatGrid){ - if(Core.input.keyDown(key)){ - input.block = getByCategory(Category.all[i]).first(); - currentCategory = input.block.category; - } - i++; - } - return true; - }else{ //select block - int i = 0; - Array recipes = getByCategory(currentCategory); - for(KeyCode key : inputGrid){ - if(Core.input.keyDown(key)) - input.block = (i < recipes.size && unlocked(recipes.get(i))) ? recipes.get(i) : null; - i++; - } - } return false; } @@ -272,6 +237,14 @@ public class PlacementFragment extends Fragment{ blocksSelect.table(control.input::buildPlacementUI).name("inputTable").growX(); }).fillY().bottom().touchable(Touchable.enabled); frame.table(categories -> { + categories.bottom(); + categories.add(new Image(Styles.black6){ + @Override + public void draw(){ + if(height <= Scl.scl(3f)) return; + getDrawable().draw(x, y, width, height - Scl.scl(3f)); + } + }).colspan(2).growX().growY().padTop(-3f).row(); categories.defaults().size(50f); ButtonGroup group = new ButtonGroup<>(); @@ -296,7 +269,7 @@ public class PlacementFragment extends Fragment{ rebuildCategory.run(); }).group(group).update(i -> i.setChecked(currentCategory == cat)).name("category-" + cat.name()); } - }).touchable(Touchable.enabled); + }).fillY().bottom().touchable(Touchable.enabled); rebuildCategory.run(); frame.update(() -> {