More UI and layout changes

This commit is contained in:
Anuken
2019-07-05 12:02:02 -04:00
parent 2c5546c6fb
commit f0959ab356
9 changed files with 50 additions and 60 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -112,7 +112,7 @@
}, },
clear-partial: { clear-partial: {
down: whiteui, down: whiteui,
up: button-select, up: pane,
over: flat-down, over: flat-down,
font: default-font, font: default-font,
fontColor: white, fontColor: white,
@@ -210,7 +210,7 @@
}, },
clear-full: { clear-full: {
down: whiteui, down: whiteui,
up: button-select, up: pane,
over: flat-down over: flat-down
}, },
clear-partial: { clear-partial: {

View File

@@ -37,7 +37,6 @@ public class UI implements ApplicationListener{
public HudFragment hudfrag; public HudFragment hudfrag;
public ChatFragment chatfrag; public ChatFragment chatfrag;
public PlayerListFragment listfrag; public PlayerListFragment listfrag;
public BackgroundFragment backfrag;
public LoadingFragment loadfrag; public LoadingFragment loadfrag;
public WidgetGroup menuGroup, hudGroup; public WidgetGroup menuGroup, hudGroup;
@@ -159,7 +158,6 @@ public class UI implements ApplicationListener{
hudfrag = new HudFragment(); hudfrag = new HudFragment();
chatfrag = new ChatFragment(); chatfrag = new ChatFragment();
listfrag = new PlayerListFragment(); listfrag = new PlayerListFragment();
backfrag = new BackgroundFragment();
loadfrag = new LoadingFragment(); loadfrag = new LoadingFragment();
editor = new MapEditorDialog(); editor = new MapEditorDialog();
@@ -197,7 +195,6 @@ public class UI implements ApplicationListener{
Core.scene.add(menuGroup); Core.scene.add(menuGroup);
Core.scene.add(hudGroup); Core.scene.add(hudGroup);
// backfrag.build(group);
control.input().getFrag().build(hudGroup); control.input().getFrag().build(hudGroup);
hudfrag.build(hudGroup); hudfrag.build(hudGroup);
menufrag.build(menuGroup); menufrag.build(menuGroup);

View File

@@ -26,7 +26,7 @@ public class ItemsDisplay extends Table{
top().left(); top().left();
margin(0); margin(0);
table("flat", t -> { table("button", t -> {
t.margin(10).marginLeft(15).marginTop(15f); t.margin(10).marginLeft(15).marginTop(15f);
t.add("$launcheditems").colspan(3).left().padBottom(5); t.add("$launcheditems").colspan(3).left().padBottom(5);
t.row(); t.row();

View File

@@ -4,14 +4,14 @@ import io.anuke.arc.Core;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet; import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.collection.ObjectSet.ObjectSetIterator; import io.anuke.arc.collection.ObjectSet.ObjectSetIterator;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines; import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.scene.Group; import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.ui.Image;
import io.anuke.arc.scene.ui.TextButton; import io.anuke.arc.scene.ui.TextButton;
import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.scene.ui.layout.*;
import io.anuke.arc.scene.ui.layout.Unit; import io.anuke.arc.util.*;
import io.anuke.arc.util.Align;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.Zones; import io.anuke.mindustry.content.Zones;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Saves.SaveSlot; import io.anuke.mindustry.game.Saves.SaveSlot;
@@ -57,13 +57,15 @@ public class DeployDialog extends FloatingDialog{
Core.settings.save(); Core.settings.save();
} }
cont.stack(control.saves.getZoneSlot() == null ? new View() : new Table(){{ Stack stack = new Stack();
stack.add(new View());
if(control.saves.getZoneSlot() != null){
stack.add(new Image("whiteui", new Color(0f, 0f, 0f, 0.9f)));
stack.add(new Table(t -> {
SaveSlot slot = control.saves.getZoneSlot(); SaveSlot slot = control.saves.getZoneSlot();
TextButton[] b = {null}; TextButton button = t.addButton(Core.bundle.format("resume", slot.getZone().localizedName()), () -> {
TextButton button = addButton(Core.bundle.format("resume", slot.getZone().localizedName()), () -> {
if(b[0].childrenPressed()) return;
hide(); hide();
ui.loadAnd(() -> { ui.loadAnd(() -> {
@@ -78,7 +80,6 @@ public class DeployDialog extends FloatingDialog{
} }
}); });
}).size(230f).get(); }).size(230f).get();
b[0] = button;
String color = "[lightgray]"; String color = "[lightgray]";
@@ -89,16 +90,20 @@ public class DeployDialog extends FloatingDialog{
button.label(() -> Core.bundle.format("save.playtime", color + slot.getPlayTime())); button.label(() -> Core.bundle.format("save.playtime", color + slot.getPlayTime()));
button.row(); button.row();
row(); t.row();
addButton("$abandon", () -> { t.addButton("$abandon", () -> {
ui.showConfirm("$warning", "$abandon.text", () -> { ui.showConfirm("$warning", "$abandon.text", () -> {
slot.delete(); slot.delete();
setup(); setup();
}); });
}).fillX().height(50f).pad(3); }).fillX().height(50f).pad(3);
}));
}
}}, new ItemsDisplay()).grow(); stack.add(new ItemsDisplay());
cont.add(stack).grow();
//set up direct and indirect children //set up direct and indirect children
for(ZoneNode node : nodes){ for(ZoneNode node : nodes){

View File

@@ -1,12 +0,0 @@
package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.scene.Group;
public class BackgroundFragment extends Fragment{
@Override
public void build(Group parent){
}
}

View File

@@ -68,7 +68,7 @@ public class MenuFragment extends Fragment{
float logoh = logow * (float)logo.getHeight() / logo.getWidth(); float logoh = logow * (float)logo.getHeight() / logo.getWidth();
Draw.color(); Draw.color();
Draw.rect(Draw.wrap(logo), (int)(Core.graphics.getWidth() / 2), (int)(Core.graphics.getHeight() - 10 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Unit.dp.scl(30f) : 0f), logow, logoh); Draw.rect(Draw.wrap(logo), (Core.graphics.getWidth() / 2), (int)(Core.graphics.getHeight() - 10 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Unit.dp.scl(30f) : 0f), logow, logoh);
}).touchable(Touchable.disabled); }).touchable(Touchable.disabled);
} }
@@ -81,11 +81,11 @@ public class MenuFragment extends Fragment{
container.defaults().size(size).pad(5).padTop(4f); container.defaults().size(size).pad(5).padTop(4f);
MobileButton MobileButton
play = new MobileButton("icon-play-2", isize, "$play", ui.deploy::show), play = new MobileButton("icon-play-2", isize, "$campaign", ui.deploy::show),
maps = new MobileButton("icon-map", isize, "$maps", ui.maps::show),
custom = new MobileButton("icon-play-custom", isize, "$customgame", this::showCustomSelect), custom = new MobileButton("icon-play-custom", isize, "$customgame", this::showCustomSelect),
maps = new MobileButton("icon-load", isize, "$loadgame", ui.load::show),
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show), join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)), editor = new MobileButton("icon-editor", isize, "$editor", ui.maps::show),
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show), tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL)), donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL)),
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit()); exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());