Merge remote-tracking branch 'origin/master'

# Conflicts:
#	core/src/mindustry/ui/dialogs/PausedDialog.java
This commit is contained in:
Anuken
2020-10-11 10:51:46 -04:00
9 changed files with 85 additions and 51 deletions

View File

@@ -100,20 +100,23 @@ public class HudFragment extends Fragment{
//paused table
parent.fill(t -> {
t.name = "paused";
t.top().visible(() -> state.isPaused()).touchable = Touchable.disabled;
t.table(Styles.black5, top -> top.add("@paused").style(Styles.outlineLabel).pad(8f)).growX();
});
//minimap + position
parent.fill(t -> {
t.name = "minimap/position";
t.visible(() -> Core.settings.getBool("minimap") && !state.rules.tutorial && shown);
//minimap
t.add(new Minimap());
t.add(new Minimap()).name("minimap");
t.row();
//position
t.label(() -> player.tileX() + "," + player.tileY())
.visible(() -> Core.settings.getBool("position") && !state.rules.tutorial)
.touchable(Touchable.disabled);
.touchable(Touchable.disabled)
.name("position");
t.top().right();
});
@@ -125,15 +128,18 @@ public class HudFragment extends Fragment{
if(mobile){
cont.table(select -> {
select.name = "mobile buttons";
select.left();
select.defaults().size(dsize).left();
ImageButtonStyle style = Styles.clearTransi;
select.button(Icon.menu, style, ui.paused::show);
select.button(Icon.menu, style, ui.paused::show).name("menu");
flip = select.button(Icon.upOpen, style, this::toggleMenus).get();
flip.name = "flip";
select.button(Icon.paste, style, ui.schematics::show);
select.button(Icon.paste, style, ui.schematics::show)
.name("schematics");
select.button(Icon.pause, style, () -> {
if(net.active()){
@@ -162,7 +168,7 @@ public class HudFragment extends Fragment{
}else{
ui.database.show();
}
}).update(i -> {
}).name("chat").update(i -> {
if(net.active() && mobile){
i.getStyle().imageUp = Icon.chat;
}else if(state.isCampaign()){
@@ -188,14 +194,15 @@ public class HudFragment extends Fragment{
Table wavesMain, editorMain;
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight());
cont.stack(wavesMain = new Table(), editorMain = new Table()).height(wavesMain.getPrefHeight())
.name("waves/editor");
wavesMain.visible(() -> shown && !state.isEditor());
wavesMain.top().left();
wavesMain.top().left().name = "waves";
wavesMain.table(s -> {
//wave info button with text
s.add(makeStatusTable()).grow();
s.add(makeStatusTable()).grow().name("status");
//table with button to skip wave
s.button(Icon.play, Styles.righti, 30f, () -> {
@@ -204,18 +211,22 @@ public class HudFragment extends Fragment{
}else{
logic.skipWave();
}
}).growY().fillX().right().width(40f).disabled(b -> !canSkipWave()).visible(() -> state.rules.waves);
}).growY().fillX().right().width(40f).disabled(b -> !canSkipWave())
.visible(() -> state.rules.waves).name("skip");
}).width(dsize * 5 + 4f);
wavesMain.row();
wavesMain.table(Tex.button, t -> t.margin(10f).add(new Bar("boss.health", Pal.health, () -> state.boss() == null ? 0f : state.boss().healthf()).blink(Color.white))
.grow()).fillX().visible(() -> state.rules.waves && state.boss() != null).height(60f).get();
.grow()).fillX().visible(() -> state.rules.waves && state.boss() != null).height(60f).get()
.name = "boss";
wavesMain.row();
editorMain.name = "editor";
editorMain.table(Tex.buttonEdge4, t -> {
//t.margin(0f);
t.name = "teams";
t.add("@editor.teams").growX().left();
t.row();
t.table(teams -> {
@@ -236,29 +247,33 @@ public class HudFragment extends Fragment{
}).width(dsize * 5 + 4f);
editorMain.visible(() -> shown && state.isEditor());
//fps display
cont.table(info -> {
info.name = "fps/ping";
info.touchable = Touchable.disabled;
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps") && shown);
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Scl.scl(dsize * 4 + 3), 0));
IntFormat fps = new IntFormat("fps");
IntFormat ping = new IntFormat("ping");
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).left().style(Styles.outlineLabel);
info.label(() -> fps.get(Core.graphics.getFramesPerSecond())).left()
.style(Styles.outlineLabel).name("fps");
info.row();
info.label(() -> ping.get(netClient.getPing())).visible(net::client).left().style(Styles.outlineLabel);
info.label(() -> ping.get(netClient.getPing())).visible(net::client).left()
.style(Styles.outlineLabel).name("ping");
}).top().left();
});
//core items
parent.fill(t -> {
t.name = "coreitems";
t.top().add(coreItems);
t.visible(() -> Core.settings.getBool("coreitems") && !mobile && !state.isPaused() && shown);
});
//spawner warning
parent.fill(t -> {
t.name = "nearpoint";
t.touchable = Touchable.disabled;
t.table(Styles.black, c -> c.add("@nearpoint")
.update(l -> l.setColor(Tmp.c1.set(Color.white).lerp(Color.scarlet, Mathf.absin(Time.time(), 10f, 1f))))
@@ -267,12 +282,14 @@ public class HudFragment extends Fragment{
});
parent.fill(t -> {
t.name = "waiting";
t.visible(() -> netServer.isWaitingForPlayers());
t.table(Tex.button, c -> c.add("@waiting.players"));
});
//'core is under attack' table
parent.fill(t -> {
t.name = "coreattack";
t.touchable = Touchable.disabled;
float notifDuration = 240f;
float[] coreAttackTime = {0};
@@ -306,6 +323,7 @@ public class HudFragment extends Fragment{
//tutorial text
parent.fill(t -> {
t.name = "tutorial";
Runnable resize = () -> {
t.clearChildren();
t.top().right().visible(() -> state.rules.tutorial);
@@ -328,11 +346,13 @@ public class HudFragment extends Fragment{
//'saving' indicator
parent.fill(t -> {
t.name = "saving";
t.bottom().visible(() -> control.saves.isSaving());
t.add("@saving").style(Styles.outlineLabel);
});
parent.fill(p -> {
p.name = "hudtext";
p.top().table(Styles.black3, t -> t.margin(4).label(() -> hudText)
.style(Styles.outlineLabel)).padTop(10).visible(p.color.a >= 0.001f);
p.update(() -> {
@@ -348,6 +368,7 @@ public class HudFragment extends Fragment{
//TODO DEBUG: rate table
if(false)
parent.fill(t -> {
t.name = "rates";
t.bottom().left();
t.table(Styles.black6, c -> {
Bits used = new Bits(content.items().size);