Implemented loading map/save files on launch (Android)
This commit is contained in:
@@ -16,64 +16,69 @@ import io.anuke.ucore.util.Log;
|
||||
/**Loads all game content.
|
||||
* Call load() before doing anything with content.*/
|
||||
public class ContentLoader {
|
||||
private static boolean loaded = false;
|
||||
private static ContentList[] content = {
|
||||
//effects
|
||||
new BlockFx(),
|
||||
new BulletFx(),
|
||||
new EnvironmentFx(),
|
||||
new ExplosionFx(),
|
||||
new Fx(),
|
||||
new ShootFx(),
|
||||
new UnitFx(),
|
||||
|
||||
//items
|
||||
new Items(),
|
||||
|
||||
//status effects
|
||||
new StatusEffects(),
|
||||
|
||||
//liquids
|
||||
new Liquids(),
|
||||
|
||||
//bullets
|
||||
new ArtilleryBullets(),
|
||||
new FlakBullets(),
|
||||
new MissileBullets(),
|
||||
new ShellBullets(),
|
||||
new StandardBullets(),
|
||||
new TurretBullets(),
|
||||
|
||||
//ammotypes
|
||||
new AmmoTypes(),
|
||||
|
||||
//mechs
|
||||
new Mechs(),
|
||||
|
||||
//weapons
|
||||
new Weapons(),
|
||||
|
||||
//blocks
|
||||
new Blocks(),
|
||||
new DefenseBlocks(),
|
||||
new DistributionBlocks(),
|
||||
new ProductionBlocks(),
|
||||
new WeaponBlocks(),
|
||||
new DebugBlocks(),
|
||||
new LiquidBlocks(),
|
||||
new StorageBlocks(),
|
||||
new UnitBlocks(),
|
||||
new PowerBlocks(),
|
||||
new CraftingBlocks(),
|
||||
|
||||
//recipes
|
||||
new Recipes(),
|
||||
|
||||
//units
|
||||
new UnitTypes(),
|
||||
};
|
||||
|
||||
|
||||
public static void load(){
|
||||
|
||||
ContentList[] content = {
|
||||
//effects
|
||||
new BlockFx(),
|
||||
new BulletFx(),
|
||||
new EnvironmentFx(),
|
||||
new ExplosionFx(),
|
||||
new Fx(),
|
||||
new ShootFx(),
|
||||
new UnitFx(),
|
||||
|
||||
//items
|
||||
new Items(),
|
||||
|
||||
//status effects
|
||||
new StatusEffects(),
|
||||
|
||||
//liquids
|
||||
new Liquids(),
|
||||
|
||||
//bullets
|
||||
new ArtilleryBullets(),
|
||||
new FlakBullets(),
|
||||
new MissileBullets(),
|
||||
new ShellBullets(),
|
||||
new StandardBullets(),
|
||||
new TurretBullets(),
|
||||
|
||||
//ammotypes
|
||||
new AmmoTypes(),
|
||||
|
||||
//mechs
|
||||
new Mechs(),
|
||||
|
||||
//weapons
|
||||
new Weapons(),
|
||||
|
||||
//blocks
|
||||
new Blocks(),
|
||||
new DefenseBlocks(),
|
||||
new DistributionBlocks(),
|
||||
new ProductionBlocks(),
|
||||
new WeaponBlocks(),
|
||||
new DebugBlocks(),
|
||||
new LiquidBlocks(),
|
||||
new StorageBlocks(),
|
||||
new UnitBlocks(),
|
||||
new PowerBlocks(),
|
||||
new CraftingBlocks(),
|
||||
|
||||
//recipes
|
||||
new Recipes(),
|
||||
|
||||
//units
|
||||
new UnitTypes(),
|
||||
};
|
||||
if(loaded){
|
||||
Log.info("Content already loaded, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (ContentList list : content){
|
||||
list.load();
|
||||
@@ -89,5 +94,11 @@ public class ContentLoader {
|
||||
io.anuke.mindustry.type.Mech.all().size, UnitType.getAllTypes().size, io.anuke.mindustry.type.AmmoType.all().size, BulletType.all().size, StatusEffect.getAllEffects().size, io.anuke.mindustry.type.Recipe.all().size, Effects.all().size, content.length);
|
||||
|
||||
Log.info("-------------------");
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
public static void dispose(){
|
||||
//TODO clear all content.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Fire extends TimedEntity implements SerializableEntity, Poolable{
|
||||
}
|
||||
|
||||
/**Deserialization use only!*/
|
||||
private Fire(){}
|
||||
public Fire(){}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
@@ -35,7 +35,7 @@ public class ItemTransfer extends TimedEntity{
|
||||
tr.add();
|
||||
}
|
||||
|
||||
private ItemTransfer(){}
|
||||
public ItemTransfer(){}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
@@ -125,7 +125,7 @@ public class Puddle extends Entity implements SerializableEntity, Poolable{
|
||||
}
|
||||
|
||||
/**Deserialization use only!*/
|
||||
private Puddle(){}
|
||||
public Puddle(){}
|
||||
|
||||
public float getFlammability(){
|
||||
return liquid.flammability * amount;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Rubble extends TimedEntity implements BelowLiquidEffect{
|
||||
rubble.set(x, y).add();
|
||||
}
|
||||
|
||||
private Rubble(){
|
||||
public Rubble(){
|
||||
lifetime = 7000f;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.input;
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.entities.BlockBuilder.BuildRequest;
|
||||
import io.anuke.mindustry.entities.ItemTransfer;
|
||||
import io.anuke.mindustry.entities.effect.ItemTransfer;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.badlogic.gdx.utils.IntSet;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.ItemTransfer;
|
||||
import io.anuke.mindustry.entities.effect.ItemTransfer;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Rectangle;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.*;
|
||||
import io.anuke.mindustry.entities.effect.ItemTransfer;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.graphics.Shaders;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
|
||||
Reference in New Issue
Block a user