本文整理汇总了Java中net.sf.freecol.common.io.FreeColXMLReader.makeFreeColObject方法的典型用法代码示例。如果您正苦于以下问题:Java FreeColXMLReader.makeFreeColObject方法的具体用法?Java FreeColXMLReader.makeFreeColObject怎么用?Java FreeColXMLReader.makeFreeColObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.freecol.common.io.FreeColXMLReader
的用法示例。
在下文中一共展示了FreeColXMLReader.makeFreeColObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
name = xr.getAttribute(NAME_TAG, (String)null);
// @compat 0.11.3
if (xr.hasAttribute(NAME_KEY_TAG)) {
key = xr.getAttribute(NAME_KEY_TAG, (String)null);
key = fixRegionKey(key);
} else
// @end compat 0.11.3
key = xr.getAttribute(KEY_TAG, (String)null);
type = xr.getAttribute(TYPE_TAG, RegionType.class, (RegionType)null);
claimable = xr.getAttribute(CLAIMABLE_TAG, false);
discoverable = xr.getAttribute(DISCOVERABLE_TAG, false);
scoreValue = xr.getAttribute(SCORE_VALUE_TAG, 0);
int turn = xr.getAttribute(DISCOVERED_IN_TAG, UNDEFINED);
discoveredIn = (turn == UNDEFINED) ? null : new Turn(turn);
discoveredBy = xr.findFreeColGameObject(getGame(), DISCOVERED_BY_TAG,
Player.class, (Player)null, false);
parent = xr.makeFreeColObject(getGame(), PARENT_TAG, Region.class, false);
}
示例2: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
unit = xr.makeFreeColObject(getGame(), UNIT_TAG, Unit.class, true);
turnCount = xr.getAttribute(TURN_COUNT_TAG, 0);
repeatCount = xr.getAttribute(REPEAT_COUNT_TAG, 1);
}
示例3: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
improvement = xr.makeFreeColObject(getGame(), IMPROVEMENT_TAG,
TileImprovement.class, true);
}
示例4: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
workTile = xr.makeFreeColObject(getGame(), WORK_TILE_TAG,
Tile.class, true);
}
示例5: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Specification spec = getSpecification();
final Game game = getGame();
tile = xr.makeFreeColObject(game, TILE_TAG, Tile.class, true);
type = xr.getType(spec, TYPE_TAG, TileImprovementType.class,
(TileImprovementType)null);
turnsToComplete = xr.getAttribute(TURNS_TAG, 0);
magnitude = xr.getAttribute(MAGNITUDE_TAG, 0);
virtual = xr.getAttribute(VIRTUAL_TAG, false);
style = null;
String str = xr.getAttribute(STYLE_TAG, (String)null);
List<Direction> dirns = getConnectionDirections();
if (dirns == null) {
if (str != null && !str.isEmpty())
logger.warning("At " + tile + " ignored nonempty style for "
+ type + ": " + str);
} else if (str == null) {
if (!isComplete() || isVirtual()) {
; // Null style OK for incomplete or virtual roads
} else {
logger.warning("At " + tile + " unexpected null style for "
+ type);
}
} else if (str.length() != dirns.size()) {
logger.warning("At " + tile + " ignored bogus style for "
+ type + ": " + str);
} else {
style = TileImprovementStyle.getInstance(str);
}
}
示例6: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Specification spec = getSpecification();
final Game game = getGame();
name = xr.getAttribute(NAME_TAG, (String)null);
Player oldOwner = owner;
owner = xr.findFreeColGameObject(game, OWNER_TAG,
Player.class, (Player)null, true);
if (xr.shouldIntern()) game.checkOwners(this, oldOwner);
UnitType oldUnitType = this.type;
this.type = xr.getType(spec, UNIT_TYPE_TAG,
UnitType.class, (UnitType)null);
state = xr.getAttribute(STATE_TAG, UnitState.class, UnitState.ACTIVE);
role = xr.getType(spec, ROLE_TAG, Role.class, spec.getDefaultRole());
roleCount = xr.getAttribute(ROLE_COUNT_TAG, role.getMaximumCount());
setLocationNoUpdate(xr.getLocationAttribute(game, LOCATION_TAG, true));
entryLocation = xr.getLocationAttribute(game, ENTRY_LOCATION_TAG,
true);
movesLeft = xr.getAttribute(MOVES_LEFT_TAG, 0);
workLeft = xr.getAttribute(WORK_LEFT_TAG, 0);
attrition = xr.getAttribute(ATTRITION_TAG, 0);
nationality = xr.getAttribute(NATIONALITY_TAG, (String)null);
ethnicity = xr.getAttribute(ETHNICITY_TAG, (String)null);
turnsOfTraining = xr.getAttribute(TURNS_OF_TRAINING_TAG, 0);
hitPoints = xr.getAttribute(HIT_POINTS_TAG, -1);
teacher = xr.makeFreeColObject(game, TEACHER_TAG, Unit.class, false);
student = xr.makeFreeColObject(game, STUDENT_TAG, Unit.class, false);
setHomeIndianSettlement(xr.makeFreeColObject(game,
INDIAN_SETTLEMENT_TAG, IndianSettlement.class, false));
treasureAmount = xr.getAttribute(TREASURE_AMOUNT_TAG, 0);
destination = xr.getLocationAttribute(game, DESTINATION_TAG, true);
tradeRoute = xr.findFreeColGameObject(game, TRADE_ROUTE_TAG,
TradeRoute.class, (TradeRoute)null, false);
currentStop = (tradeRoute == null) ? -1
: xr.getAttribute(CURRENT_STOP_TAG, 0);
experienceType = xr.getType(spec, EXPERIENCE_TYPE_TAG,
GoodsType.class, (GoodsType)null);
if (experienceType == null && workType != null) {
experienceType = workType;
}
experience = xr.getAttribute(EXPERIENCE_TAG, 0);
visibleGoodsCount = xr.getAttribute(VISIBLE_GOODS_COUNT_TAG, -1);
// Make sure you do this after experience and location stuff.
changeWorkType(xr.getType(spec, WORK_TYPE_TAG, GoodsType.class, null));
}
示例7: readAttributes
import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
super.readAttributes(xr);
final Specification spec = getSpecification();
final Game game = getGame();
name = xr.getAttribute(USERNAME_TAG, (String)null);
nationId = xr.getAttribute(NATION_ID_TAG, (String)null);
if (isUnknownEnemy()) {
nationType = null;
} else {
nationType = xr.getType(spec, NATION_TYPE_TAG,
NationType.class, (NationType)null);
}
admin = xr.getAttribute(ADMIN_TAG, false);
gold = xr.getAttribute(GOLD_TAG, 0);
immigration = xr.getAttribute(IMMIGRATION_TAG, 0);
liberty = xr.getAttribute(LIBERTY_TAG, 0);
interventionBells = xr.getAttribute(INTERVENTION_BELLS_TAG, 0);
oldSoL = xr.getAttribute(OLD_SOL_TAG, 0);
score = xr.getAttribute(SCORE_TAG, 0);
ready = xr.getAttribute(READY_TAG, false);
ai = xr.getAttribute(AI_TAG, false);
dead = xr.getAttribute(DEAD_TAG, false);
bankrupt = xr.getAttribute(BANKRUPT_TAG, false);
tax = xr.getAttribute(TAX_TAG, 0);
changePlayerType(xr.getAttribute(PLAYER_TYPE_TAG,
PlayerType.class, (PlayerType)null));
currentFather = xr.getType(spec, CURRENT_FATHER_TAG,
FoundingFather.class, (FoundingFather)null);
immigrationRequired = xr.getAttribute(IMMIGRATION_REQUIRED_TAG, 12);
newLandName = xr.getAttribute(NEW_LAND_NAME_TAG, (String)null);
independentNationName = xr.getAttribute(INDEPENDENT_NATION_NAME_TAG,
(String)null);
attackedByPrivateers = xr.getAttribute(ATTACKED_BY_PRIVATEERS_TAG,
false);
entryTile = xr.makeFreeColObject(game, ENTRY_LOCATION_TAG,
Tile.class, false);
}