diff --git a/core/assets/locales.json b/core/assets/locales.json new file mode 100644 index 0000000000..4f4c9cc3d9 --- /dev/null +++ b/core/assets/locales.json @@ -0,0 +1,3 @@ +[ + "en", "fr", "ru", "uk_UA", "pl", "de", "pt_BR","ko","in_ID", "ita","es","zh_TW" +] \ No newline at end of file diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index e2d191d3a2..dc493e8f45 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.utils.Json; import io.anuke.mindustry.core.*; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.TileEntity; @@ -11,7 +12,6 @@ import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.effect.Fire; import io.anuke.mindustry.entities.effect.ItemDrop; import io.anuke.mindustry.entities.effect.Puddle; -import io.anuke.mindustry.entities.effect.Shield; import io.anuke.mindustry.entities.traits.SyncTrait; import io.anuke.mindustry.entities.units.BaseUnit; import io.anuke.mindustry.game.Team; @@ -48,9 +48,7 @@ public class Vars{ public static final int sectorSize = 256; public static final int mapPadding = 3; public static final int invalidSector = Integer.MAX_VALUE; - public static final Locale[] locales = {new Locale("en"), new Locale("fr"), new Locale("ru"), new Locale("uk", "UA"), new Locale("pl"), - new Locale("de"), new Locale("pt", "BR"), new Locale("ko"), new Locale("in", "ID"), - new Locale("ita"), new Locale("es"), new Locale("zh","TW")}; + public static Locale[] locales; public static final Color[] playerColors = { Color.valueOf("82759a"), Color.valueOf("c0c1c5"), @@ -126,7 +124,6 @@ public class Vars{ public static EntityGroup playerGroup; public static EntityGroup tileGroup; public static EntityGroup bulletGroup; - public static EntityGroup shieldGroup; public static EntityGroup effectGroup; public static EntityGroup groundEffectGroup; public static EntityGroup itemGroup; @@ -138,12 +135,26 @@ public class Vars{ public static final Translator[] tmptr = new Translator[]{new Translator(), new Translator(), new Translator(), new Translator()}; public static void init(){ + + //load locales + String[] stra = new Json().fromJson(String[].class, Gdx.files.internal("locales.json")); + locales = new Locale[stra.length]; + for(int i = 0; i < locales.length; i++){ + String code = stra[i]; + if(code.contains("_")){ + locales[i] = new Locale(code.split("_")[0], code.split("_")[1]); + }else if(code.contains("-")){ + locales[i] = new Locale(code.split("-")[0], code.split("-")[1]); + }else{ + locales[i] = new Locale(code); + } + } + Version.init(); playerGroup = Entities.addGroup(Player.class).enableMapping(); tileGroup = Entities.addGroup(TileEntity.class, false); bulletGroup = Entities.addGroup(Bullet.class).enableMapping(); - shieldGroup = Entities.addGroup(Shield.class, false); effectGroup = Entities.addGroup(EffectEntity.class, false); groundEffectGroup = Entities.addGroup(DrawTrait.class, false); puddleGroup = Entities.addGroup(Puddle.class, false).enableMapping(); diff --git a/core/src/io/anuke/mindustry/core/Logic.java b/core/src/io/anuke/mindustry/core/Logic.java index 9b39769164..a29cb316bf 100644 --- a/core/src/io/anuke/mindustry/core/Logic.java +++ b/core/src/io/anuke/mindustry/core/Logic.java @@ -149,7 +149,6 @@ public class Logic extends Module{ Entities.update(puddleGroup); Entities.update(tileGroup); Entities.update(fireGroup); - Entities.update(shieldGroup); Entities.update(playerGroup); Entities.update(itemGroup); diff --git a/core/src/io/anuke/mindustry/entities/effect/Shield.java b/core/src/io/anuke/mindustry/entities/effect/Shield.java index da10da3fde..a5003cac5c 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Shield.java +++ b/core/src/io/anuke/mindustry/entities/effect/Shield.java @@ -4,14 +4,11 @@ import com.badlogic.gdx.math.Interpolation; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.defense.ShieldBlock; import io.anuke.ucore.core.Timers; -import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.impl.BaseEntity; import io.anuke.ucore.entities.trait.DrawTrait; import io.anuke.ucore.graphics.Fill; import io.anuke.ucore.util.Mathf; -import static io.anuke.mindustry.Vars.shieldGroup; - //todo re-implement public class Shield extends BaseEntity implements DrawTrait{ private final Tile tile; @@ -82,11 +79,6 @@ public class Shield extends BaseEntity implements DrawTrait{ active = false; } - @Override - public EntityGroup targetGroup(){ - return shieldGroup; - } - @Override public void added(){ active = true;