Updated translation bundles, added autowrap to menu

This commit is contained in:
Anuken
2018-05-05 13:18:21 -04:00
parent 90c243dec8
commit c1163a078a
9 changed files with 676 additions and 612 deletions

View File

@@ -95,7 +95,7 @@ public class Vars{
public static final int tilesize = 8;
public static final Locale[] locales = {new Locale("en"), new Locale("fr", "FR"), new Locale("ru"), new Locale("uk", "UA"), new Locale("pl", "PL"),
public static final Locale[] locales = {new Locale("en"), new Locale("fr"), new Locale("ru"), new Locale("uk", "UA"), new Locale("pl", "PL"),
new Locale("de"), new Locale("pt", "BR"), new Locale("ko"), new Locale("in", "ID"), new Locale("ita"), new Locale("es")};
public static final Color[] playerColors = {

View File

@@ -11,61 +11,62 @@ public class DefaultKeybinds {
public static void load(){
KeyBinds.defaults(
"move_x", new Axis(Input.A, Input.D),
"move_y", new Axis(Input.S, Input.W),
"select", Input.MOUSE_LEFT,
"break", Input.MOUSE_RIGHT,
"shoot", Input.MOUSE_LEFT,
"zoom_hold", Input.CONTROL_LEFT,
"zoom", new Axis(Input.SCROLL),
"menu", Gdx.app.getType() == ApplicationType.Android ? Input.BACK : Input.ESCAPE,
"pause", Input.SPACE,
"dash", Input.SHIFT_LEFT,
"rotate_alt", new Axis(Input.R, Input.E),
"rotate", new Axis(Input.SCROLL),
"block_info", Input.CONTROL_LEFT,
"player_list", Input.TAB,
"chat", Input.ENTER,
"chat_history_prev", Input.UP,
"chat_history_next", Input.DOWN,
"chat_scroll", new Axis(Input.SCROLL),
"console", Input.GRAVE,
"weapon_1", Input.NUM_1,
"weapon_2", Input.NUM_2,
"weapon_3", Input.NUM_3,
"weapon_4", Input.NUM_4,
"weapon_5", Input.NUM_5,
"weapon_6", Input.NUM_6
"move_x", new Axis(Input.A, Input.D),
"move_y", new Axis(Input.S, Input.W),
"select", Input.MOUSE_LEFT,
"break", Input.MOUSE_RIGHT,
"shoot", Input.MOUSE_LEFT,
"zoom_hold", Input.CONTROL_LEFT,
"zoom", new Axis(Input.SCROLL),
"menu", Gdx.app.getType() == ApplicationType.Android ? Input.BACK : Input.ESCAPE,
"pause", Input.SPACE,
"dash", Input.SHIFT_LEFT,
"rotate_alt", new Axis(Input.R, Input.E),
"rotate", new Axis(Input.SCROLL),
"toggle_menus", Input.C,
"block_info", Input.CONTROL_LEFT,
"player_list", Input.TAB,
"chat", Input.ENTER,
"chat_history_prev", Input.UP,
"chat_history_next", Input.DOWN,
"chat_scroll", new Axis(Input.SCROLL),
"console", Input.GRAVE,
"weapon_1", Input.NUM_1,
"weapon_2", Input.NUM_2,
"weapon_3", Input.NUM_3,
"weapon_4", Input.NUM_4,
"weapon_5", Input.NUM_5,
"weapon_6", Input.NUM_6
);
KeyBinds.defaults(
DeviceType.controller,
"move_x", new Axis(Input.CONTROLLER_L_STICK_HORIZONTAL_AXIS),
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
"cursor_y", new Axis(Input.CONTROLLER_R_STICK_VERTICAL_AXIS),
"select", Input.CONTROLLER_R_BUMPER,
"break", Input.CONTROLLER_L_BUMPER,
"shoot", Input.CONTROLLER_R_TRIGGER,
"zoom_hold", Input.ANY_KEY,
"zoom", new Axis(Input.CONTROLLER_DPAD_DOWN, Input.CONTROLLER_DPAD_UP),
"menu", Input.CONTROLLER_X,
"pause", Input.CONTROLLER_L_TRIGGER,
"dash", Input.CONTROLLER_Y,
"rotate_alt", new Axis(Input.CONTROLLER_DPAD_RIGHT, Input.CONTROLLER_DPAD_LEFT),
"rotate", new Axis(Input.CONTROLLER_A, Input.CONTROLLER_B),
"player_list", Input.CONTROLLER_START,
"chat", Input.ENTER,
"chat_history_prev", Input.UP,
"chat_history_next", Input.DOWN,
"chat_scroll", new Axis(Input.SCROLL),
"console", Input.GRAVE,
"weapon_1", Input.NUM_1,
"weapon_2", Input.NUM_2,
"weapon_3", Input.NUM_3,
"weapon_4", Input.NUM_4,
"weapon_5", Input.NUM_5,
"weapon_6", Input.NUM_6
"move_x", new Axis(Input.CONTROLLER_L_STICK_HORIZONTAL_AXIS),
"move_y", new Axis(Input.CONTROLLER_L_STICK_VERTICAL_AXIS),
"cursor_x", new Axis(Input.CONTROLLER_R_STICK_HORIZONTAL_AXIS),
"cursor_y", new Axis(Input.CONTROLLER_R_STICK_VERTICAL_AXIS),
"select", Input.CONTROLLER_R_BUMPER,
"break", Input.CONTROLLER_L_BUMPER,
"shoot", Input.CONTROLLER_R_TRIGGER,
"zoom_hold", Input.ANY_KEY,
"zoom", new Axis(Input.CONTROLLER_DPAD_DOWN, Input.CONTROLLER_DPAD_UP),
"menu", Input.CONTROLLER_X,
"pause", Input.CONTROLLER_L_TRIGGER,
"dash", Input.CONTROLLER_Y,
"rotate_alt", new Axis(Input.CONTROLLER_DPAD_RIGHT, Input.CONTROLLER_DPAD_LEFT),
"rotate", new Axis(Input.CONTROLLER_A, Input.CONTROLLER_B),
"player_list", Input.CONTROLLER_START,
"chat", Input.ENTER,
"chat_history_prev", Input.UP,
"chat_history_next", Input.DOWN,
"chat_scroll", new Axis(Input.SCROLL),
"console", Input.GRAVE,
"weapon_1", Input.NUM_1,
"weapon_2", Input.NUM_2,
"weapon_3", Input.NUM_3,
"weapon_4", Input.NUM_4,
"weapon_5", Input.NUM_5,
"weapon_6", Input.NUM_6
);
}
}

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.ui;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Align;
import io.anuke.ucore.function.Listenable;
import io.anuke.ucore.scene.ui.TextButton;
@@ -27,7 +28,7 @@ public class MenuButton extends TextButton{
table(t -> {
t.add(text);
t.add(text).wrap().growX().get().setAlignment(Align.center, Align.left);
if(description != null){
t.row();
t.add(description).color(Color.LIGHT_GRAY);

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.world.Map;
@@ -52,6 +53,7 @@ public class LevelDialog extends FloatingDialog{
TextButton[] b = {null};
b[0] = Elements.newButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode);
b[0].update(() -> b[0].setChecked(state.mode == mode));
b[0].getLabelCell().wrap().growX().get().setAlignment(Align.center, Align.left);
group.add(b[0]);
selmode.add(b[0]).size(130f, 54f);
}
@@ -99,15 +101,8 @@ public class LevelDialog extends FloatingDialog{
Table inset = new Table("pane-button");
inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f);
inset.row();
inset.label((() ->{
try{
return Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name));
}catch (Exception e){
Settings.defaults("hiscore" + map.name, 1);
return Bundles.format("text.level.highscore", 0);
}
}))
.pad(3f);
inset.label((() -> Bundles.format("text.level.highscore", Settings.getInt("hiscore" + map.name, 0)))).pad(3f)
.wrap().growX().get().setAlignment(Align.center, Align.left);
inset.pack();
float images = 154f;

View File

@@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Interpolation;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.net.Net;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Inputs;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.scene.actions.Actions;
import io.anuke.ucore.scene.builders.imagebutton;
@@ -21,11 +22,14 @@ import static io.anuke.mindustry.Vars.*;
public class HudFragment implements Fragment{
public final BlocksFragment blockfrag = new BlocksFragment();
private ImageButton menu, flip;
private Table respawntable;
private Table wavetable;
private Label infolabel;
private boolean shown = true;
private float dsize = 58;
private float isize = 40;
public void build(){
@@ -38,42 +42,25 @@ public class HudFragment implements Fragment{
new table() {{
left();
float dsize = 58;
defaults().size(dsize).left();
float isize = 40;
menu = new imagebutton("icon-menu", isize, ui.paused::show).get();
flip = new imagebutton("icon-arrow-up", isize, () -> toggleMenus()).get();
flip = new imagebutton("icon-arrow-up", isize, () -> {
if (wavetable.getActions().size != 0) return;
float dur = 0.3f;
Interpolation in = Interpolation.pow3Out;
flip.getStyle().imageUp = Core.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
if (shown) {
blockfrag.toggle(false, dur, in);
wavetable.actions(Actions.translateBy(0, wavetable.getHeight() + dsize, dur, in), Actions.call(() -> shown = false));
infolabel.actions(Actions.translateBy(0, wavetable.getHeight(), dur, in), Actions.call(() -> shown = false));
} else {
shown = true;
blockfrag.toggle(true, dur, in);
wavetable.actions(Actions.translateBy(0, -wavetable.getTranslation().y, dur, in));
infolabel.actions(Actions.translateBy(0, -infolabel.getTranslation().y, dur, in));
update(t -> {
if(Inputs.keyTap("toggle_menus")){
toggleMenus();
}
}).get();
});
new imagebutton("icon-pause", isize, () -> {
if(mobile) DebugFragment.printDebugInfo();
if (Net.active() && mobile) {
if (Net.active()) {
ui.listfrag.visible = !ui.listfrag.visible;
} else {
state.set(state.is(State.paused) ? State.playing : State.paused);
}
}).update(i -> {
if (Net.active() && mobile) {
if (Net.active()) {
i.getStyle().imageUp = Core.skin.getDrawable("icon-players");
} else {
i.setDisabled(Net.active());
@@ -174,6 +161,26 @@ public class HudFragment implements Fragment{
blockfrag.build();
}
private void toggleMenus(){
if (wavetable.getActions().size != 0) return;
float dur = 0.3f;
Interpolation in = Interpolation.pow3Out;
flip.getStyle().imageUp = Core.skin.getDrawable(shown ? "icon-arrow-down" : "icon-arrow-up");
if (shown) {
blockfrag.toggle(false, dur, in);
wavetable.actions(Actions.translateBy(0, wavetable.getHeight() + dsize, dur, in), Actions.call(() -> shown = false));
infolabel.actions(Actions.translateBy(0, wavetable.getHeight(), dur, in), Actions.call(() -> shown = false));
} else {
shown = true;
blockfrag.toggle(true, dur, in);
wavetable.actions(Actions.translateBy(0, -wavetable.getTranslation().y, dur, in));
infolabel.actions(Actions.translateBy(0, -infolabel.getTranslation().y, dur, in));
}
}
private String getEnemiesRemaining() {
if(state.enemies == 1) {
return Bundles.format("text.enemies.single", state.enemies);

View File

@@ -64,7 +64,9 @@ public class PlayerListFragment implements Fragment{
update(t -> {
if(!mobile){
visible = Inputs.keyDown("player_list");
if(Inputs.keyTap("player_list")){
visible = !visible;
}
}
if(!(Net.active() && !state.is(State.menu))){
visible = false;