Removed all reflection

This commit is contained in:
Anuken
2018-09-09 21:44:10 -04:00
parent 65f911909b
commit 6ef2256bf2
6 changed files with 19 additions and 13 deletions

View File

@@ -16,6 +16,10 @@ public class ContentDatabase{
private ObjectMap<ContentType, ObjectSet<String>> unlocked = new ObjectMap<>();
/** Whether unlockables have changed since the last save.*/
private boolean dirty;
static{
Settings.setSerializer(ContentType.class, (stream, t) -> stream.writeInt(t.ordinal()), stream -> ContentType.values()[stream.readInt()]);
}
/** Returns whether or not this piece of content is unlocked yet.*/
public boolean isUnlocked(UnlockableContent content){

View File

@@ -1,7 +1,7 @@
package io.anuke.mindustry.io;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Json;
import com.badlogic.gdx.utils.JsonReader;
import com.badlogic.gdx.utils.JsonValue;
import io.anuke.mindustry.net.Net;
import io.anuke.ucore.function.Consumer;
@@ -12,16 +12,19 @@ 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(Array.class, result);
JsonReader reader = new JsonReader();
JsonValue value = reader.parse(result).child;
Array<VersionInfo> out = new Array<>();
for(JsonValue value : list){
while(value != null){
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, value.getString("published_at")));
value = value.next;
}
success.accept(out);
}, fail);
}