Untested loadout config / Better filter display / Bugfixes
This commit is contained in:
@@ -18,6 +18,15 @@ public class EventType{
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when a zone's requirements are met.*/
|
||||
public static class ZoneConfigureCompleteEvent implements Event{
|
||||
public final Zone zone;
|
||||
|
||||
public ZoneConfigureCompleteEvent(Zone zone){
|
||||
this.zone = zone;
|
||||
}
|
||||
}
|
||||
|
||||
/**Called when the game is first loaded.*/
|
||||
public static class GameLoadEvent implements Event{
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ import io.anuke.arc.collection.ObjectSet;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||
import io.anuke.mindustry.game.EventType.ZoneCompleteEvent;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Zone;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
|
||||
/**Stores player unlocks. Clientside only.*/
|
||||
public class GlobalData{
|
||||
@@ -25,25 +24,19 @@ public class GlobalData{
|
||||
public GlobalData(){
|
||||
Core.settings.setSerializer(ContentType.class, (stream, t) -> stream.writeInt(t.ordinal()), stream -> ContentType.values()[stream.readInt()]);
|
||||
Core.settings.setSerializer(Item.class, (stream, t) -> stream.writeUTF(t.name), stream -> content.getByName(ContentType.item, stream.readUTF()));
|
||||
|
||||
Core.settings.setSerializer(ItemStack.class, (stream, t) -> {
|
||||
stream.writeUTF(t.item.name);
|
||||
stream.writeInt(t.amount);
|
||||
}, stream -> {
|
||||
String name = stream.readUTF();
|
||||
int amount = stream.readInt();
|
||||
return new ItemStack(content.getByName(ContentType.item, name), amount);
|
||||
});
|
||||
}
|
||||
|
||||
public void updateWaveScore(Zone zone, int wave){
|
||||
int value = Core.settings.getInt(zone.name + "-wave", 0);
|
||||
if(value < wave){
|
||||
Core.settings.put(zone.name + "-wave", wave);
|
||||
modified = true;
|
||||
if(wave == zone.conditionWave + 1){
|
||||
Events.fire(new ZoneCompleteEvent(zone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getWaveScore(Zone zone){
|
||||
return Core.settings.getInt(zone.name + "-wave", 0);
|
||||
}
|
||||
|
||||
public boolean isCompleted(Zone zone){
|
||||
return getWaveScore(zone) >= zone.conditionWave;
|
||||
public void modified(){
|
||||
modified = true;
|
||||
}
|
||||
|
||||
public int getItem(Item item){
|
||||
|
||||
@@ -197,7 +197,7 @@ public class Saves{
|
||||
}
|
||||
|
||||
public boolean isHidden(){
|
||||
return false;
|
||||
return getZone() != null;
|
||||
}
|
||||
|
||||
public String getPlayTime(){
|
||||
|
||||
Reference in New Issue
Block a user