Removed CampaignData.java/GlobalData.java

This commit is contained in:
Anuken
2020-06-20 12:28:24 -04:00
parent ec4a5880b7
commit 25338ff1cf
13 changed files with 66 additions and 80 deletions

View File

@@ -1,47 +0,0 @@
package mindustry.game;
import arc.*;
import arc.struct.*;
import mindustry.ctype.*;
import mindustry.game.EventType.*;
/** Stores unlocks and tech tree state. */
public class CampaignData{
private ObjectSet<String> unlocked = new ObjectSet<>();
/** @return whether or not this piece of content is unlocked yet. */
public boolean isUnlocked(UnlockableContent content){
return content.alwaysUnlocked || unlocked.contains(content.name);
}
/**
* Makes this piece of content 'unlocked', if possible.
* If this piece of content is already unlocked, nothing changes.
*/
public void unlockContent(UnlockableContent content){
if(content.alwaysUnlocked) return;
//fire unlock event so other classes can use it
if(unlocked.add(content.name)){
content.onUnlock();
Events.fire(new UnlockEvent(content));
save();
}
}
/** Clears all unlocked content. Automatically saves. */
public void reset(){
save();
}
@SuppressWarnings("unchecked")
public void load(){
unlocked = Core.settings.getJson("unlocked-content", ObjectSet.class, ObjectSet::new);
}
public void save(){
Core.settings.putJson("unlocked-content", String.class, unlocked);
}
}

View File

@@ -13,7 +13,7 @@ import mindustry.type.*;
import static mindustry.Vars.*;
/** Updates the campaign universe. Has no relevance to other gamemodes. */
/** Updates and handles state of the campaign universe. Has no relevance to other gamemodes. */
public class Universe{
private long seconds;
private float secondCounter;