当前位置: 首页>>代码示例>>Java>>正文


Java FreeColXMLReader.findFreeColGameObject方法代码示例

本文整理汇总了Java中net.sf.freecol.common.io.FreeColXMLReader.findFreeColGameObject方法的典型用法代码示例。如果您正苦于以下问题:Java FreeColXMLReader.findFreeColGameObject方法的具体用法?Java FreeColXMLReader.findFreeColGameObject怎么用?Java FreeColXMLReader.findFreeColGameObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.freecol.common.io.FreeColXMLReader的用法示例。


在下文中一共展示了FreeColXMLReader.findFreeColGameObject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    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);

    tile = xr.findFreeColGameObject(game, TILE_TAG,
                                    Tile.class, (Tile)null, true);

    String newType = xr.getAttribute(SETTLEMENT_TYPE_TAG, (String)null);
    type = owner.getNationType().getSettlementType(newType);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:23,代码来源:Settlement.java

示例2: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    final Specification spec = getSpecification();

    owner = xr.findFreeColGameObject(getGame(), OWNER_TAG,
                                     Player.class, (Player)null, true);

    baseRecruitPrice = xr.getAttribute(RECRUIT_PRICE_TAG,
                                       RECRUIT_PRICE_INITIAL);

    recruitLowerCap = xr.getAttribute(RECRUIT_LOWER_CAP_TAG,
                                      LOWER_CAP_INITIAL);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:19,代码来源:Europe.java

示例3: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    final AIMain aiMain = getAIMain();

    unit = xr.findFreeColGameObject(aiMain.getGame(), ID_ATTRIBUTE_TAG,
                                    Unit.class, (Unit)null, true);
    if (!unit.isInitialized()) {
        xr.nextTag(); // Move off the opening <AIUnit> tag
        throw new XMLStreamException("AIUnit for uninitialized Unit: "
            + unit.getId());
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:18,代码来源:AIUnit.java

示例4: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    final AIMain aiMain = getAIMain();

    player = xr.findFreeColGameObject(aiMain.getGame(), ID_ATTRIBUTE_TAG,
        ServerPlayer.class, (ServerPlayer)null, true);

    Random rnd = Utils.restoreRandomState(xr.getAttribute(RANDOM_STATE_TAG,
                                                          (String)null));
    aiRandom = (rnd != null) ? rnd
        : new Random(aiMain.getRandomSeed("Seed for " + getId()));
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:18,代码来源:AIPlayer.java

示例5: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    this.colony = xr.findFreeColGameObject(getGame(), COLONY_TAG,
        Colony.class, (Colony)null, true);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:WorkLocation.java

示例6: 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);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:34,代码来源:Region.java

示例7: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    final Specification spec = getSpecification();

    super.readAttributes(xr);

    tile = xr.findFreeColGameObject(getGame(), TILE_TAG,
                                    Tile.class, (Tile)null, true);

    type = xr.getType(spec, TYPE_TAG,
                      ResourceType.class, (ResourceType)null);

    quantity = xr.getAttribute(QUANTITY_TAG, 0);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:18,代码来源:Resource.java

示例8: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    player = xr.findFreeColGameObject(getGame(), PLAYER_TAG,
                                      Player.class, (Player)null, true);

    this.supportSea = xr.getAttribute(SUPPORT_SEA_TAG, false);

    this.displeasure = xr.getAttribute(DISPLEASURE_TAG, false);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:15,代码来源:Monarch.java

示例9: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    owner = xr.findFreeColGameObject(getGame(), OWNER_TAG,
                                     Player.class, (Player)null, true);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:11,代码来源:Market.java

示例10: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    this.name = xr.getAttribute(NAME_TAG, (String)null);

    this.owner = xr.findFreeColGameObject(getGame(), OWNER_TAG,
                                          Player.class, (Player)null, true);

    this.silent = xr.getAttribute(SILENT_TAG, false);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:15,代码来源:TradeRoute.java

示例11: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    tile = xr.findFreeColGameObject(getGame(), TILE_TAG,
                                    Tile.class, (Tile)null, true);

    type = xr.getAttribute(TYPE_TAG, RumourType.class, (RumourType)null);

    name = xr.getAttribute(NAME_TAG, (String)null);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:15,代码来源:LostCityRumour.java

示例12: readAttributes

import net.sf.freecol.common.io.FreeColXMLReader; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void readAttributes(FreeColXMLReader xr) throws XMLStreamException {
    super.readAttributes(xr);

    this.victim = xr.findFreeColGameObject(getGame(), VICTIM_TAG,
                                           Player.class, (Player)null, true);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:11,代码来源:InciteTradeItem.java

示例13: 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();

    x = xr.getAttribute(X_TAG, 0);

    y = xr.getAttribute(Y_TAG, 0);

    type = xr.getType(spec, TYPE_TAG, TileType.class, (TileType)null);
    if (type == null) { // Unexplored tile.
        style = 0;
        highSeasCount = -1;
        owner = null;
        region = null;
        moveToEurope = null;
        contiguity = -1;
        owningSettlement = null;
        return;
    }

    style = xr.getAttribute(STYLE_TAG, 0);

    String str = xr.getAttribute(CONNECTED_TAG, (String)null);
    if (str == null || str.isEmpty()) {
        highSeasCount = -1;
    } else {
        try {
            highSeasCount = Integer.parseInt(str);
        } catch (NumberFormatException nfe) {
            highSeasCount = -1;
        }
    }

    owner = xr.findFreeColGameObject(game, OWNER_TAG,
                                     Player.class, (Player)null, false);

    region = xr.findFreeColGameObject(game, REGION_TAG,
                                      Region.class, (Region)null, false);
    
    moveToEurope = (xr.hasAttribute(MOVE_TO_EUROPE_TAG))
        ? xr.getAttribute(MOVE_TO_EUROPE_TAG, false)
        : null;

    contiguity = xr.getAttribute(CONTIGUITY_TAG, -1);

    // Tiles are added to the settlement owned tiles list in Map.
    // Doing it here can cause cache weirdness.
    Location loc = xr.getLocationAttribute(game, OWNING_SETTLEMENT_TAG,
                                           true);
    owningSettlement = (loc instanceof Settlement) ? (Settlement)loc
        : null;
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:59,代码来源:Tile.java

示例14: 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));
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:77,代码来源:Unit.java


注:本文中的net.sf.freecol.common.io.FreeColXMLReader.findFreeColGameObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。