mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-13 00:05:23 +07:00
Moved locale declaration to json file
This commit is contained in:
parent
fbcfb23676
commit
ec4eac3a7d
3
core/assets/locales.json
Normal file
3
core/assets/locales.json
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
"en", "fr", "ru", "uk_UA", "pl", "de", "pt_BR","ko","in_ID", "ita","es","zh_TW"
|
||||
]
|
@ -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<Player> playerGroup;
|
||||
public static EntityGroup<TileEntity> tileGroup;
|
||||
public static EntityGroup<Bullet> bulletGroup;
|
||||
public static EntityGroup<Shield> shieldGroup;
|
||||
public static EntityGroup<EffectEntity> effectGroup;
|
||||
public static EntityGroup<DrawTrait> groundEffectGroup;
|
||||
public static EntityGroup<ItemDrop> 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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user