use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.
the class PlayerManager method initializePlayers.
public void initializePlayers() {
players = new ArrayList<>();
if (getMaster().getGame().getDataKeeper().getPlayerData() != null) {
// TODO init data from preset
}
if (data == null) {
data = generateDefaultPlayerData();
}
unusedPlayerColorsList = new ListMaster<FLAG_COLOR>().getList(playerColors);
int i = 0;
for (String substring : StringMaster.open(data)) {
DC_Player player = initPlayerFromString(substring);
if (player.getAllegiance() == ALLEGIENCE.NEUTRAL)
Player.NEUTRAL = player;
// else
players.add(player);
if (player.isEnemy())
player.setAi(true);
initUnitData(player, i);
FLAG_COLOR color = getRandomColorFlag(player.isEnemy());
player.setFlagColor(color);
i++;
}
if (Player.NEUTRAL == null) {
Player.NEUTRAL = new DC_Player("Neutral", FLAG_COLOR.BROWN, "", "", ALLEGIENCE.NEUTRAL);
DC_Player.NEUTRAL = (DC_Player) Player.NEUTRAL;
players.add(DC_Player.NEUTRAL);
}
}
use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.
the class WorldGenerator method generateFactions.
private static void generateFactions() {
for (String sub : StringMaster.openContainer(world.getProperty(MACRO_PROPS.FACTIONS))) {
boolean me = world.checkProperty(MACRO_PROPS.PLAYER_FACTION, sub);
ObjType type = DataManager.getType(sub, MACRO_OBJ_TYPES.FACTIONS);
FLAG_COLOR color = new EnumMaster<FLAG_COLOR>().retrieveEnumConst(FLAG_COLOR.class, type.getProperty(PROPS.FLAG_COLOR));
if (color == null)
color = FLAG_COLOR.BROWN;
DC_Player player = new DC_Player(sub, color, type.getProperty(G_PROPS.EMBLEM), type.getProperty(G_PROPS.IMAGE), me ? ALLEGIENCE.ALLY : ALLEGIENCE.ENEMY);
Faction faction = new Faction(type, player);
game.addFaction(faction);
if (me)
game.setPlayerFaction(faction);
}
}
use of main.system.graphics.ColorManager.FLAG_COLOR in project Eidolons by IDemiurge.
the class PlayerManager method initPlayerFromString.
public DC_Player initPlayerFromString(String data) {
PlayerData dataUnit = new PlayerData(data);
ALLEGIENCE allegience = new EnumMaster<ALLEGIENCE>().retrieveEnumConst(ALLEGIENCE.class, dataUnit.getValue(PLAYER_VALUE.ALLEGIENCE));
if (allegience == null) {
allegience = ALLEGIENCE.NEUTRAL;
}
FLAG_COLOR color = new EnumMaster<FLAG_COLOR>().retrieveEnumConst(FLAG_COLOR.class, dataUnit.getValue(PLAYER_VALUE.COLOR));
if (color == null) {
color = getRandomColorFlag();
}
DC_Player player = new DC_Player(dataUnit.getValue(PLAYER_VALUE.NAME), color, dataUnit.getValue(PLAYER_VALUE.EMBLEM), dataUnit.getValue(PLAYER_VALUE.PORTRAIT), allegience);
player.setMainHeroName(dataUnit.getValue(PLAYER_VALUE.MAIN_HERO));
return player;
}
Aggregations