當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。