Fixed shaky camera, many other small bugs

This commit is contained in:
Anuken
2018-05-30 23:51:42 -04:00
parent fae7bfa8c5
commit 857b76980b
12 changed files with 81 additions and 36 deletions
@@ -4,6 +4,8 @@ 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.mindustry.game.EventType.UnlockEvent;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Settings;
public class ContentDatabase {
@@ -29,9 +31,18 @@ public class ContentDatabase {
unlocked.put(content.getContentTypeName(), new ObjectSet<>());
}
return unlocked.get(content.getContentTypeName()).add(content.getContentName());
boolean ret = unlocked.get(content.getContentTypeName()).add(content.getContentName());
//fire unlock event so other classes can use it
if(ret){
Events.fire(UnlockEvent.class, content);
}
return ret;
}
//saving/loading currently disabled for testing.
private void load(){
ObjectMap<String, Array<String>> result = Settings.getJson("content-database", ObjectMap.class);
@@ -37,4 +37,9 @@ public class EventType {
public interface StateChangeEvent extends Event{
void handle(State from, State to);
}
public interface UnlockEvent extends Event{
void handle(Content content);
}
}