mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-12 03:37:27 +07:00
Added list of contributors to credits
This commit is contained in:
parent
1baf3190cd
commit
6f5df6a671
@ -1,5 +1,6 @@
|
||||
text.credits.text = Created by [ROYAL]Anuken[] - [SKY]anukendev@gmail.com[]\n\n[GRAY](In case you can't tell, this text is currently unfinished.\nTranslators, don't edit it yet!)
|
||||
text.credits.text = Created by [ROYAL]Anuken[] - [SKY]anukendev@gmail.com[]
|
||||
text.credits = Credits
|
||||
text.contributors = Translators and Contributors
|
||||
text.discord = Join the mindustry discord!
|
||||
text.link.discord.description = The official Mindustry discord chatroom
|
||||
text.link.github.description = Game source code
|
||||
|
@ -33,6 +33,7 @@ public class Vars{
|
||||
public static final String appName = "Mindustry";
|
||||
public static final String discordURL = "https://discord.gg/mindustry";
|
||||
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
|
||||
public static final String contributorsURL = "https://api.github.com/repos/Anuken/Mindustry/contributors";
|
||||
public static final String crashReportURL = "http://mindustry.us.to/report";
|
||||
//time between waves in frames (on normal mode)
|
||||
public static final float wavespace = 60 * 60 * 1.5f;
|
||||
|
43
core/src/io/anuke/mindustry/io/Contributors.java
Normal file
43
core/src/io/anuke/mindustry/io/Contributors.java
Normal file
@ -0,0 +1,43 @@
|
||||
package io.anuke.mindustry.io;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.JsonReader;
|
||||
import com.badlogic.gdx.utils.JsonValue;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.function.Consumer;
|
||||
|
||||
import static io.anuke.mindustry.Vars.contributorsURL;
|
||||
|
||||
public class Contributors{
|
||||
|
||||
public static void getContributors(Consumer<Array<Contributor>> success, Consumer<Throwable> fail){
|
||||
Net.http(contributorsURL, "GET", result -> {
|
||||
JsonReader reader = new JsonReader();
|
||||
JsonValue value = reader.parse(result).child;
|
||||
Array<Contributor> out = new Array<>();
|
||||
|
||||
while(value != null){
|
||||
String login = value.getString("login");
|
||||
out.add(new Contributor(login));
|
||||
value = value.next;
|
||||
}
|
||||
|
||||
success.accept(out);
|
||||
}, fail);
|
||||
}
|
||||
|
||||
public static class Contributor{
|
||||
public final String login;
|
||||
|
||||
public Contributor(String login){
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "Contributor{" +
|
||||
"login='" + login + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,11 @@ package io.anuke.mindustry.ui.dialogs;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.io.Contributors;
|
||||
import io.anuke.mindustry.io.Contributors.Contributor;
|
||||
import io.anuke.mindustry.ui.Links;
|
||||
import io.anuke.mindustry.ui.Links.LinkEntry;
|
||||
import io.anuke.ucore.core.Core;
|
||||
@ -18,11 +22,14 @@ import static io.anuke.mindustry.Vars.ios;
|
||||
import static io.anuke.mindustry.Vars.ui;
|
||||
|
||||
public class AboutDialog extends FloatingDialog{
|
||||
private Array<Contributor> contributors = new Array<>();
|
||||
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "trello");
|
||||
|
||||
public AboutDialog(){
|
||||
super("$text.about.button");
|
||||
|
||||
Contributors.getContributors(out -> contributors = out, Throwable::printStackTrace);
|
||||
|
||||
shown(this::setup);
|
||||
onResize(this::setup);
|
||||
}
|
||||
@ -94,7 +101,24 @@ public class AboutDialog extends FloatingDialog{
|
||||
public void showCredits(){
|
||||
FloatingDialog dialog = new FloatingDialog("$text.credits");
|
||||
dialog.addCloseButton();
|
||||
dialog.content().labelWrap("$text.credits.text").width(400f);
|
||||
dialog.content().add("$text.credits.text");
|
||||
dialog.content().row();
|
||||
if(!contributors.isEmpty()){
|
||||
dialog.content().addImage("blank").color(Palette.accent).fillX().height(3f).pad(3f);
|
||||
dialog.content().row();
|
||||
dialog.content().add("$text.contributors");
|
||||
dialog.content().row();
|
||||
dialog.content().pane("clear", new Table(){{
|
||||
int i = 0;
|
||||
left();
|
||||
for(Contributor c : contributors){
|
||||
add("[lightgray]" + c.login).left().pad(3).padLeft(6).padRight(6);
|
||||
if(++i % 3 == 0){
|
||||
row();
|
||||
}
|
||||
}
|
||||
}});
|
||||
}
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user