Renamed key fields and table methods

This commit is contained in:
Anuken
2020-04-17 11:26:59 -04:00
parent 280f3dd428
commit eeb8d5ef9c
63 changed files with 438 additions and 441 deletions

View File

@@ -7,55 +7,55 @@ import arc.input.InputDevice.DeviceType;
import arc.input.KeyCode;
public enum Binding implements KeyBind{
move_x(new Axis(KeyCode.A, KeyCode.D), "general"),
move_y(new Axis(KeyCode.S, KeyCode.W)),
mouse_move(KeyCode.MOUSE_BACK),
dash(KeyCode.SHIFT_LEFT),
control(KeyCode.SHIFT_LEFT),
select(KeyCode.MOUSE_LEFT),
deselect(KeyCode.MOUSE_RIGHT),
break_block(KeyCode.MOUSE_RIGHT),
clear_building(KeyCode.Q),
pause_building(KeyCode.E),
rotate(new Axis(KeyCode.SCROLL)),
rotateplaced(KeyCode.R),
diagonal_placement(KeyCode.CONTROL_LEFT),
pick(KeyCode.MOUSE_MIDDLE),
schematic_select(KeyCode.F),
schematic_flip_x(KeyCode.Z),
schematic_flip_y(KeyCode.X),
schematic_menu(KeyCode.T),
category_prev(KeyCode.COMMA),
category_next(KeyCode.PERIOD),
block_select_left(KeyCode.LEFT),
block_select_right(KeyCode.RIGHT),
block_select_up(KeyCode.UP),
block_select_down(KeyCode.DOWN),
block_select_01(KeyCode.NUM_1),
block_select_02(KeyCode.NUM_2),
block_select_03(KeyCode.NUM_3),
block_select_04(KeyCode.NUM_4),
block_select_05(KeyCode.NUM_5),
block_select_06(KeyCode.NUM_6),
block_select_07(KeyCode.NUM_7),
block_select_08(KeyCode.NUM_8),
block_select_09(KeyCode.NUM_9),
block_select_10(KeyCode.NUM_0),
zoom(new Axis(KeyCode.SCROLL), "view"),
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.BACK : KeyCode.ESCAPE),
fullscreen(KeyCode.F11),
pause(KeyCode.SPACE),
minimap(KeyCode.M),
toggle_menus(KeyCode.C),
screenshot(KeyCode.P),
toggle_power_lines(KeyCode.F5),
toggle_block_status(KeyCode.F6),
player_list(KeyCode.TAB, "multiplayer"),
chat(KeyCode.ENTER),
chat_history_prev(KeyCode.UP),
chat_history_next(KeyCode.DOWN),
chat_scroll(new Axis(KeyCode.SCROLL)),
console(KeyCode.F8),
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
move_y(new Axis(KeyCode.s, KeyCode.w)),
mouse_move(KeyCode.mouseBack),
dash(KeyCode.shiftLeft),
control(KeyCode.shiftLeft),
select(KeyCode.mouseLeft),
deselect(KeyCode.mouseRight),
break_block(KeyCode.mouseRight),
clear_building(KeyCode.q),
pause_building(KeyCode.e),
rotate(new Axis(KeyCode.scroll)),
rotateplaced(KeyCode.r),
diagonal_placement(KeyCode.controlLeft),
pick(KeyCode.mouseMiddle),
schematic_select(KeyCode.f),
schematic_flip_x(KeyCode.z),
schematic_flip_y(KeyCode.x),
schematic_menu(KeyCode.t),
category_prev(KeyCode.comma),
category_next(KeyCode.period),
block_select_left(KeyCode.left),
block_select_right(KeyCode.right),
block_select_up(KeyCode.up),
block_select_down(KeyCode.down),
block_select_01(KeyCode.num1),
block_select_02(KeyCode.num2),
block_select_03(KeyCode.num3),
block_select_04(KeyCode.num4),
block_select_05(KeyCode.num5),
block_select_06(KeyCode.num6),
block_select_07(KeyCode.num7),
block_select_08(KeyCode.num8),
block_select_09(KeyCode.num9),
block_select_10(KeyCode.num0),
zoom(new Axis(KeyCode.scroll), "view"),
menu(Core.app.getType() == ApplicationType.Android ? KeyCode.back : KeyCode.escape),
fullscreen(KeyCode.f11),
pause(KeyCode.space),
minimap(KeyCode.m),
toggle_menus(KeyCode.c),
screenshot(KeyCode.p),
toggle_power_lines(KeyCode.f5),
toggle_block_status(KeyCode.f6),
player_list(KeyCode.tab, "multiplayer"),
chat(KeyCode.enter),
chat_history_prev(KeyCode.up),
chat_history_next(KeyCode.down),
chat_scroll(new Axis(KeyCode.scroll)),
console(KeyCode.f8),
;
private final KeybindValue defaultValue;

View File

@@ -72,7 +72,7 @@ public class DesktopInput extends InputHandler{
Core.keybinds.get(Binding.schematic_flip_y).key.toString())).style(Styles.outlineLabel);
b.row();
b.table(a -> {
a.addImageTextButton("$schematic.add", Icon.save, this::showSchematicSave).colspan(2).size(250f, 50f).disabled(f -> lastSchematic == null || lastSchematic.file != null);
a.button("$schematic.add", Icon.save, this::showSchematicSave).colspan(2).size(250f, 50f).disabled(f -> lastSchematic == null || lastSchematic.file != null);
});
}).margin(6f);
});
@@ -182,7 +182,7 @@ public class DesktopInput extends InputHandler{
}
//TODO this is for debugging, remove later
if(Core.input.keyTap(KeyCode.Q) && !player.dead()){
if(Core.input.keyTap(KeyCode.q) && !player.dead()){
Fx.commandSend.at(player);
Units.nearby(player.team(), player.x(), player.y(), 200f, u -> {
if(u.isAI()){
@@ -302,11 +302,11 @@ public class DesktopInput extends InputHandler{
@Override
public void buildPlacementUI(Table table){
table.addImage().color(Pal.gray).height(4f).colspan(4).growX();
table.image().color(Pal.gray).height(4f).colspan(4).growX();
table.row();
table.left().margin(0f).defaults().size(48f).left();
table.addImageButton(Icon.paste, Styles.clearPartiali, () -> {
table.button(Icon.paste, Styles.clearPartiali, () -> {
ui.schematics.show();
});
}

View File

@@ -14,7 +14,6 @@ import arc.scene.ui.layout.*;
import arc.util.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.entities.units.*;
@@ -175,23 +174,23 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override
public void buildPlacementUI(Table table){
table.addImage().color(Pal.gray).height(4f).colspan(4).growX();
table.image().color(Pal.gray).height(4f).colspan(4).growX();
table.row();
table.left().margin(0f).defaults().size(48f);
table.addImageButton(Icon.hammer, Styles.clearTogglePartiali, () -> {
table.button(Icon.hammer, Styles.clearTogglePartiali, () -> {
mode = mode == breaking ? block == null ? none : placing : breaking;
lastBlock = block;
}).update(l -> l.setChecked(mode == breaking)).name("breakmode");
//diagonal swap button
table.addImageButton(Icon.diagonal, Styles.clearTogglePartiali, () -> {
table.button(Icon.diagonal, Styles.clearTogglePartiali, () -> {
Core.settings.put("swapdiagonal", !Core.settings.getBool("swapdiagonal"));
Core.settings.save();
}).update(l -> l.setChecked(Core.settings.getBool("swapdiagonal")));
//rotate button
table.addImageButton(Icon.right, Styles.clearTogglePartiali, () -> {
table.button(Icon.right, Styles.clearTogglePartiali, () -> {
if(block != null && block.rotate){
rotation = Mathf.mod(rotation + 1, 4);
}else{
@@ -210,7 +209,7 @@ public class MobileInput extends InputHandler implements GestureListener{
});
//confirm button
table.addImageButton(Icon.ok, Styles.clearPartiali, () -> {
table.button(Icon.ok, Styles.clearPartiali, () -> {
for(BuildRequest request : selectRequests){
Tile tile = request.tile();
@@ -249,7 +248,7 @@ public class MobileInput extends InputHandler implements GestureListener{
group.fill(t -> {
t.bottom().left().visible(() -> (player.builder().isBuilding() || block != null || mode == breaking || !selectRequests.isEmpty()) && !schem.get());
t.addImageTextButton("$cancel", Icon.cancel, () -> {
t.button("$cancel", Icon.cancel, () -> {
player.builder().clearBuilding();
selectRequests.clear();
mode = none;
@@ -265,15 +264,15 @@ public class MobileInput extends InputHandler implements GestureListener{
ImageButtonStyle style = Styles.clearPartiali;
b.addImageButton(Icon.save, style, this::showSchematicSave).disabled(f -> lastSchematic == null || lastSchematic.file != null);
b.addImageButton(Icon.cancel, style, () -> {
b.button(Icon.save, style, this::showSchematicSave).disabled(f -> lastSchematic == null || lastSchematic.file != null);
b.button(Icon.cancel, style, () -> {
selectRequests.clear();
});
b.row();
b.addImageButton(Icon.flipX, style, () -> flipRequests(selectRequests, true));
b.addImageButton(Icon.flipY, style, () -> flipRequests(selectRequests, false));
b.button(Icon.flipX, style, () -> flipRequests(selectRequests, true));
b.button(Icon.flipY, style, () -> flipRequests(selectRequests, false));
b.row();
b.addImageButton(Icon.rotate, style, () -> rotateRequests(selectRequests, 1));
b.button(Icon.rotate, style, () -> rotateRequests(selectRequests, 1));
}).margin(4f);
});