Minor UI fixes

This commit is contained in:
Anuken 2018-02-07 23:25:03 -05:00
parent 2059fb39f7
commit 714a4895bf
7 changed files with 41 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -23,10 +23,10 @@ import java.util.Locale;
public class Vars{
public static final String versionName = "Mindustry";
public static final String versionType = "Beta";
public static final byte versionBuild = 20;
public static final byte versionMajor = 3;
public static final byte versionMinor = 3;
public static final String versionType = "Beta";
public static final boolean testAndroid = false;
//shorthand for whether or not this is running on android

View File

@ -34,12 +34,13 @@ import java.nio.ByteBuffer;
import static io.anuke.mindustry.Vars.*;
public class NetClient extends Module {
boolean connecting = false;
boolean gotData = false;
boolean kicked = false;
IntSet recieved = new IntSet();
float playerSyncTime = 2;
float dataTimeout = 60*18; //18 seconds timeout
private final static float dataTimeout = 60*18; //18 seconds timeout
private final static float playerSyncTime = 2;
private boolean connecting = false;
private boolean gotData = false;
private boolean kicked = false;
private IntSet recieved = new IntSet();
public NetClient(){

View File

@ -256,6 +256,8 @@ public class Player extends SyncEntity{
@Override
public void write(ByteBuffer data) {
//TODO written angle is always 0
data.putFloat(x);
data.putFloat(y);
data.putFloat(angle);

View File

@ -24,6 +24,7 @@ public class HudFragment implements Fragment{
private ImageButton menu, flip;
private Table respawntable;
private Table wavetable;
private Label infolabel;
private boolean shown = true;
public void build(){
@ -54,10 +55,12 @@ public class HudFragment implements Fragment{
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));
}
}).get();
@ -78,6 +81,24 @@ public class HudFragment implements Fragment{
}
}).get();
new imagebutton("icon-settings", isize, () -> {
if (Net.active() && android) {
if (ui.chatfrag.chatOpen()) {
ui.chatfrag.hide();
} else {
ui.chatfrag.toggle();
}
} else {
ui.settings.show();
}
}).update(i -> {
if (Net.active() && android) {
i.getStyle().imageUp = Core.skin.getDrawable("icon-chat");
} else {
i.getStyle().imageUp = Core.skin.getDrawable("icon-settings");
}
}).get();
}}.end();
row();
@ -92,20 +113,14 @@ public class HudFragment implements Fragment{
visible(() -> !state.is(State.menu));
Label fps = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") +
(threads.isEnabled() ? " / " + threads.getFPS() + " TPS" : "") + (Net.client() && !gwt ? " / Ping: " + Net.getPing() : "") : ""));
infolabel = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") +
(threads.isEnabled() ? " / " + threads.getFPS() + " TPS" : "") + (Net.client() && !gwt ? "\nPing: " + Net.getPing() : "") : ""));
row();
add(fps).size(-1);
add(infolabel).size(-1);
}}.end();
new imagebutton("icon-chat", 40f, () -> {
if (ui.chatfrag.chatOpen()) {
ui.chatfrag.hide();
} else {
ui.chatfrag.toggle();
}
}).visible(() -> Net.active() && android).top().left().size(58f).get();
}}.end();
@ -181,12 +196,14 @@ public class HudFragment implements Fragment{
getEnemiesRemaining() :
(control.tutorial().active() || state.mode.disableWaveTimer) ? "$text.waiting"
: Bundles.format("text.wave.waiting", (int) (state.wavetime / 60f)))
.minWidth(126).padLeft(-6).padRight(-12).left();
.minWidth(126).padLeft(-6).left();
margin(10f);
get().marginLeft(6);
}}.left().end();
add().growX();
playButton(uheight);
}}.height(uheight).fillX().expandX().end().get();
wavetable.getParent().getParent().swapActor(wavetable.getParent(), menu.getParent());
@ -195,7 +212,7 @@ public class HudFragment implements Fragment{
private void playButton(float uheight){
new imagebutton("icon-play", 30f, () -> {
state.wavetime = 0f;
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padRight(-36).width(40f).update(l->{
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padLeft(-15).padRight(-10).width(40f).update(l->{
boolean vis = state.enemies <= 0 && (Net.server() || !Net.active());
boolean paused = state.is(State.paused) || !vis;

View File

@ -97,8 +97,9 @@ public class MenuFragment implements Fragment{
//version info
new table(){{
visible(() -> state.is(State.menu));
abottom().aleft();
new label(versionName + " " + versionMajor + "." + versionMinor + " " + versionType + " | build " + versionBuild);
new label(versionName + " " + versionMajor + "." + versionMinor + " " + versionType + " / build " + versionBuild);
}}.end();
}
}