예제 #1
0
  private void startGame(final GameType gameType) {
    final DeckProxy humanDeck = VSubmenuWinston.SINGLETON_INSTANCE.getLstDecks().getSelectedItem();
    final int aiIndex = 0;

    if (humanDeck == null) {
      FOptionPane.showErrorDialog(
          "No deck selected for human.\n(You may need to build a new deck)", "No Deck");
      return;
    }

    if (FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
      final String errorMessage =
          gameType.getDeckFormat().getDeckConformanceProblem(humanDeck.getDeck());
      if (null != errorMessage) {
        FOptionPane.showErrorDialog(
            "Your deck " + errorMessage + " Please edit or choose a different deck.",
            "Invalid Deck");
        return;
      }
    }

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            SOverlayUtils.startGameOverlay();
            SOverlayUtils.showOverlay();
          }
        });

    final DeckGroup opponentDecks = FModel.getDecks().getWinston().get(humanDeck.getName());
    final Deck aiDeck = opponentDecks.getAiDecks().get(aiIndex);
    if (aiDeck == null) {
      throw new IllegalStateException("Draft: Computer deck is null!");
    }

    final List<RegisteredPlayer> starter = new ArrayList<RegisteredPlayer>();
    final RegisteredPlayer human =
        new RegisteredPlayer(humanDeck.getDeck()).setPlayer(GamePlayerUtil.getGuiPlayer());
    starter.add(human);
    starter.add(new RegisteredPlayer(aiDeck).setPlayer(GamePlayerUtil.createAiPlayer()));

    final HostedMatch hostedMatch = GuiBase.getInterface().hostMatch();
    hostedMatch.startMatch(
        GameType.Winston, null, starter, human, GuiBase.getInterface().getNewGuiGame());

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            SOverlayUtils.hideOverlay();
          }
        });
  }
예제 #2
0
 public static RegisteredPlayer getGuiRegisteredPlayer(Game game) {
   LobbyPlayer guiPlayer = GuiBase.getInterface().getGuiPlayer();
   for (RegisteredPlayer player : game.getMatch().getPlayers()) {
     if (player.getPlayer() == guiPlayer) {
       return player;
     }
   }
   return null;
 }
  VSubmenuQuestDraft() {

    SkinImage avatar = FSkin.getAvatars().get(GuiBase.getInterface().getAvatarCount() - 1);

    matchups[0] =
        new PnlMatchup(
            PnlMatchup.LineDirection.DOWN, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
    matchups[0].setPlayerOne("Undetermined", avatar);
    matchups[0].setPlayerTwo("Undetermined", avatar);

    matchups[1] =
        new PnlMatchup(
            PnlMatchup.LineDirection.UP, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
    matchups[1].setPlayerOne("Undetermined", avatar);
    matchups[1].setPlayerTwo("Undetermined", avatar);

    matchups[2] =
        new PnlMatchup(
            PnlMatchup.LineDirection.DOWN, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
    matchups[2].setPlayerOne("Undetermined", avatar);
    matchups[2].setPlayerTwo("Undetermined", avatar);

    matchups[3] =
        new PnlMatchup(
            PnlMatchup.LineDirection.UP, PnlMatchup.LineSide.RIGHT, PnlMatchup.BoxSize.SMALL);
    matchups[3].setPlayerOne("Undetermined", avatar);
    matchups[3].setPlayerTwo("Undetermined", avatar);

    matchups[4] =
        new PnlMatchup(
            PnlMatchup.LineDirection.DOWN, PnlMatchup.LineSide.BOTH, PnlMatchup.BoxSize.MEDIUM);
    matchups[4].setPlayerOne("Undetermined", avatar);
    matchups[4].setPlayerTwo("Undetermined", avatar);

    matchups[5] =
        new PnlMatchup(
            PnlMatchup.LineDirection.UP, PnlMatchup.LineSide.BOTH, PnlMatchup.BoxSize.MEDIUM);
    matchups[5].setPlayerOne("Undetermined", avatar);
    matchups[5].setPlayerTwo("Undetermined", avatar);

    matchups[6] =
        new PnlMatchup(
            PnlMatchup.LineDirection.STRAIGHT, PnlMatchup.LineSide.BOTH, PnlMatchup.BoxSize.LARGE);
    matchups[6].setPlayerOne("Undetermined", avatar);
    matchups[6].setPlayerTwo("Undetermined", avatar);

    matchups[7] =
        new PnlMatchup(
            PnlMatchup.LineDirection.STRAIGHT,
            PnlMatchup.LineSide.LEFT,
            PnlMatchup.BoxSize.LARGE_SINGLE,
            true);
    matchups[7].setPlayerOne("Undetermined", avatar);
    matchups[7].setPlayerTwo("Undetermined", avatar);

    pnlDeckImage = new ProportionalPanel(FSkin.getImage(FSkinProp.IMG_QUEST_DRAFT_DECK), 680, 475);

    final String constraints = "h 30px!, gap 0 0 0 10px";
    pnlStats.setLayout(new MigLayout("insets 0, gap 0, wrap, hidemode 0"));
    pnlStats.add(lblPastResults, "h 30px!, gap 0 0 0 25px");
    pnlStats.add(lblFirst, constraints);
    pnlStats.add(lblSecond, constraints);
    pnlStats.add(lblThird, constraints);
    pnlStats.add(lblFourth, constraints);
    pnlStats.add(lblTokens, "h 30px!, gap 0 0 50px 10px, ax center");
    pnlStats.add(btnSpendToken, "w 150px!, h 40px!, ax center");
    pnlStats.setOpaque(false);

    btnSpendToken.setToolTipText("Creates a new tournament that can be played immediately.");
  }