Merge branch 'master' of https://github.com/Anuken/Mindustry into 4.0
# Conflicts: # build.gradle # core/src/io/anuke/mindustry/Vars.java # core/src/io/anuke/mindustry/core/Control.java # core/src/io/anuke/mindustry/core/Logic.java # core/src/io/anuke/mindustry/core/NetClient.java # core/src/io/anuke/mindustry/core/NetServer.java # core/src/io/anuke/mindustry/core/UI.java # core/src/io/anuke/mindustry/editor/MapSaveDialog.java # core/src/io/anuke/mindustry/input/GestureHandler.java # core/src/io/anuke/mindustry/mapeditor/MapEditorDialog.java # core/src/io/anuke/mindustry/ui/dialogs/FileChooser.java # core/src/io/anuke/mindustry/ui/dialogs/JoinDialog.java # gradle/wrapper/gradle-wrapper.properties # server/src/io/anuke/mindustry/server/ServerControl.java
This commit is contained in:
@@ -9,6 +9,7 @@ import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.ios;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
|
||||
public class AboutDialog extends FloatingDialog {
|
||||
@@ -25,6 +26,10 @@ public class AboutDialog extends FloatingDialog {
|
||||
ScrollPane pane = new ScrollPane(in, "clear");
|
||||
|
||||
for(LinkEntry link : Links.getLinks()){
|
||||
if(ios && link.name.equals("google-play")){ //because Apple doesn't like me mentioning android
|
||||
continue;
|
||||
}
|
||||
|
||||
Table table = new Table("button");
|
||||
table.margin(0);
|
||||
table.table(img -> {
|
||||
@@ -59,7 +64,10 @@ public class AboutDialog extends FloatingDialog {
|
||||
content().add(pane).growX();
|
||||
|
||||
buttons().addButton("$text.credits", this::showCredits).size(200f, 64f);
|
||||
buttons().addButton("$text.changelog.title", ui.changelog::show).size(200f, 64f);
|
||||
if(!ios){
|
||||
buttons().addButton("$text.changelog.title", ui.changelog::show).size(200f, 64f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showCredits(){
|
||||
|
||||
@@ -11,6 +11,8 @@ import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
import static io.anuke.mindustry.Vars.ios;
|
||||
|
||||
public class ChangelogDialog extends FloatingDialog{
|
||||
private final float vw = 600;
|
||||
private Array<VersionInfo> versions;
|
||||
@@ -22,13 +24,15 @@ public class ChangelogDialog extends FloatingDialog{
|
||||
|
||||
content().add("$text.changelog.loading");
|
||||
|
||||
Changelogs.getChangelog(result -> {
|
||||
versions = result;
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
}, t -> {
|
||||
Log.err(t);
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
});
|
||||
if(!ios) {
|
||||
Changelogs.getChangelog(result -> {
|
||||
versions = result;
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
}, t -> {
|
||||
Log.err(t);
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void setup(){
|
||||
@@ -45,7 +49,7 @@ public class ChangelogDialog extends FloatingDialog{
|
||||
table.add("$text.changelog.error.android").padTop(8);
|
||||
}
|
||||
|
||||
if(Vars.ios){
|
||||
if(ios){
|
||||
table.row();
|
||||
table.add("$text.changelog.error.ios").padTop(8);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ import com.badlogic.gdx.graphics.g2d.GlyphLayout;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Pools;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.badlogic.gdx.math.MathUtils;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.net.Host;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.scene.ui.ButtonGroup;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.io.SaveIO;
|
||||
import io.anuke.mindustry.io.Saves.SaveSlot;
|
||||
import io.anuke.ucore.core.Core;
|
||||
@@ -83,14 +86,24 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
if(!gwt) {
|
||||
t.addImageButton("icon-save", "empty", 14 * 3, () -> {
|
||||
new FileChooser("$text.save.export", false, file -> {
|
||||
try {
|
||||
slot.exportFile(file);
|
||||
setup();
|
||||
} catch (IOException e) {
|
||||
ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
|
||||
}
|
||||
}).show();
|
||||
if(!ios) {
|
||||
new FileChooser("$text.save.export", false, file -> {
|
||||
try {
|
||||
slot.exportFile(file);
|
||||
setup();
|
||||
} catch (IOException e) {
|
||||
ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
|
||||
}
|
||||
}).show();
|
||||
}else{
|
||||
try {
|
||||
FileHandle file = Gdx.files.local("save-" + slot.getName() + ".mins");
|
||||
slot.exportFile(file);
|
||||
Platform.instance.shareFile(file);
|
||||
}catch (Exception e){
|
||||
ui.showError(Bundles.format("text.save.export.fail", Strings.parseException(e, false)));
|
||||
}
|
||||
}
|
||||
}).size(14 * 3).right();
|
||||
}
|
||||
|
||||
@@ -134,7 +147,7 @@ public class LoadDialog extends FloatingDialog{
|
||||
|
||||
slots.row();
|
||||
|
||||
if(gwt) return;
|
||||
if(gwt || ios) return;
|
||||
|
||||
slots.addImageTextButton("$text.save.import", "icon-add", "clear", 14*3, () -> {
|
||||
new FileChooser("$text.save.import", f -> f.extension().equals("mins"), true, file -> {
|
||||
@@ -152,26 +165,30 @@ public class LoadDialog extends FloatingDialog{
|
||||
}).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
||||
}
|
||||
|
||||
public void runLoadSave(SaveSlot slot){
|
||||
ui.loadfrag.show();
|
||||
|
||||
Timers.runTask(3f, () -> {
|
||||
ui.loadfrag.hide();
|
||||
hide();
|
||||
try{
|
||||
slot.load();
|
||||
state.set(State.playing);
|
||||
ui.paused.hide();
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
ui.paused.hide();
|
||||
state.set(State.menu);
|
||||
logic.reset();
|
||||
ui.showError("$text.save.corrupted");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void modifyButton(TextButton button, SaveSlot slot){
|
||||
button.clicked(() -> {
|
||||
if(!button.childrenPressed()){
|
||||
ui.loadfrag.show();
|
||||
|
||||
Timers.runTask(3f, () -> {
|
||||
ui.loadfrag.hide();
|
||||
hide();
|
||||
try{
|
||||
slot.load();
|
||||
state.set(State.playing);
|
||||
ui.paused.hide();
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
ui.paused.hide();
|
||||
state.set(State.menu);
|
||||
logic.reset();
|
||||
ui.showError("$text.save.corrupted");
|
||||
}
|
||||
});
|
||||
runLoadSave(slot);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.net.NetEvents;
|
||||
import io.anuke.ucore.core.Core;
|
||||
|
||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.ui.fragments;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.io.Platform;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.mindustry.ui.MenuButton;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
@@ -58,7 +58,8 @@ public class MenuFragment implements Fragment{
|
||||
|
||||
}else {
|
||||
new table() {{
|
||||
defaults().size(120f).pad(5);
|
||||
float size = 120f;
|
||||
defaults().size(size).pad(5);
|
||||
float isize = 14f * 4;
|
||||
|
||||
new imagebutton("icon-play-2", isize, ui.levels::show).text("$text.play").padTop(4f);
|
||||
@@ -71,13 +72,21 @@ public class MenuFragment implements Fragment{
|
||||
|
||||
row();
|
||||
|
||||
new imagebutton("icon-editor", isize, ui.editor::show).text("$text.editor").padTop(4f);
|
||||
new table(){{
|
||||
|
||||
new imagebutton("icon-tools", isize, ui.settings::show).text("$text.settings").padTop(4f);
|
||||
defaults().size(size).pad(5);
|
||||
|
||||
new imagebutton("icon-info", isize, ui.about::show).text("$text.about.button").padTop(4f);
|
||||
new imagebutton("icon-editor", isize, ui.editor::show).text("$text.editor").padTop(4f);
|
||||
|
||||
new imagebutton("icon-donate", isize, Platform.instance::openDonations).text("$text.donate").padTop(4f);
|
||||
new imagebutton("icon-tools", isize, ui.settings::show).text("$text.settings").padTop(4f);
|
||||
|
||||
new imagebutton("icon-info", isize, ui.about::show).text("$text.about.button").padTop(4f);
|
||||
|
||||
if (!ios) {
|
||||
new imagebutton("icon-donate", isize, Platform.instance::openDonations).text("$text.donate").padTop(4f);
|
||||
}
|
||||
|
||||
}}.colspan(4).end();
|
||||
}}.end();
|
||||
}
|
||||
}}.end();
|
||||
|
||||
@@ -35,6 +35,7 @@ public class PlayerListFragment implements Fragment{
|
||||
public void build(Group parent){
|
||||
new table(){{
|
||||
new table("pane"){{
|
||||
touchable(Touchable.enabled);
|
||||
margin(14f);
|
||||
new label(() -> Bundles.format(playerGroup.size() == 1 ? "text.players.single" :
|
||||
"text.players", playerGroup.size()));
|
||||
|
||||
Reference in New Issue
Block a user