本文整理汇总了Java中net.sf.freecol.common.model.EuropeWas类的典型用法代码示例。如果您正苦于以下问题:Java EuropeWas类的具体用法?Java EuropeWas怎么用?Java EuropeWas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EuropeWas类属于net.sf.freecol.common.model包,在下文中一共展示了EuropeWas类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: askEmbark
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Embark onto a carrier.
*
* @param unit The {@code Unit} to embark.
* @param carrier The carrier {@code Unit} to board.
* @return True if boarding succeeded.
*/
private boolean askEmbark(Unit unit, Unit carrier) {
ColonyWas colonyWas = (unit.getColony() != null)
? new ColonyWas(unit.getColony()) : null;
EuropeWas europeWas = (unit.isInEurope())
? new EuropeWas(unit.getOwner().getEurope()) : null;
UnitWas unitWas = new UnitWas(unit);
if (askServer().embark(unit, carrier, null)
&& unit.getLocation() == carrier) {
sound("sound.event.loadCargo");
unitWas.fireChanges();
if (colonyWas != null) colonyWas.fireChanges();
if (europeWas != null) europeWas.fireChanges();
return true;
}
return false;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:24,
代码来源:InGameController.java
示例2: moveAwayFromEurope
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Move a unit from off map to an on map location.
*
* @param unit The {@code Unit} to be moved.
* @param destination The {@code Location} to be moved to.
* @return True if automatic movement of the unit can proceed (never).
*/
private boolean moveAwayFromEurope(Unit unit, Location destination) {
// Autoload emigrants.
List<Unit> ul;
if (getClientOptions().getBoolean(ClientOptions.AUTOLOAD_EMIGRANTS)
&& unit.isInEurope()
&& !(ul = transform(unit.getOwner().getEurope().getUnits(),
Unit.sentryPred)).isEmpty()) {
// Can still proceed even if moves consumed
moveAutoload(unit, ul);
}
EuropeWas europeWas = (!unit.isInEurope()) ? null
: new EuropeWas(unit.getOwner().getEurope());
UnitWas unitWas = new UnitWas(unit);
boolean ret = askServer().moveTo(unit, destination);
if (ret) {
unitWas.fireChanges();
if (europeWas != null) europeWas.fireChanges();
updateGUI(null);
}
return ret;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:30,
代码来源:InGameController.java
示例3: buyGoods
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Buy goods in Europe.
* The amount of goods is adjusted to the space in the carrier.
*
* Called from CargoPanel, TilePopup, loadCargo()
*
* @param type The type of goods to buy.
* @param amount The amount of goods to buy.
* @param carrier The {@code Unit} acting as carrier.
* @return True if the purchase succeeds.
*/
public boolean buyGoods(GoodsType type, int amount, Unit carrier) {
if (!requireOurTurn() || type == null || amount <= 0
|| carrier == null
|| !carrier.isInEurope()
|| !getMyPlayer().owns(carrier)) return false;
final Europe europe = carrier.getOwner().getEurope();
EuropeWas europeWas = new EuropeWas(europe);
UnitWas unitWas = new UnitWas(carrier);
boolean ret = askLoadGoods(europe, type, amount, carrier);
if (ret) {
sound("sound.event.loadCargo");
europeWas.fireChanges();
unitWas.fireChanges();
updateGUI(null);
}
return ret;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:30,
代码来源:InGameController.java
示例4: sellGoods
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Sells goods in Europe.
*
* Called from EuropePanel.MarketPanel, EuropePanel.unloadAction,
* unload(), unloadCargo()
*
* @param goods The goods to be sold.
* @return True if the sale succeeds.
*/
public boolean sellGoods(Goods goods) {
if (!requireOurTurn() || goods == null
|| !(goods.getLocation() instanceof Unit)) return false;
final Player player = getMyPlayer();
Unit carrier = (Unit)goods.getLocation();
Europe europe = player.getEurope();
EuropeWas europeWas = new EuropeWas(europe);
UnitWas unitWas = new UnitWas(carrier);
boolean ret = askUnloadGoods(goods.getType(), goods.getAmount(), carrier);
if (ret) {
sound("sound.event.sellCargo");
europeWas.fireChanges();
unitWas.fireChanges();
updateGUI(null);
}
return ret;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:29,
代码来源:InGameController.java
示例5: trainUnitInEurope
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Trains a unit of a specified type in Europe.
*
* Called from NewUnitPanel
*
* @param unitType The type of unit to be trained.
* @return True if a new unit was trained.
*/
public boolean trainUnitInEurope(UnitType unitType) {
if (!requireOurTurn() || unitType == null) return false;
final Player player = getMyPlayer();
final Europe europe = player.getEurope();
if (!player.checkGold(europe.getUnitPrice(unitType))) {
getGUI().showInformationMessage("info.notEnoughGold");
return false;
}
EuropeWas europeWas = new EuropeWas(europe);
Unit newUnit = null;
boolean ret = askServer().trainUnitInEurope(unitType)
&& (newUnit = europeWas.getNewUnit()) != null;
if (ret) {
europeWas.fireChanges();
getGUI().setActiveUnit(newUnit);
updateGUI(null);
}
return ret;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:30,
代码来源:InGameController.java
示例6: trainUnitInEurope
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Trains a unit of a specified type in Europe.
*
* Called from NewUnitPanel
*
* @param unitType The type of unit to be trained.
* @return True if a new unit was trained.
*/
public boolean trainUnitInEurope(UnitType unitType) {
if (!requireOurTurn() || unitType == null) return false;
final Player player = getMyPlayer();
final Europe europe = player.getEurope();
if (!player.checkGold(europe.getUnitPrice(unitType))) {
getGUI().showInformationMessage("info.notEnoughGold");
return false;
}
EuropeWas europeWas = new EuropeWas(europe);
Unit newUnit = null;
boolean ret = askServer().trainUnitInEurope(unitType)
&& (newUnit = europeWas.getNewUnit()) != null;
if (ret) {
europeWas.fireChanges();
player.setNextActiveUnit(newUnit);
getGUI().setActiveUnit(newUnit);
updateGUI(null);
}
return ret;
}
开发者ID:wintertime,
项目名称:FreeCol,
代码行数:31,
代码来源:InGameController.java
示例7: trainUnitInEurope
点赞 3
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Trains a unit of a specified type in Europe.
*
* @param unitType The type of unit to be trained.
*/
public void trainUnitInEurope(UnitType unitType) {
if (!requireOurTurn()) return;
Player player = freeColClient.getMyPlayer();
Europe europe = player.getEurope();
if (!player.checkGold(europe.getUnitPrice(unitType))) {
gui.errorMessage("notEnoughGold");
return;
}
EuropeWas europeWas = new EuropeWas(europe);
if (askServer().trainUnitInEurope(unitType)) {
gui.updateMenuBar();
europeWas.fireChanges();
Unit newUnit = europeWas.getNewUnit();
if (newUnit != null) {
player.setNextActiveUnit(newUnit);
gui.setActiveUnit(newUnit);
}
}
}
开发者ID:vishal-mittal,
项目名称:SOEN6471-FreeCol,
代码行数:27,
代码来源:InGameController.java
示例8: askEmigrate
点赞 2
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* A unit in Europe emigrates.
*
* This is unusual for an ask* routine in that it uses a *Was
* structure, but it is needed to extract the unit.
*
* @param europe The {@code Europe} where the unit appears.
* @param slot The slot to choose, [0..RECRUIT_COUNT].
* @return The new {@code Unit} or null on failure.
*/
private Unit askEmigrate(Europe europe, int slot) {
if (europe == null
|| !MigrationType.validMigrantSlot(slot)) return null;
EuropeWas europeWas = new EuropeWas(europe);
Unit newUnit = null;
if (askServer().emigrate(slot)
&& (newUnit = europeWas.getNewUnit()) != null) {
europeWas.fireChanges();
}
return newUnit;
}
开发者ID:FreeCol,
项目名称:freecol,
代码行数:23,
代码来源:InGameController.java
示例9: emigrate
点赞 2
import net.sf.freecol.common.model.EuropeWas; //导入依赖的package包/类
/**
* Emigrate a unit from Europe.
*
* @param player The <code>Player</code> that owns the unit.
* @param slot The slot to emigrate from.
* @return The unit that emigrated, or null on failure.
*/
private Unit emigrate(Player player, int slot) {
Europe europe = player.getEurope();
EuropeWas europeWas = new EuropeWas(europe);
if (askServer().emigrate(slot)) {
europeWas.fireChanges();
gui.updateMenuBar();
return europeWas.getNewUnit();
}
return null;
}
开发者ID:vishal-mittal,
项目名称:SOEN6471-FreeCol,
代码行数:18,
代码来源:InGameController.java