• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ChooseFoundingFatherMessage类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中net.sf.freecol.common.networking.ChooseFoundingFatherMessage的典型用法代码示例。如果您正苦于以下问题:Java ChooseFoundingFatherMessage类的具体用法?Java ChooseFoundingFatherMessage怎么用?Java ChooseFoundingFatherMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

ChooseFoundingFatherMessage类属于net.sf.freecol.common.networking包,在下文中一共展示了ChooseFoundingFatherMessage类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: chooseFoundingFather

点赞 2

import net.sf.freecol.common.networking.ChooseFoundingFatherMessage; //导入依赖的package包/类
/**
 * Handles an "chooseFoundingFather"-request.
 *
 * @param element The element (root element in a DOM-parsed XML tree) that
 *            holds all the information.
 */
private Element chooseFoundingFather(Element element) {
    ChooseFoundingFatherMessage message
        = new ChooseFoundingFatherMessage(getGame(), element);
    List<FoundingFather> ffs = message.getFathers();
    FoundingFather ff = gui.showChooseFoundingFatherDialog(ffs);
    if (ff != null) {
        message.setResult(ff);
        getFreeColClient().getMyPlayer().setCurrentFather(ff);
    }
    return message.toXMLElement();
}
 

开发者ID:vishal-mittal,
项目名称:SOEN6471-FreeCol,
代码行数:18,
代码来源:InGameInputHandler.java

示例2: nextFoundingFather

点赞 2

import net.sf.freecol.common.networking.ChooseFoundingFatherMessage; //导入依赖的package包/类
/**
 * Queries a player to choose their next founding father in a future.
 *
 * @param serverPlayer The <code>ServerPlayer</code> to ask.
 */
private void nextFoundingFather(final ServerPlayer serverPlayer) {
    if (!serverPlayer.canRecruitFoundingFather()) return;
    if (serverPlayer.getOfferedFathers().isEmpty()) {
        serverPlayer.setOfferedFathers(serverPlayer
            .getRandomFoundingFathers(random));
    }
    final List<FoundingFather> ffs = serverPlayer.getOfferedFathers();
    if (ffs.isEmpty()) return;
    askThisTurn(serverPlayer, new ChooseFoundingFatherMessage(ffs),
        new DOMMessageHandler() {
            public DOMMessage handle(DOMMessage request) {
                ChooseFoundingFatherMessage message
                    = (ChooseFoundingFatherMessage)request;
                FoundingFather ff = message.getResult();
                if (ff == null) {
                    logger.warning("No founding father selected");
                } else if (!ffs.contains(ff)) {
                    logger.warning("Invalid founding father: "
                        + ff.getId());
                } else {
                    serverPlayer.setCurrentFather(ff);
                    serverPlayer.clearOfferedFathers();
                    logger.info("Selected founding father: " + ff);
                }
                return null;
            }
        }, null);
}
 

开发者ID:vishal-mittal,
项目名称:SOEN6471-FreeCol,
代码行数:34,
代码来源:InGameController.java

示例3: chooseFoundingFather

点赞 2

import net.sf.freecol.common.networking.ChooseFoundingFatherMessage; //导入依赖的package包/类
/**
 * Handles a "chooseFoundingFather"-message.
 * Only meaningful for AIPlayer types that implement selectFoundingFather.
 *
 * @param connection The connection the message was received on.
 * @param element The element (root element in a DOM-parsed XML tree) that
 *     holds all the information.
 */
private Element chooseFoundingFather(final DummyConnection connection,
                                     Element element) {
    ChooseFoundingFatherMessage message
        = new ChooseFoundingFatherMessage(aiMain.getGame(), element);
    AIPlayer aiPlayer = getAIPlayer();
    FoundingFather ff = aiPlayer.selectFoundingFather(message.getFathers());
    if (ff != null) message.setResult(ff);
    return message.toXMLElement();
}
 

开发者ID:vishal-mittal,
项目名称:SOEN6471-FreeCol,
代码行数:18,
代码来源:AIInGameInputHandler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)