This commit is contained in:
Anuken 2019-10-20 16:50:04 -04:00
parent 4b428c6636
commit 2e0e351228
5 changed files with 11 additions and 42 deletions

View File

@ -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...

View File

@ -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;
}

View File

@ -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),

View File

@ -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();
}
});

View File

@ -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<Block> 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<ImageButton> 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(() -> {