Updated translation bundles, added autowrap to menu
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user