Finished new menu layout, added submenu for playing

This commit is contained in:
Anuken 2018-03-16 19:36:44 -04:00
parent ac4369ce3b
commit 5846af9453
6 changed files with 86 additions and 34 deletions

View File

@ -1,4 +1,5 @@
text.about=Created by [ROYAL]Anuken.[]\nOriginally an entry in the [orange]GDL[] MM Jam.\n\nCredits:\n- SFX made with [YELLOW]bfxr[]\n- Music made by [GREEN]RoccoW[] / found on [lime]FreeMusicArchive.org[]\n\nSpecial thanks to:\n- [coral]MitchellFJN[]: extensive playtesting and feedback\n- [sky]Luxray5474[]: wiki work, code contributions\n- [lime]Epowerj[]: code build system, icon\n- All the beta testers on itch.io and Google Play\n
text.about=Created by [ROYAL]Anuken[] - [SKY]anukendev@gmail.com[]\nOriginally an entry in the [orange]GDL[] Metal Monstrosity Jam.\n\nCredits:\n- SFX made with [YELLOW]bfxr[]\n- Music made by [GREEN]RoccoW[] / found on [lime]FreeMusicArchive.org[]\n\nSpecial thanks to:\n- [coral]MitchellFJN[]: extensive playtesting and feedback\n- [sky]Luxray5474[]: wiki work, code contributions\n- [lime]Epowerj[]: code build system, icon\n- All the beta testers on itch.io and Google Play\n
text.credits=Credits
text.discord=Join the mindustry discord!
text.changes=[SCARLET]Attention!\n[]Some important game mechanics have been changed.\n\n- [accent]Teleporters[] now use power.\n- [accent]Smelteries[] and [accent]crucibles[] now have a maximum item capacity.\n- [accent]Crucibles[] now require coal as fuel.
text.link.discord.description=the official Mindustry discord chatroom
@ -9,6 +10,8 @@ text.link.itch.io.description=itch.io page with PC downloads and web version
text.link.google-play.description=Google Play store listing
text.link.wiki.description=official Mindustry wiki
text.linkfail=Failed to open link!\nThe URL has been copied to your cliboard.
text.editor.web=The web version does not support the editor!\nDownload the game to use it.
text.multiplayer.web=This version of the game does not support multiplayer!\nTo play multiplayer from your browser, use the "multiplayer web version" link at the itch.io page.
text.gameover=The core was destroyed.
text.highscore=[YELLOW]New highscore!
text.lasted=You lasted until wave
@ -20,6 +23,7 @@ text.level.mode=Gamemode:
text.savegame=Save Game
text.loadgame=Load Game
text.joingame=Join Game
text.newgame=New Game
text.quit=Quit
text.about.button=About
text.name=Name:

View File

@ -1,5 +1,5 @@
#Autogenerated file. Do not modify.
#Fri Mar 16 16:59:13 EDT 2018
#Fri Mar 16 19:36:00 EDT 2018
version=release
androidBuildCode=443
name=Mindustry

View File

@ -6,12 +6,12 @@ import io.anuke.ucore.util.Bundles;
public class Links {
private static final LinkEntry[] links = {
new LinkEntry("discord", "https://discord.gg/BKADYds", Color.valueOf("7289da")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://github.com/Anuken/Mindustry/wiki", Color.valueOf("fafbfc")),
new LinkEntry("trello", "https://trello.com/b/aE2tcUwF", Color.valueOf("026aa7")),
new LinkEntry("wiki", "http://mindustry.wikia.com/wiki/Mindustry_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("wiki", "http://mindustry.wikia.com/wiki/Mindustry_Wiki", Color.valueOf("0f142f")),
new LinkEntry("github", "https://github.com/Anuken/Mindustry/", Color.valueOf("24292e")),
new LinkEntry("dev-builds", "https://github.com/Anuken/Mindustry/wiki", Color.valueOf("fafbfc")),
};
public static LinkEntry[] getLinks(){

View File

@ -1,11 +1,16 @@
package io.anuke.mindustry.ui;
import com.badlogic.gdx.graphics.Color;
import io.anuke.ucore.function.Listenable;
import io.anuke.ucore.scene.ui.TextButton;
public class MenuButton extends TextButton{
public MenuButton(String icon, String text, Listenable clicked){
this(icon, text, null, clicked);
}
public MenuButton(String icon, String text, String description, Listenable clicked){
super("default");
float s = 70f;
@ -20,6 +25,13 @@ public class MenuButton extends TextButton{
t.update(() -> t.setBackground(getClickListener().isOver() || getClickListener().isVisualPressed() ? "button-over" : "button"));
}).size(s - 5, s);
add(text).padLeft(5).growX();
table(t -> {
t.add(text);
if(description != null){
t.row();
t.add(description).color(Color.LIGHT_GRAY);
}
}).padLeft(5).growX();
}
}

View File

@ -52,5 +52,14 @@ public class AboutDialog extends FloatingDialog {
}
content().add(pane).growX();
buttons().addButton("$text.credits", this::showCredits).size(200f, 64f);
}
private void showCredits(){
FloatingDialog dialog = new FloatingDialog("$text.credits");
dialog.addCloseButton();
dialog.content().add("$text.about");
dialog.show();
}
}

View File

@ -5,6 +5,7 @@ import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.io.Platform;
import io.anuke.mindustry.io.Version;
import io.anuke.mindustry.ui.MenuButton;
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.ucore.scene.builders.imagebutton;
import io.anuke.ucore.scene.builders.label;
import io.anuke.ucore.scene.builders.table;
@ -25,23 +26,17 @@ public class MenuFragment implements Fragment{
defaults().size(w, 70f).padTop(5).padRight(5);
add(new MenuButton("icon-play-2", "$text.play", ui.levels::show)).width(bw).colspan(2);
add(new MenuButton("icon-play-2", "$text.play", MenuFragment.this::showPlaySelect)).width(bw).colspan(2);
row();
//TODO submenu!
/*if(Platform.instance.canJoinGame()) {
add(new MenuButton("icon-add", "$text.joingame", ui.join::show));
row();
}
add(new MenuButton("icon-tutorial", "$text.tutorial", ()-> control.playMap(world.maps().getMap("tutorial"))));
add(new MenuButton("icon-load", "$text.loadgame", ui.load::show));
*/
add(new MenuButton("icon-editor", "$text.editor", ui.editor::show));
add(new MenuButton("icon-editor", "$text.editor", () -> {
if(gwt){
ui.showInfo("$text.editor.web");
}else{
ui.editor.show();
}
}));
add(new MenuButton("icon-tools", "$text.settings", ui.settings::show));
@ -85,19 +80,14 @@ public class MenuFragment implements Fragment{
}}.end();
}
}}.end();
//extra icons in top right
new table(){{
abottom().atop().aright();
get().addButton("", "discord", ui.discord::show);
//if(Platform.instance.hasDiscord()){
// new imagebutton("icon-discord", 30f, ui.discord::show).margin(14);
//}
//if(!Vars.android) {
// new imagebutton("icon-info", 30f, ui.about::show).margin(14);
//}
//new imagebutton("icon-menu", 30f, ui.changelog::show).margin(14);
}}.end().visible(()->state.is(State.menu));
//discord icon in top right
if(Platform.instance.hasDiscord()) {
new table() {{
abottom().atop().aright();
get().addButton("", "discord", ui.discord::show);
}}.end().visible(() -> state.is(State.menu));
}
//version info
new table(){{
@ -106,4 +96,41 @@ public class MenuFragment implements Fragment{
new label("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName);
}}.end();
}
private void showPlaySelect(){
float w = 200f;
float bw = w * 2f + 10f;
FloatingDialog dialog = new FloatingDialog("$text.play");
dialog.addCloseButton();
dialog.content().defaults().height(70f).width(w).padRight(5f);
dialog.content().add(new MenuButton("icon-play-2", "$text.newgame", () -> {
dialog.hide();
ui.levels.show();
})).width(bw).colspan(2);
dialog.content().row();
dialog.content().add(new MenuButton("icon-add", "$text.joingame", () -> {
if(Platform.instance.canJoinGame()){
ui.join.show();
dialog.hide();
}else{
ui.showInfo("$text.multiplayer.web");
}
}));
dialog.content().add(new MenuButton("icon-tutorial", "$text.tutorial", ()-> {
control.playMap(world.maps().getMap("tutorial"));
dialog.hide();
}));
dialog.content().row();
dialog.content().add(new MenuButton("icon-load", "$text.loadgame", () -> {
ui.load.show();
dialog.hide();
})).width(bw).colspan(2);
dialog.show();
}
}