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 class Vars{
public static final String versionName = "Mindustry"; public static final String versionName = "Mindustry";
public static final String versionType = "Beta";
public static final byte versionBuild = 20; public static final byte versionBuild = 20;
public static final byte versionMajor = 3; public static final byte versionMajor = 3;
public static final byte versionMinor = 3; public static final byte versionMinor = 3;
public static final String versionType = "Beta";
public static final boolean testAndroid = false; public static final boolean testAndroid = false;
//shorthand for whether or not this is running on android //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.*; import static io.anuke.mindustry.Vars.*;
public class NetClient extends Module { public class NetClient extends Module {
boolean connecting = false; private final static float dataTimeout = 60*18; //18 seconds timeout
boolean gotData = false; private final static float playerSyncTime = 2;
boolean kicked = false;
IntSet recieved = new IntSet(); private boolean connecting = false;
float playerSyncTime = 2; private boolean gotData = false;
float dataTimeout = 60*18; //18 seconds timeout private boolean kicked = false;
private IntSet recieved = new IntSet();
public NetClient(){ public NetClient(){

View File

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

View File

@@ -24,6 +24,7 @@ public class HudFragment implements Fragment{
private ImageButton menu, flip; private ImageButton menu, flip;
private Table respawntable; private Table respawntable;
private Table wavetable; private Table wavetable;
private Label infolabel;
private boolean shown = true; private boolean shown = true;
public void build(){ public void build(){
@@ -54,10 +55,12 @@ public class HudFragment implements Fragment{
if (shown) { if (shown) {
blockfrag.toggle(false, dur, in); blockfrag.toggle(false, dur, in);
wavetable.actions(Actions.translateBy(0, wavetable.getHeight() + dsize, dur, in), Actions.call(() -> shown = false)); 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 { } else {
shown = true; shown = true;
blockfrag.toggle(true, dur, in); blockfrag.toggle(true, dur, in);
wavetable.actions(Actions.translateBy(0, -wavetable.getTranslation().y, dur, in)); wavetable.actions(Actions.translateBy(0, -wavetable.getTranslation().y, dur, in));
infolabel.actions(Actions.translateBy(0, -infolabel.getTranslation().y, dur, in));
} }
}).get(); }).get();
@@ -78,6 +81,24 @@ public class HudFragment implements Fragment{
} }
}).get(); }).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(); }}.end();
row(); row();
@@ -92,20 +113,14 @@ public class HudFragment implements Fragment{
visible(() -> !state.is(State.menu)); visible(() -> !state.is(State.menu));
Label fps = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") + infolabel = new Label(() -> (Settings.getBool("fps") ? (Gdx.graphics.getFramesPerSecond() + " FPS") +
(threads.isEnabled() ? " / " + threads.getFPS() + " TPS" : "") + (Net.client() && !gwt ? " / Ping: " + Net.getPing() : "") : "")); (threads.isEnabled() ? " / " + threads.getFPS() + " TPS" : "") + (Net.client() && !gwt ? "\nPing: " + Net.getPing() : "") : ""));
row(); row();
add(fps).size(-1); add(infolabel).size(-1);
}}.end(); }}.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(); }}.end();
@@ -181,12 +196,14 @@ public class HudFragment implements Fragment{
getEnemiesRemaining() : getEnemiesRemaining() :
(control.tutorial().active() || state.mode.disableWaveTimer) ? "$text.waiting" (control.tutorial().active() || state.mode.disableWaveTimer) ? "$text.waiting"
: Bundles.format("text.wave.waiting", (int) (state.wavetime / 60f))) : Bundles.format("text.wave.waiting", (int) (state.wavetime / 60f)))
.minWidth(126).padLeft(-6).padRight(-12).left(); .minWidth(126).padLeft(-6).left();
margin(10f); margin(10f);
get().marginLeft(6); get().marginLeft(6);
}}.left().end(); }}.left().end();
add().growX();
playButton(uheight); playButton(uheight);
}}.height(uheight).fillX().expandX().end().get(); }}.height(uheight).fillX().expandX().end().get();
wavetable.getParent().getParent().swapActor(wavetable.getParent(), menu.getParent()); wavetable.getParent().getParent().swapActor(wavetable.getParent(), menu.getParent());
@@ -195,7 +212,7 @@ public class HudFragment implements Fragment{
private void playButton(float uheight){ private void playButton(float uheight){
new imagebutton("icon-play", 30f, () -> { new imagebutton("icon-play", 30f, () -> {
state.wavetime = 0f; 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 vis = state.enemies <= 0 && (Net.server() || !Net.active());
boolean paused = state.is(State.paused) || !vis; boolean paused = state.is(State.paused) || !vis;

View File

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