Added version display, info dialog back

This commit is contained in:
Anuken 2019-07-05 13:41:22 -04:00
parent f0959ab356
commit d2bb3800e3
20 changed files with 472 additions and 434 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

View file

@ -4,6 +4,7 @@ contributors = Translators and Contributors
discord = Join the Mindustry Discord!
link.discord.description = The official Mindustry Discord chatroom
link.github.description = Game source code
link.changelog.description = List of update changes
link.dev-builds.description = Unstable development builds
link.trello.description = Official Trello board for planned features
link.itch.io.description = itch.io page with PC downloads and web version

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Before After
Before After

View file

@ -224,6 +224,11 @@
up: flat,
over: flat-over
},
clear-trans: {
down: flat-down,
up: flat-trans,
over: flat-over
},
clear-toggle-trans: {
down: flat-down,
checked: flat-down,

View file

@ -52,7 +52,7 @@ public class Pal{
bar = Color.SLATE,
accent = Color.valueOf("ffd37f"),
stat = Color.valueOf("ffd37f"),
locked = Color.valueOf("454545"),
gray = Color.valueOf("454545"),
accentBack = Color.valueOf("d4816b"),
place = Color.valueOf("6335f8"),
remove = Color.valueOf("e55454"),

View file

@ -261,7 +261,7 @@ public class MobileInput extends InputHandler implements GestureListener{
@Override
public void buildUI(Table table){
table.addImage("blank").color(Pal.accent).height(3f).colspan(4).growX();
table.addImage("whiteui").color(Pal.gray).height(4f).colspan(4).growX();
table.row();
table.left().margin(0f).defaults().size(48f);

View file

@ -2,19 +2,21 @@ package io.anuke.mindustry.ui;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.graphics.Pal;
public class Links{
private static LinkEntry[] links;
private static void createLinks(){
links = new LinkEntry[]{
new LinkEntry("discord", "https://discord.gg/mindustry", Color.valueOf("7289da")),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Color.valueOf("0f142f")),
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://jenkins.hellomouse.net/job/mindustry/", Color.valueOf("fafbfc"))
new LinkEntry("discord", "https://discord.gg/mindustry", Color.valueOf("7289da")),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
new LinkEntry("wiki", "https://mindustrygame.github.io/wiki/", Color.valueOf("0f142f")),
new LinkEntry("itch.io", "https://anuke.itch.io/mindustry", Color.valueOf("fa5c5c")),
new LinkEntry("google-play", "https://play.google.com/store/apps/details?id=io.anuke.mindustry", Color.valueOf("689f38")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://jenkins.hellomouse.net/job/mindustry/", Color.valueOf("fafbfc")),
new LinkEntry("changelog", "https://github.com/Anuken/Mindustry/releases", Pal.accent.cpy())
};
}

View file

@ -80,10 +80,6 @@ public class AboutDialog extends FloatingDialog{
buttons.addButton("$credits", this::showCredits).size(200f, 64f);
if(!ios && !OS.isMac){
buttons.addButton("$changelog.title", ui.changelog::show).size(200f, 64f);
}
if(Core.graphics.isPortrait()){
for(Cell<?> cell : buttons.getCells()){
cell.width(140f);
@ -98,7 +94,7 @@ public class AboutDialog extends FloatingDialog{
dialog.cont.add("$credits.text");
dialog.cont.row();
if(!contributors.isEmpty()){
dialog.cont.addImage("blank").color(Pal.accent).fillX().height(3f).pad(3f);
dialog.cont.addImage("whiteui").color(Pal.accent).fillX().height(3f).pad(3f);
dialog.cont.row();
dialog.cont.add("$contributors");
dialog.cont.row();

View file

@ -4,14 +4,13 @@ import io.anuke.arc.Core;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.ObjectSet;
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.Lines;
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.layout.*;
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.core.GameState.State;
import io.anuke.mindustry.game.Saves.SaveSlot;
@ -58,10 +57,8 @@ public class DeployDialog extends FloatingDialog{
}
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();
@ -99,6 +96,8 @@ public class DeployDialog extends FloatingDialog{
});
}).fillX().height(50f).pad(3);
}));
}else{
stack.add(new View());
}
stack.add(new ItemsDisplay());
@ -174,7 +173,7 @@ public class DeployDialog extends FloatingDialog{
for(ZoneNode node : nodes){
for(ZoneNode child : node.allChildren){
Lines.stroke(Unit.dp.scl(3f), node.zone.locked() || child.zone.locked() ? Pal.locked : Pal.accent);
Lines.stroke(Unit.dp.scl(3f), node.zone.locked() || child.zone.locked() ? Pal.gray : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}
}

View file

@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.input.KeyCode;
import io.anuke.arc.scene.event.Touchable;
import io.anuke.arc.scene.ui.*;
import io.anuke.arc.scene.ui.layout.Table;
@ -20,7 +21,32 @@ public class MapsDialog extends FloatingDialog{
public MapsDialog(){
super("$maps");
addCloseButton();
buttons.remove();
keyDown(key -> {
if(key == KeyCode.ESCAPE || key == KeyCode.BACK){
Core.app.post(this::hide);
}
});
shown(this::setup);
onResize(() -> {
if(dialog != null){
dialog.hide();
}
setup();
});
}
void setup(){
buttons.clearChildren();
if(Core.graphics.isPortrait()){
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f*2f, 64f).colspan(2);
buttons.row();
}else{
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f, 64f);
}
buttons.addImageTextButton("$editor.newmap", "icon-add", iconsize, () -> {
ui.showTextInput("$editor.newmap", "$name", "", text -> {
@ -29,7 +55,7 @@ public class MapsDialog extends FloatingDialog{
ui.editor.editor.getTags().put("name", text);
});
});
}).size(230f, 64f);
}).size(210f, 64f);
buttons.addImageTextButton("$editor.importmap", "icon-load", iconsize, () -> {
Platform.instance.showFileChooser("$editor.importmap", "Map File", file -> {
@ -70,19 +96,8 @@ public class MapsDialog extends FloatingDialog{
});
}, true, FileChooser.anyMapFiles);
}).size(230f, 64f);
}).size(210f, 64f);
buttons.remove();
shown(this::setup);
onResize(() -> {
if(dialog != null){
dialog.hide();
}
});
}
void setup(){
cont.clear();
Table maps = new Table();

View file

@ -43,6 +43,8 @@ public class SettingsMenuDialog extends SettingsDialog{
wasPaused = state.is(State.paused);
state.set(State.paused);
}
rebuildMenu();
});
setFillParent(true);
@ -69,18 +71,7 @@ public class SettingsMenuDialog extends SettingsDialog{
prefs.top();
prefs.margin(14f);
String style = "clear";
menu.defaults().size(300f, 60f);
menu.addButton("$settings.game", style, () -> visible(0));
menu.row();
menu.addButton("$settings.graphics", style, () -> visible(1));
menu.row();
menu.addButton("$settings.sound", style, () -> visible(2));
menu.row();
menu.addButton("$settings.language", style, ui.language::show);
menu.row();
menu.addButton("$settings.controls", style, ui.controls::show).visible(() -> !mobile || Core.settings.getBool("keyboard"));
rebuildMenu();
prefs.clearChildren();
prefs.add(menu);
@ -116,6 +107,25 @@ public class SettingsMenuDialog extends SettingsDialog{
addSettings();
}
void rebuildMenu(){
menu.clearChildren();
String style = "clear";
menu.defaults().size(300f, 60f);
menu.addButton("$settings.game", style, () -> visible(0));
menu.row();
menu.addButton("$settings.graphics", style, () -> visible(1));
menu.row();
menu.addButton("$settings.sound", style, () -> visible(2));
menu.row();
menu.addButton("$settings.language", style, ui.language::show);
if(!mobile || Core.settings.getBool("keyboard")){
menu.row();
menu.addButton("$settings.controls", style, ui.controls::show);
}
}
void addSettings(){
//TODO add when sound works again
//sound.volumePrefs();
@ -239,6 +249,7 @@ public class SettingsMenuDialog extends SettingsDialog{
}
private void back(){
rebuildMenu();
prefs.clearChildren();
prefs.add(menu);
}

View file

@ -281,7 +281,7 @@ public class TechTreeDialog extends FloatingDialog{
if(mobile && locked(node)){
b.row();
b.addImageTextButton("$research", "icon-check", "node", iconsize, () -> unlock(node))
b.addImageTextButton("$research", "icon-check-small", "node", iconsizesmall, () -> unlock(node))
.disabled(i -> !data.hasItems(node.requirements)).growX().height(44f).colspan(3);
}
});
@ -306,7 +306,7 @@ public class TechTreeDialog extends FloatingDialog{
for(TechTreeNode child : node.children){
if(!child.visible) continue;
Lines.stroke(Unit.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.locked : Pal.accent);
Lines.stroke(Unit.dp.scl(4f), locked(node.node) || locked(child.node) ? Pal.gray : Pal.accent);
Lines.line(node.x + offsetX, node.y + offsetY, child.x + offsetX, child.y + offsetY);
}
}

View file

@ -68,10 +68,12 @@ public class HudFragment extends Fragment{
select.left();
select.defaults().size(dsize).left();
select.addImageButton("icon-menu-large", "clear", iconsize, ui.paused::show);
flip = select.addImageButton("icon-arrow-up", "clear", iconsize, this::toggleMenus).get();
String style = "clear-trans";
select.addImageButton("icon-pause", "clear", iconsize, () -> {
select.addImageButton("icon-menu-large", style, iconsize, ui.paused::show);
flip = select.addImageButton("icon-arrow-up", style, iconsize, this::toggleMenus).get();
select.addImageButton("icon-pause", style, iconsize, () -> {
if(Net.active()){
ui.listfrag.toggle();
}else{
@ -86,7 +88,7 @@ public class HudFragment extends Fragment{
}
}).get();
select.addImageButton("icon-settings", "clear", iconsize, () -> {
select.addImageButton("icon-settings", style, iconsize, () -> {
if(Net.active() && mobile){
if(ui.chatfrag.chatOpen()){
ui.chatfrag.hide();
@ -106,7 +108,7 @@ public class HudFragment extends Fragment{
}
}).get();
select.addImage("blank").color(Pal.accent).width(3f).fillY();
select.addImage("whiteui").color(Pal.gray).width(4f).fillY();
float size = Unit.dp.scl(dsize);
Array<Element> children = new Array<>(select.getChildren());
@ -120,7 +122,7 @@ public class HudFragment extends Fragment{
if(fi < 4){
elem.setSize(size);
}else{
elem.setSize(Unit.dp.scl(3f), size);
elem.setSize(Unit.dp.scl(4f), size);
}
elem.setPosition(fi * size, Core.graphics.getHeight(), Align.topLeft);
return true;
@ -131,7 +133,7 @@ public class HudFragment extends Fragment{
}
cont.row();
cont.addImage("blank").height(3f).color(Pal.accent).fillX();
cont.addImage("whiteui").height(4f).color(Pal.gray).fillX();
cont.row();
}
@ -164,7 +166,7 @@ public class HudFragment extends Fragment{
addWaveTable(waves);
addPlayButton(btable);
wavesMain.add(stack).width(dsize * 4 + 3f);
wavesMain.add(stack).width(dsize * 4 + 4f);
wavesMain.row();
wavesMain.table("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();
@ -244,7 +246,7 @@ public class HudFragment extends Fragment{
}
});
}
}).width(dsize * 4 + 3f);
}).width(dsize * 4 + 4f);
editorMain.visible(() -> shown && state.isEditor());
}

View file

@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.fragments;
import io.anuke.arc.Core;
import io.anuke.arc.Events;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.Texture;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Interpolation;
@ -14,10 +15,9 @@ import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.util.Align;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.EventType.ResizeEvent;
import io.anuke.mindustry.game.Version;
import io.anuke.mindustry.graphics.MenuRenderer;
import io.anuke.mindustry.ui.MenuButton;
import io.anuke.mindustry.ui.MobileButton;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import static io.anuke.mindustry.Vars.*;
@ -52,23 +52,24 @@ public class MenuFragment extends Fragment{
//.visible(() -> state.is(State.menu)));
//info icon
//if(mobile){
// parent.fill(c -> c.top().left().addButton("", "info", ui.about::show).size(84, 45)
// .visible(() -> state.is(State.menu)));
//}
if(mobile){
parent.fill(c -> c.bottom().left().addButton("", "info", ui.about::show).size(84, 45));
}
//version info
//parent.fill(c -> c.bottom().left().add(Strings.format("v{0} {1}-{2} {3}{4}", Version.number, Version.modifier, Version.type,
//(Version.build == -1 ? "custom build" : "build " + Version.build), Version.revision == 0 ? "" : "." + Version.revision)).color(Color.DARK_GRAY)
//.visible(() -> state.is(State.menu)));
String versionText = "[#ffffffba]" + ((Version.build == -1) ? "[#fc8140aa]custom build" : Version.modifier + " build " + Version.build);
parent.fill((x, y, w, h) -> {
float logoscl = (int)Unit.dp.scl(1);
float logow = Math.min(logo.getWidth() * logoscl, Core.graphics.getWidth() - Unit.dp.scl(20));
float logoh = logow * (float)logo.getHeight() / logo.getWidth();
float fx = (int)(Core.graphics.getWidth() / 2f);
float fy = (int)(Core.graphics.getHeight() - 6 - logoh) + logoh / 2 - (Core.graphics.isPortrait() ? Unit.dp.scl(30f) : 0f);
Draw.color();
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);
Draw.rect(Draw.wrap(logo), fx, fy, logow, logoh);
Core.scene.skin.font().setColor(Color.WHITE);
Core.scene.skin.font().draw(versionText, fx, fy - logoh/2f, Align.center);
}).touchable(Touchable.disabled);
}
@ -82,7 +83,7 @@ public class MenuFragment extends Fragment{
MobileButton
play = new MobileButton("icon-play-2", isize, "$campaign", ui.deploy::show),
custom = new MobileButton("icon-play-custom", isize, "$customgame", this::showCustomSelect),
custom = new MobileButton("icon-play-custom", isize, "$customgame", ui.custom::show),
maps = new MobileButton("icon-load", isize, "$loadgame", ui.load::show),
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
editor = new MobileButton("icon-editor", isize, "$editor", ui.maps::show),
@ -91,6 +92,7 @@ public class MenuFragment extends Fragment{
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());
if(!Core.graphics.isPortrait()){
container.marginTop(60f);
container.add(play);
container.add(join);
container.add(custom);
@ -107,6 +109,7 @@ public class MenuFragment extends Fragment{
table.add(exit);
}).colspan(4);
}else{
container.marginTop(0f);
container.add(play);
container.add(maps);
container.row();
@ -147,8 +150,8 @@ public class MenuFragment extends Fragment{
new Buttoni("$loadgame", "icon-load", ui.load::show)
),
new Buttoni("$editor", "icon-editor", ui.maps::show),
new Buttoni("$settings", "icon-tools", ui.settings::show), //todo submenu
new Buttoni("$about.button", "icon-info", ui.about::show), //todo submenu
new Buttoni("$settings", "icon-tools", ui.settings::show),
new Buttoni("$about.button", "icon-info", ui.about::show),
new Buttoni("$quit", "icon-exit", Core.app::exit)
);
@ -208,23 +211,6 @@ public class MenuFragment extends Fragment{
}
}
private void showCustomSelect(){
FloatingDialog dialog = new FloatingDialog("$play");
dialog.setFillParent(false);
dialog.addCloseButton();
dialog.cont.defaults().size(210f, 64f);
dialog.cont.add(new MenuButton("icon-editor", "$newgame", () -> {
dialog.hide();
ui.custom.show();
}));
dialog.cont.row();
dialog.cont.add(new MenuButton("icon-load", "$loadgame", () -> {
ui.load.show();
dialog.hide();
}));
dialog.show();
}
private class Buttoni{
final String icon;
final String text;

View file

@ -245,7 +245,7 @@ public class PlacementFragment extends Fragment{
});
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
frame.row();
frame.addImage("blank").color(Pal.locked).colspan(3).height(4).growX();
frame.addImage("whiteui").color(Pal.gray).colspan(3).height(4).growX();
frame.row();
frame.table("pane-2", blocksSelect -> {
blocksSelect.margin(4).marginTop(0);

View file

@ -135,7 +135,7 @@ public class PlayerListFragment extends Fragment{
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
content.row();
content.addImage("blank").height(3f).color(state.rules.pvp ? user.getTeam().color : Pal.accent).growX();
content.addImage("whiteui").height(3f).color(state.rules.pvp ? user.getTeam().color : Pal.accent).growX();
content.row();
});