mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-14 13:21:50 -08:00
Added in-game changelogs
This commit is contained in:
parent
1d83e94ad6
commit
8743a60d02
12 changed files with 473 additions and 349 deletions
|
|
@ -25,7 +25,7 @@ allprojects {
|
|||
appName = 'Mindustry'
|
||||
gdxVersion = '1.9.8'
|
||||
aiVersion = '1.8.1'
|
||||
uCoreVersion = '21f04f8'
|
||||
uCoreVersion = '156dff2'
|
||||
|
||||
getVersionString = {
|
||||
String buildVersion = getBuildVersion()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
duplicatePadding: true,
|
||||
combineSubdirectories: true
|
||||
combineSubdirectories: true,
|
||||
flattenPaths: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
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- All the beta testers on itch.io and Google Play\n
|
||||
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.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.gameover=The core was destroyed.
|
||||
|
|
@ -114,6 +114,10 @@ text.cancel=Cancel
|
|||
text.openlink=Open Link
|
||||
text.back=Back
|
||||
text.quit.confirm=Are you sure you want to quit?
|
||||
text.changelog.title=Changelog
|
||||
text.changelog.error=[scarlet]Error getting changelog!\nCheck your internet connection.
|
||||
text.changelog.current=[yellow][[Current version]
|
||||
text.changelog.latest=[orange][[Latest version]
|
||||
text.loading=[accent]Loading...
|
||||
text.wave=[orange]Wave {0}
|
||||
text.wave.waiting=Wave in {0}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
#Autogenerated file. Do not modify.
|
||||
#Thu Mar 08 22:36:02 EST 2018
|
||||
#Fri Mar 09 17:10:35 EST 2018
|
||||
version=release
|
||||
androidBuildCode=359
|
||||
androidBuildCode=363
|
||||
name=Mindustry
|
||||
code=3.4
|
||||
build=custom build
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class Vars{
|
|||
//discord group URL
|
||||
public static final String discordURL = "https://discord.gg/BKADYds";
|
||||
|
||||
public static final String serverURL = "http://localhost:3000";
|
||||
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
|
||||
//directory for user-created map data
|
||||
public static final FileHandle customMapDirectory = gwt ? null : UCore.isAssets() ?
|
||||
Gdx.files.local("../../desktop/mindustry-maps") : Gdx.files.local("mindustry-maps/");
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ public class Control extends Module{
|
|||
"name", android || gwt ? "player" : UCore.getProperty("user.name"),
|
||||
"servers", "",
|
||||
"color", Color.rgba8888(playerColors[8]),
|
||||
"lastVersion", "3.2"
|
||||
"lastVersion", "3.2",
|
||||
"lastBuild", 0
|
||||
);
|
||||
|
||||
KeyBinds.load();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public class UI extends SceneModule{
|
|||
public BansDialog bans;
|
||||
public AdminsDialog admins;
|
||||
public TraceDialog traces;
|
||||
public ChangelogDialog changelog;
|
||||
|
||||
public final MenuFragment menufrag = new MenuFragment();
|
||||
public final ToolFragment toolfrag = new ToolFragment();
|
||||
|
|
@ -159,6 +160,7 @@ public class UI extends SceneModule{
|
|||
bans = new BansDialog();
|
||||
admins = new AdminsDialog();
|
||||
traces = new TraceDialog();
|
||||
changelog = new ChangelogDialog();
|
||||
|
||||
build.begin(scene);
|
||||
|
||||
|
|
|
|||
50
core/src/io/anuke/mindustry/io/Changelogs.java
Normal file
50
core/src/io/anuke/mindustry/io/Changelogs.java
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
package io.anuke.mindustry.io;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Json;
|
||||
import com.badlogic.gdx.utils.JsonValue;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.releasesURL;
|
||||
|
||||
public class Changelogs {
|
||||
|
||||
public static void getChangelog(Consumer<Array<VersionInfo>> success, Consumer<Throwable> fail){
|
||||
Net.http(releasesURL, "GET", result -> {
|
||||
Json j = new Json();
|
||||
Array<JsonValue> list = j.fromJson(null, result);
|
||||
Array<VersionInfo> out = new Array<>();
|
||||
for(JsonValue value : list){
|
||||
String name = value.getString("name");
|
||||
String description = value.getString("body").replace("\r", "");
|
||||
int id = value.getInt("id");
|
||||
int build = Integer.parseInt(value.getString("tag_name").substring(1));
|
||||
out.add(new VersionInfo(name, description, id, build));
|
||||
}
|
||||
success.accept(out);
|
||||
}, fail);
|
||||
}
|
||||
|
||||
public static class VersionInfo{
|
||||
public final String name, description;
|
||||
public final int id, build;
|
||||
|
||||
public VersionInfo(String name, String description, int id, int build) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.id = id;
|
||||
this.build = build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VersionInfo{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", id=" + id +
|
||||
", build=" + build +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -248,9 +248,9 @@ public class Net{
|
|||
active = false;
|
||||
}
|
||||
|
||||
public static void http(String method, String content, Consumer<String> listener){
|
||||
public static void http(String url, String method, Consumer<String> listener, Consumer<Throwable> failure){
|
||||
HttpRequest req = new HttpRequestBuilder().newRequest()
|
||||
.method(method).content(content).url(serverURL + "/servers").build();
|
||||
.method(method).url(url).build();
|
||||
|
||||
Gdx.net.sendHttpRequest(req, new HttpResponseListener() {
|
||||
@Override
|
||||
|
|
@ -260,8 +260,7 @@ public class Net{
|
|||
|
||||
@Override
|
||||
public void failed(Throwable t) {
|
||||
Log.err("HTTP error:");
|
||||
Log.err(t);
|
||||
failure.accept(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
66
core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java
Normal file
66
core/src/io/anuke/mindustry/ui/dialogs/ChangelogDialog.java
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.io.Changelogs;
|
||||
import io.anuke.mindustry.io.Changelogs.VersionInfo;
|
||||
import io.anuke.mindustry.io.Version;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.scene.ui.ScrollPane;
|
||||
import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Log;
|
||||
|
||||
public class ChangelogDialog extends FloatingDialog{
|
||||
private final float vw = 600;
|
||||
private Array<VersionInfo> versions;
|
||||
|
||||
public ChangelogDialog(){
|
||||
super("$text.changelog.title");
|
||||
|
||||
Changelogs.getChangelog(result -> {
|
||||
versions = result;
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
}, t -> {
|
||||
Log.err(t);
|
||||
Gdx.app.postRunnable(this::setup);
|
||||
});
|
||||
}
|
||||
|
||||
void setup(){
|
||||
Table table = new Table();
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
|
||||
content().add(pane).grow();
|
||||
|
||||
addCloseButton();
|
||||
|
||||
if(versions == null){
|
||||
table.add("$text.changelog.error");
|
||||
}else{
|
||||
for(VersionInfo info : versions){
|
||||
Table in = new Table("clear");
|
||||
in.top().left().margin(10);
|
||||
|
||||
in.add("[accent]" + info.name);
|
||||
if(info.build == Version.build){
|
||||
in.row();
|
||||
in.add("$text.changelog.current");
|
||||
}else if(info == versions.peek()){
|
||||
in.row();
|
||||
in.add("$text.changelog.latest");
|
||||
}
|
||||
in.row();
|
||||
in.labelWrap("[lightgray]" + info.description).width(vw - 20).padTop(12);
|
||||
|
||||
table.add(in).width(vw).pad(8).row();
|
||||
}
|
||||
|
||||
int lastid = Settings.getInt("lastBuild");
|
||||
if(lastid != 0 && versions.peek().build > lastid){
|
||||
Settings.putInt("lastBuild", versions.peek().build);
|
||||
Settings.save();
|
||||
show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,6 +89,7 @@ public class MenuFragment implements Fragment{
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue