Scrapped current place menu

This commit is contained in:
Anuken
2018-05-28 16:23:23 -04:00
parent ce68c2a3e9
commit 2bf7d06a91
14 changed files with 67 additions and 439 deletions
@@ -1,12 +1,21 @@
package io.anuke.mindustry.game;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectMap.Entry;
import com.badlogic.gdx.utils.ObjectSet;
import io.anuke.ucore.core.Settings;
import static io.anuke.mindustry.Vars.debug;
public class ContentDatabase {
private ObjectMap<String, ObjectSet<String>> unlocked = new ObjectMap<>();
public boolean isUnlocked(Content content){
if(debug){
return true;
}
if(!unlocked.containsKey(content.getContentTypeName())){
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
}
@@ -17,11 +26,23 @@ public class ContentDatabase {
}
private void load(){
ObjectMap<String, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);
for(Entry<String, Array<String>> entry : result.entries()){
ObjectSet<String> set = new ObjectSet<>();
set.addAll(entry.value);
unlocked.put(entry.key, set);
}
}
private void save(){
ObjectMap<String, Array<String>> write = new ObjectMap<>();
for(Entry<String, ObjectSet<String>> entry : unlocked.entries()){
write.put(entry.key, entry.value.iterator().toArray());
}
Settings.putJson("content-database", write);
}
}