Deploy dialog requirements done
This commit is contained in:
@@ -43,6 +43,10 @@ public class GlobalData{
|
||||
return getWaveScore(zone) >= zone.conditionWave;
|
||||
}
|
||||
|
||||
public int getItem(Item item){
|
||||
return items.get(item, 0);
|
||||
}
|
||||
|
||||
public void addItem(Item item, int amount){
|
||||
modified = true;
|
||||
items.getAndIncrement(item, 0, amount);
|
||||
@@ -84,7 +88,7 @@ public class GlobalData{
|
||||
* Results are not saved until you call {@link #save()}.
|
||||
*/
|
||||
public void unlockContent(UnlockableContent content){
|
||||
if(!content.canBeUnlocked() || content.alwaysUnlocked()) return;
|
||||
if(content.alwaysUnlocked()) return;
|
||||
|
||||
//fire unlock event so other classes can use it
|
||||
if(unlocked.getOr(content.getContentType(), ObjectSet::new).add(content.getContentName())){
|
||||
|
||||
@@ -3,8 +3,6 @@ package io.anuke.mindustry.game;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.arc.scene.ui.layout.Table;
|
||||
|
||||
import static io.anuke.mindustry.Vars.data;
|
||||
|
||||
/**Base interface for an unlockable content type.*/
|
||||
public abstract class UnlockableContent extends MappableContent{
|
||||
/**Returns the localized name of this content.*/
|
||||
@@ -28,24 +26,4 @@ public abstract class UnlockableContent extends MappableContent{
|
||||
public boolean alwaysUnlocked(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/**Lists the content that must be unlocked in order for this specific content to become unlocked. May return null.*/
|
||||
public UnlockableContent[] getDependencies(){
|
||||
return null;
|
||||
}
|
||||
|
||||
/**Returns whether dependencies are satisfied for unlocking this content.*/
|
||||
public boolean canBeUnlocked(){
|
||||
UnlockableContent[] depend = getDependencies();
|
||||
if(depend == null){
|
||||
return true;
|
||||
}else{
|
||||
for(UnlockableContent cont : depend){
|
||||
if(!data.isUnlocked(cont)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user