Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0
@@ -25,7 +25,7 @@ allprojects {
|
|||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = '0176aaa'
|
uCoreVersion = '872bce6'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 59 KiB |
BIN
core/assets-raw/sprites/ui/discord-banner-over.png
Normal file
|
After Width: | Height: | Size: 341 B |
BIN
core/assets-raw/sprites/ui/discord-banner.png
Normal file
|
After Width: | Height: | Size: 341 B |
BIN
core/assets-raw/sprites/ui/icons/icon-dev-builds.png
Normal file
|
After Width: | Height: | Size: 196 B |
BIN
core/assets-raw/sprites/ui/icons/icon-exit.png
Normal file
|
After Width: | Height: | Size: 186 B |
BIN
core/assets-raw/sprites/ui/icons/icon-github.png
Normal file
|
After Width: | Height: | Size: 204 B |
BIN
core/assets-raw/sprites/ui/icons/icon-google-play.png
Normal file
|
After Width: | Height: | Size: 187 B |
BIN
core/assets-raw/sprites/ui/icons/icon-itch.io.png
Normal file
|
After Width: | Height: | Size: 198 B |
BIN
core/assets-raw/sprites/ui/icons/icon-link.png
Normal file
|
After Width: | Height: | Size: 195 B |
BIN
core/assets-raw/sprites/ui/icons/icon-trello.png
Normal file
|
After Width: | Height: | Size: 171 B |
BIN
core/assets-raw/sprites/ui/icons/icon-wiki.png
Normal file
|
After Width: | Height: | Size: 174 B |
@@ -1,6 +1,17 @@
|
|||||||
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.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.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
|
||||||
|
text.link.github.description=Game source code
|
||||||
|
text.link.dev-builds.description=Unstable development builds
|
||||||
|
text.link.trello.description=Official trello board for planned features
|
||||||
|
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.gameover=The core was destroyed.
|
||||||
text.highscore=[YELLOW]New highscore!
|
text.highscore=[YELLOW]New highscore!
|
||||||
text.lasted=You lasted until wave
|
text.lasted=You lasted until wave
|
||||||
@@ -12,6 +23,7 @@ text.level.mode=Gamemode:
|
|||||||
text.savegame=Save Game
|
text.savegame=Save Game
|
||||||
text.loadgame=Load Game
|
text.loadgame=Load Game
|
||||||
text.joingame=Join Game
|
text.joingame=Join Game
|
||||||
|
text.newgame=New Game
|
||||||
text.quit=Quit
|
text.quit=Quit
|
||||||
text.about.button=About
|
text.about.button=About
|
||||||
text.name=Name:
|
text.name=Name:
|
||||||
@@ -113,6 +125,7 @@ text.ok=OK
|
|||||||
text.open=Open
|
text.open=Open
|
||||||
text.cancel=Cancel
|
text.cancel=Cancel
|
||||||
text.openlink=Open Link
|
text.openlink=Open Link
|
||||||
|
text.copylink=Copy Link
|
||||||
text.back=Back
|
text.back=Back
|
||||||
text.quit.confirm=Are you sure you want to quit?
|
text.quit.confirm=Are you sure you want to quit?
|
||||||
text.changelog.title=Changelog
|
text.changelog.title=Changelog
|
||||||
@@ -339,9 +352,13 @@ keybind.weapon_3.name=weapon_3
|
|||||||
keybind.weapon_4.name=weapon_4
|
keybind.weapon_4.name=weapon_4
|
||||||
keybind.weapon_5.name=weapon_5
|
keybind.weapon_5.name=weapon_5
|
||||||
keybind.weapon_6.name=weapon_6
|
keybind.weapon_6.name=weapon_6
|
||||||
|
mode.text.help.title=Description of modes
|
||||||
mode.waves.name=waves
|
mode.waves.name=waves
|
||||||
|
mode.waves.description=the normal mode. limited resources and automatic incoming waves.
|
||||||
mode.sandbox.name=sandbox
|
mode.sandbox.name=sandbox
|
||||||
|
mode.sandbox.description=infinite resources and no timer for waves.
|
||||||
mode.freebuild.name=freebuild
|
mode.freebuild.name=freebuild
|
||||||
|
mode.freebuild.description=limited resources and no timer for waves.
|
||||||
upgrade.standard-mech.name=standard
|
upgrade.standard-mech.name=standard
|
||||||
upgrade.standard-mech.description=The standard mech.
|
upgrade.standard-mech.description=The standard mech.
|
||||||
upgrade.standard-ship.name=standard ship
|
upgrade.standard-ship.name=standard ship
|
||||||
|
|||||||
BIN
core/assets/cursors/cursor.png
Normal file
|
After Width: | Height: | Size: 201 B |
BIN
core/assets/cursors/hand.png
Normal file
|
After Width: | Height: | Size: 276 B |
BIN
core/assets/cursors/ibar.png
Normal file
|
After Width: | Height: | Size: 196 B |
@@ -52,6 +52,7 @@ io.anuke.ucore.scene.ui.Button$ButtonStyle: {
|
|||||||
},
|
},
|
||||||
io.anuke.ucore.scene.ui.TextButton$TextButtonStyle: {
|
io.anuke.ucore.scene.ui.TextButton$TextButtonStyle: {
|
||||||
default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: grey, down: button-down, up: button, transition: 0 },
|
default: {over: button-over, disabled: button, font: default-font, fontColor: white, disabledFontColor: grey, down: button-down, up: button, transition: 0 },
|
||||||
|
discord: {over: discord-banner-over, font: default-font, fontColor: white, up: discord-banner},
|
||||||
clear: {down: clear-down, up: clear, over: clear-over, font: default-font, fontColor: white, disabledFontColor: grey },
|
clear: {down: clear-down, up: clear, over: clear-over, font: default-font, fontColor: white, disabledFontColor: grey },
|
||||||
empty: {font: default-font},
|
empty: {font: default-font},
|
||||||
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: grey }
|
toggle: {font: default-font, fontColor: white, checked: button-down, down: button-down, up: button, over: button-over, disabled: button, disabledFontColor: grey }
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class Vars{
|
|||||||
public static float fontscale = Math.max(Unit.dp.scl(1f)/2f, 0.5f);
|
public static float fontscale = Math.max(Unit.dp.scl(1f)/2f, 0.5f);
|
||||||
//camera zoom displayed on startup
|
//camera zoom displayed on startup
|
||||||
public static final int baseCameraScale = Math.round(Unit.dp.scl(4));
|
public static final int baseCameraScale = Math.round(Unit.dp.scl(4));
|
||||||
//how much the zoom changes every zoom button press
|
//how much the zoom changes every zoom button press (unused?)
|
||||||
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
public static final int zoomScale = Math.round(Unit.dp.scl(1));
|
||||||
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
|
||||||
public static boolean debug = false;
|
public static boolean debug = false;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ import io.anuke.ucore.function.Callable;
|
|||||||
import io.anuke.ucore.graphics.*;
|
import io.anuke.ucore.graphics.*;
|
||||||
import io.anuke.ucore.modules.RendererModule;
|
import io.anuke.ucore.modules.RendererModule;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
|
import io.anuke.ucore.scene.utils.Cursors;
|
||||||
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Tmp;
|
import io.anuke.ucore.util.Tmp;
|
||||||
|
|
||||||
@@ -69,6 +71,12 @@ public class Renderer extends RendererModule{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cursors.cursorScaling = 3;
|
||||||
|
Cursors.outlineColor = Color.valueOf("444444");
|
||||||
|
Cursors.arrow = Cursors.loadCursor("cursor");
|
||||||
|
Cursors.hand = Cursors.loadCursor("hand");
|
||||||
|
Cursors.ibeam = Cursors.loadCursor("ibar");
|
||||||
|
|
||||||
clearColor = Hue.lightness(0.4f);
|
clearColor = Hue.lightness(0.4f);
|
||||||
clearColor.a = 1f;
|
clearColor.a = 1f;
|
||||||
|
|
||||||
@@ -426,7 +434,8 @@ public class Renderer extends RendererModule{
|
|||||||
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || android)
|
if((input.recipe != null && state.inventory.hasItems(input.recipe.requirements) && (!ui.hasMouse() || android)
|
||||||
&& control.input().drawPlace())){
|
&& control.input().drawPlace())){
|
||||||
|
|
||||||
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(), control.input().getBlockEndX(), control.input().getBlockEndY());
|
input.placeMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||||
|
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||||
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
Draw.color(Color.SCARLET);
|
Draw.color(Color.SCARLET);
|
||||||
@@ -442,9 +451,15 @@ public class Renderer extends RendererModule{
|
|||||||
if(input.breakMode == PlaceMode.holdDelete)
|
if(input.breakMode == PlaceMode.holdDelete)
|
||||||
input.breakMode.draw(tilex, tiley, 0, 0);
|
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||||
|
|
||||||
}else if(input.breakMode.delete && control.input().drawPlace() && input.recipe == null){
|
}else if(input.breakMode.delete && control.input().drawPlace()
|
||||||
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
&& (input.recipe == null || !state.inventory.hasItems(input.recipe.requirements))
|
||||||
control.input().getBlockEndX(), control.input().getBlockEndY());
|
&& (input.placeMode.delete || input.breakMode.both || !android)){
|
||||||
|
|
||||||
|
if(input.breakMode == PlaceMode.holdDelete)
|
||||||
|
input.breakMode.draw(tilex, tiley, 0, 0);
|
||||||
|
else
|
||||||
|
input.breakMode.draw(control.input().getBlockX(), control.input().getBlockY(),
|
||||||
|
control.input().getBlockEndX(), control.input().getBlockEndY());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ui.toolfrag.confirming){
|
if(ui.toolfrag.confirming){
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ public enum GameMode{
|
|||||||
public boolean infiniteResources;
|
public boolean infiniteResources;
|
||||||
public boolean disableWaveTimer;
|
public boolean disableWaveTimer;
|
||||||
|
|
||||||
|
public String description(){
|
||||||
|
return Bundles.get("mode."+name()+".description");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return Bundles.get("mode."+name()+".name");
|
return Bundles.get("mode."+name()+".name");
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ public class AndroidInput extends InputHandler{
|
|||||||
public float lmousex, lmousey;
|
public float lmousex, lmousey;
|
||||||
public float mousex, mousey;
|
public float mousex, mousey;
|
||||||
public boolean brokeBlock = false;
|
public boolean brokeBlock = false;
|
||||||
|
public boolean placing = false;
|
||||||
|
|
||||||
private boolean enableHold = false;
|
private boolean enableHold = false;
|
||||||
private boolean placing = false;
|
|
||||||
private float warmup;
|
private float warmup;
|
||||||
private float warmupDelay = 20;
|
private float warmupDelay = 20;
|
||||||
|
|
||||||
@@ -48,6 +48,7 @@ public class AndroidInput extends InputHandler{
|
|||||||
}else if(pointer == 0 && !breakMode.pan && breaking() && drawPlace()){
|
}else if(pointer == 0 && !breakMode.pan && breaking() && drawPlace()){
|
||||||
breakMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
breakMode.released(getBlockX(), getBlockY(), getBlockEndX(), getBlockEndY());
|
||||||
}
|
}
|
||||||
|
|
||||||
placing = false;
|
placing = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GestureHandler extends GestureAdapter{
|
|||||||
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
if(control.showCursor() && !Inputs.keyDown("select")) return false;
|
||||||
|
|
||||||
if(!control.showCursor() && !(control.input().recipe != null
|
if(!control.showCursor() && !(control.input().recipe != null
|
||||||
&& state.inventory.hasItems(control.input().recipe.requirements) && control.input().placeMode.lockCamera) &&
|
&& control.input().placeMode.lockCamera) &&
|
||||||
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
!(control.input().recipe == null && control.input().breakMode.lockCamera)){
|
||||||
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
float dx = deltaX*Core.camera.zoom/Core.cameraScale, dy = deltaY*Core.camera.zoom/Core.cameraScale;
|
||||||
player.x -= dx;
|
player.x -= dx;
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ public enum PlaceMode{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void released(int tilex, int tiley, int endx, int endy){
|
public void released(int tilex, int tiley, int endx, int endy){
|
||||||
|
|
||||||
process(tilex, tiley, endx, endy);
|
process(tilex, tiley, endx, endy);
|
||||||
tilex = this.tilex; tiley = this.tiley;
|
tilex = this.tilex; tiley = this.tiley;
|
||||||
endx = this.endx; endy = this.endy;
|
endx = this.endx; endy = this.endy;
|
||||||
|
|||||||
32
core/src/io/anuke/mindustry/ui/Links.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
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("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("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(){
|
||||||
|
return links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class LinkEntry{
|
||||||
|
public final String name, description, link;
|
||||||
|
public final Color color;
|
||||||
|
|
||||||
|
public LinkEntry(String name, String link, Color color) {
|
||||||
|
this.name = name;
|
||||||
|
this.color = color;
|
||||||
|
this.description = Bundles.getNotNull("text.link." + name +".description");
|
||||||
|
this.link = link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,49 +1,37 @@
|
|||||||
package io.anuke.mindustry.ui;
|
package io.anuke.mindustry.ui;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
|
||||||
import io.anuke.ucore.core.Core;
|
|
||||||
import io.anuke.ucore.function.Listenable;
|
import io.anuke.ucore.function.Listenable;
|
||||||
import io.anuke.ucore.scene.ui.Button;
|
import io.anuke.ucore.scene.ui.TextButton;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
|
||||||
import io.anuke.ucore.util.Bundles;
|
|
||||||
|
|
||||||
public class MenuButton extends Button{
|
public class MenuButton extends TextButton{
|
||||||
private static boolean hasInvalid = false;
|
|
||||||
private String text;
|
public MenuButton(String icon, String text, Listenable clicked){
|
||||||
private boolean added = false;
|
this(icon, text, null, clicked);
|
||||||
|
|
||||||
public MenuButton(String text, PressGroup group, Listenable clicked){
|
|
||||||
super("menu");
|
|
||||||
this.text = text;
|
|
||||||
BitmapFont font = Core.skin.getFont("title");
|
|
||||||
for(char c : Bundles.get(text.substring(1)).toCharArray()){
|
|
||||||
if(!font.getData().hasGlyph(c)){
|
|
||||||
hasInvalid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clicked(clicked);
|
|
||||||
group.add(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MenuButton(String icon, String text, String description, Listenable clicked){
|
||||||
|
super("default");
|
||||||
|
float s = 70f;
|
||||||
|
|
||||||
@Override
|
clicked(clicked);
|
||||||
public void layout() {
|
|
||||||
super.layout();
|
|
||||||
if(added)
|
|
||||||
return;
|
|
||||||
added = true;
|
|
||||||
String style = "title";
|
|
||||||
float scale = 4f;
|
|
||||||
if(hasInvalid){
|
|
||||||
style = "default";
|
|
||||||
scale = Unit.dp.scl(1f);
|
|
||||||
}
|
|
||||||
add(text, style, scale).color(hasInvalid ? Color.DARK_GRAY : Color.WHITE);
|
|
||||||
|
|
||||||
if(hasInvalid){
|
clearChildren();
|
||||||
row();
|
|
||||||
add(text, style, scale).padTop(Unit.dp.scl(-Core.font.getData().lineHeight * scale * 2f - 4f)).color(Color.WHITE);
|
margin(0);
|
||||||
}
|
|
||||||
|
table(t -> {
|
||||||
|
t.addImage(icon).size(14*3);
|
||||||
|
t.update(() -> t.setBackground(getClickListener().isOver() || getClickListener().isVisualPressed() ? "button-over" : "button"));
|
||||||
|
}).size(s - 5, s);
|
||||||
|
|
||||||
|
|
||||||
|
table(t -> {
|
||||||
|
t.add(text);
|
||||||
|
if(description != null){
|
||||||
|
t.row();
|
||||||
|
t.add(description).color(Color.LIGHT_GRAY);
|
||||||
|
}
|
||||||
|
}).padLeft(5).growX();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,69 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.ui.Links;
|
||||||
|
import io.anuke.mindustry.ui.Links.LinkEntry;
|
||||||
|
import io.anuke.ucore.core.Core;
|
||||||
|
import io.anuke.ucore.core.Timers;
|
||||||
|
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||||
|
import io.anuke.ucore.scene.ui.layout.Table;
|
||||||
|
|
||||||
public class AboutDialog extends FloatingDialog {
|
public class AboutDialog extends FloatingDialog {
|
||||||
|
|
||||||
public AboutDialog(){
|
public AboutDialog(){
|
||||||
super("$text.about.button");
|
super("$text.about.button");
|
||||||
|
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
content().add("$text.about");
|
|
||||||
|
float h = 80f;
|
||||||
|
float w = 600f;
|
||||||
|
|
||||||
|
Table in = new Table();
|
||||||
|
ScrollPane pane = new ScrollPane(in, "clear");
|
||||||
|
|
||||||
|
for(LinkEntry link : Links.getLinks()){
|
||||||
|
Table table = new Table("button");
|
||||||
|
table.margin(0);
|
||||||
|
table.table(img -> {
|
||||||
|
img.addImage("white").height(h - 5).width(40f).color(link.color);
|
||||||
|
img.row();
|
||||||
|
img.addImage("white").height(5).width(40f).color(link.color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||||
|
}).expandY();
|
||||||
|
|
||||||
|
table.table(i -> {
|
||||||
|
i.background("button");
|
||||||
|
i.addImage("icon-" + link.name).size(14*3f);
|
||||||
|
}).size(h-5, h);
|
||||||
|
|
||||||
|
table.table(inset -> {
|
||||||
|
inset.add("[accent]"+link.name.replace("-", " ")).growX().left();
|
||||||
|
inset.row();
|
||||||
|
inset.labelWrap(link.description).width(w - 100f).color(Color.LIGHT_GRAY).growX();
|
||||||
|
}).padLeft(8);
|
||||||
|
|
||||||
|
table.addImageButton("icon-link", 14*3, () -> {
|
||||||
|
if(!Gdx.net.openURI(link.link)){
|
||||||
|
Vars.ui.showError("$text.linkfail");
|
||||||
|
Gdx.app.getClipboard().setContents(link.link);
|
||||||
|
}
|
||||||
|
}).size(h-5, h);
|
||||||
|
|
||||||
|
in.add(table).size(w, h).padTop(5).row();
|
||||||
|
}
|
||||||
|
|
||||||
|
shown(() -> Timers.run(1f, () -> Core.scene.setScrollFocus(pane)));
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,52 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import io.anuke.ucore.scene.ui.Dialog;
|
import io.anuke.ucore.scene.ui.Dialog;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.discordURL;
|
import static io.anuke.mindustry.Vars.discordURL;
|
||||||
|
import static io.anuke.mindustry.Vars.ui;
|
||||||
|
|
||||||
public class DiscordDialog extends Dialog {
|
public class DiscordDialog extends Dialog {
|
||||||
|
|
||||||
public DiscordDialog(){
|
public DiscordDialog(){
|
||||||
super("Discord", "dialog");
|
super("", "dialog");
|
||||||
|
|
||||||
|
float h = 70f;
|
||||||
|
|
||||||
content().margin(12f);
|
content().margin(12f);
|
||||||
content().add("$text.discord");
|
|
||||||
content().row();
|
Color color = Color.valueOf("7289da");
|
||||||
content().add("[orange]"+ discordURL);
|
|
||||||
buttons().defaults().size(200f, 50);
|
content().table(t -> {
|
||||||
buttons().addButton("$text.openlink", () -> Gdx.net.openURI(discordURL));
|
t.background("button").margin(0);
|
||||||
|
|
||||||
|
t.table(img -> {
|
||||||
|
img.addImage("white").height(h - 5).width(40f).color(color);
|
||||||
|
img.row();
|
||||||
|
img.addImage("white").height(5).width(40f).color(color.cpy().mul(0.8f, 0.8f, 0.8f, 1f));
|
||||||
|
}).expandY();
|
||||||
|
|
||||||
|
t.table(i -> {
|
||||||
|
i.background("button");
|
||||||
|
i.addImage("icon-discord").size(14 * 3);
|
||||||
|
}).size(h).left();
|
||||||
|
|
||||||
|
t.add("$text.discord").color(Colors.get("accent")).growX().padLeft(10f);
|
||||||
|
}).size(470f, h).pad(10f);
|
||||||
|
|
||||||
|
buttons().defaults().size(170f, 50);
|
||||||
|
|
||||||
buttons().addButton("$text.back", this::hide);
|
buttons().addButton("$text.back", this::hide);
|
||||||
|
buttons().addButton("$text.copylink", () ->{
|
||||||
|
Gdx.app.getClipboard().setContents(discordURL);
|
||||||
|
});
|
||||||
|
buttons().addButton("$text.openlink", () ->{
|
||||||
|
if(!Gdx.net.openURI(discordURL)){
|
||||||
|
ui.showError("$text.linkfail");
|
||||||
|
Gdx.app.getClipboard().setContents(discordURL);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
public class LevelDialog extends FloatingDialog{
|
public class LevelDialog extends FloatingDialog{
|
||||||
private Map selectedMap = world.maps().getMap(0);
|
private Map selectedMap = world.maps().getMap(0);
|
||||||
private TextureRegion region = new TextureRegion();
|
|
||||||
private ScrollPane pane;
|
private ScrollPane pane;
|
||||||
|
|
||||||
public LevelDialog(){
|
public LevelDialog(){
|
||||||
@@ -56,6 +55,7 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
group.add(b[0]);
|
group.add(b[0]);
|
||||||
selmode.add(b[0]).size(130f, 54f);
|
selmode.add(b[0]).size(130f, 54f);
|
||||||
}
|
}
|
||||||
|
selmode.addButton("?", this::displayGameModeHelp).size(50f, 54f).padLeft(18f);
|
||||||
|
|
||||||
content().add(selmode);
|
content().add(selmode);
|
||||||
content().row();
|
content().row();
|
||||||
@@ -171,4 +171,23 @@ public class LevelDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void displayGameModeHelp() {
|
||||||
|
FloatingDialog d = new FloatingDialog(Bundles.get("mode.text.help.title"));
|
||||||
|
d.setFillParent(false);
|
||||||
|
Table table = new Table();
|
||||||
|
table.defaults().pad(1f);
|
||||||
|
ScrollPane pane = new ScrollPane(table, "clear");
|
||||||
|
pane.setFadeScrollBars(false);
|
||||||
|
table.row();
|
||||||
|
for(GameMode mode : GameMode.values()){
|
||||||
|
table.labelWrap("[accent]" + mode.toString() + ":[] [lightgray]" + mode.description()).width(600f);
|
||||||
|
table.row();
|
||||||
|
}
|
||||||
|
|
||||||
|
d.content().add(pane);
|
||||||
|
d.buttons().addButton("$text.ok", d::hide).size(110, 50).pad(10f);
|
||||||
|
d.show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public class BackgroundFragment implements Fragment {
|
|||||||
TextureRegion back = Draw.region("background");
|
TextureRegion back = Draw.region("background");
|
||||||
float backscl = Math.max(Gdx.graphics.getWidth() / (float)back.getRegionWidth() * 1.5f, Unit.dp.scl(5f));
|
float backscl = Math.max(Gdx.graphics.getWidth() / (float)back.getRegionWidth() * 1.5f, Unit.dp.scl(5f));
|
||||||
|
|
||||||
Draw.alpha(0.7f);
|
Draw.alpha(0.5f);
|
||||||
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2 +240f, h/2 - back.getRegionHeight()*backscl/2 + 250f,
|
Core.batch.draw(back, w/2 - back.getRegionWidth()*backscl/2, h/2 - back.getRegionHeight()*backscl/2,
|
||||||
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
back.getRegionWidth()*backscl, back.getRegionHeight()*backscl);
|
||||||
|
|
||||||
boolean portrait = Gdx.graphics.getWidth() < Gdx.graphics.getHeight();
|
boolean portrait = Gdx.graphics.getWidth() < Gdx.graphics.getHeight();
|
||||||
@@ -31,7 +31,7 @@ public class BackgroundFragment implements Fragment {
|
|||||||
float logoh = logo.getRegionHeight()*logoscl;
|
float logoh = logo.getRegionHeight()*logoscl;
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15 + (portrait ? -Unit.dp.scl(30f) : 0f), logow, logoh);
|
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15 - Unit.dp.scl(portrait ? 30f : 30), logow, logoh);
|
||||||
}).visible(() -> state.is(State.menu)).grow();
|
}).visible(() -> state.is(State.menu)).grow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package io.anuke.mindustry.ui.fragments;
|
package io.anuke.mindustry.ui.fragments;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import io.anuke.mindustry.Vars;
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.io.Platform;
|
import io.anuke.mindustry.io.Platform;
|
||||||
import io.anuke.mindustry.io.Version;
|
import io.anuke.mindustry.io.Version;
|
||||||
import io.anuke.mindustry.ui.MenuButton;
|
import io.anuke.mindustry.ui.MenuButton;
|
||||||
import io.anuke.mindustry.ui.PressGroup;
|
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.builders.label;
|
import io.anuke.ucore.scene.builders.label;
|
||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
@@ -21,36 +20,38 @@ public class MenuFragment implements Fragment{
|
|||||||
|
|
||||||
if(!android){
|
if(!android){
|
||||||
new table(){{
|
new table(){{
|
||||||
PressGroup group = new PressGroup();
|
|
||||||
|
|
||||||
float scale = 4f;
|
|
||||||
defaults().size(140*scale, 21*scale).pad(-10f);
|
|
||||||
|
|
||||||
add(new MenuButton("$text.play", group, ui.levels::show));
|
float w = 200f;
|
||||||
|
float bw = w * 2f + 10f;
|
||||||
|
|
||||||
|
defaults().size(w, 70f).padTop(5).padRight(5);
|
||||||
|
|
||||||
|
add(new MenuButton("icon-play-2", "$text.play", MenuFragment.this::showPlaySelect)).width(bw).colspan(2);
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
if(Platform.instance.canJoinGame()) {
|
add(new MenuButton("icon-editor", "$text.editor", () -> {
|
||||||
add(new MenuButton("$text.joingame", group, ui.join::show));
|
if(gwt){
|
||||||
row();
|
ui.showInfo("$text.editor.web");
|
||||||
}
|
}else{
|
||||||
|
ui.editor.show();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
add(new MenuButton("$text.tutorial", group, ()-> control.playMap(world.maps().getMap("tutorial"))));
|
add(new MenuButton("icon-tools", "$text.settings", ui.settings::show));
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
add(new MenuButton("$text.loadgame", group, ui.load::show));
|
add(new MenuButton("icon-info", "$text.about.button", ui.about::show));
|
||||||
row();
|
|
||||||
|
add(new MenuButton("icon-menu", "$text.changelog.title", ui.changelog::show));
|
||||||
|
|
||||||
if(!gwt){
|
|
||||||
add(new MenuButton("$text.editor", group, ui.editor::show));
|
|
||||||
row();
|
|
||||||
}
|
|
||||||
|
|
||||||
add(new MenuButton("$text.settings", group, ui.settings::show));
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
if(!gwt){
|
if(!gwt){
|
||||||
add(new MenuButton("$text.quit", group, Gdx.app::exit));
|
add(new MenuButton("icon-exit", "$text.quit", Gdx.app::exit)).width(bw).colspan(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
get().margin(16);
|
get().margin(16);
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
@@ -79,18 +80,14 @@ public class MenuFragment implements Fragment{
|
|||||||
}}.end();
|
}}.end();
|
||||||
}
|
}
|
||||||
}}.end();
|
}}.end();
|
||||||
|
|
||||||
//extra icons in top right
|
//discord icon in top right
|
||||||
new table(){{
|
if(Platform.instance.hasDiscord()) {
|
||||||
atop().aright();
|
new table() {{
|
||||||
if(Platform.instance.hasDiscord()){
|
abottom().atop().aright();
|
||||||
new imagebutton("icon-discord", 30f, ui.discord::show).margin(14);
|
get().addButton("", "discord", ui.discord::show);
|
||||||
}
|
}}.end().visible(() -> state.is(State.menu));
|
||||||
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));
|
|
||||||
|
|
||||||
//version info
|
//version info
|
||||||
new table(){{
|
new table(){{
|
||||||
@@ -99,4 +96,41 @@ public class MenuFragment implements Fragment{
|
|||||||
new label("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName);
|
new label("Mindustry " + Version.code + " " + Version.type + " / " + Version.buildName);
|
||||||
}}.end();
|
}}.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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.math.Interpolation;
|
import com.badlogic.gdx.math.Interpolation;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
|
import io.anuke.mindustry.input.AndroidInput;
|
||||||
import io.anuke.mindustry.input.InputHandler;
|
import io.anuke.mindustry.input.InputHandler;
|
||||||
import io.anuke.mindustry.input.PlaceMode;
|
import io.anuke.mindustry.input.PlaceMode;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
@@ -128,7 +129,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
defaults().padBottom(-5.5f);
|
defaults().padBottom(-5.5f);
|
||||||
|
|
||||||
new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
ImageButton button = new imagebutton("icon-" + mode.name(), "toggle", 10 * 3, () -> {
|
||||||
control.input().resetCursor();
|
control.input().resetCursor();
|
||||||
input.breakMode = mode;
|
input.breakMode = mode;
|
||||||
input.lastBreakMode = mode;
|
input.lastBreakMode = mode;
|
||||||
@@ -138,7 +139,15 @@ public class PlacementFragment implements Fragment{
|
|||||||
input.placeMode = input.lastPlaceMode;
|
input.placeMode = input.lastPlaceMode;
|
||||||
}
|
}
|
||||||
modeText(Bundles.format("text.mode.break", mode.toString()));
|
modeText(Bundles.format("text.mode.break", mode.toString()));
|
||||||
}).group(breakGroup).get().setName(mode.name());
|
}).group(breakGroup).get();
|
||||||
|
|
||||||
|
button.setName(mode.name());
|
||||||
|
button.released(() -> {
|
||||||
|
//TODO hack
|
||||||
|
if(mode == PlaceMode.areaDelete){
|
||||||
|
((AndroidInput)input).placing = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}}.end().get();
|
}}.end().get();
|
||||||
@@ -215,6 +224,7 @@ public class PlacementFragment implements Fragment{
|
|||||||
|
|
||||||
if(!show){
|
if(!show){
|
||||||
control.input().breakMode = PlaceMode.none;
|
control.input().breakMode = PlaceMode.none;
|
||||||
|
if(control.input().placeMode.delete) control.input().placeMode = PlaceMode.none;
|
||||||
breaktable.actions(Actions.translateBy(-breaktable.getWidth() - 5, 0, dur, in), Actions.call(() -> shown = false));
|
breaktable.actions(Actions.translateBy(-breaktable.getWidth() - 5, 0, dur, in), Actions.call(() -> shown = false));
|
||||||
}else{
|
}else{
|
||||||
shown = true;
|
shown = true;
|
||||||
|
|||||||