Package mage.view

Examples of mage.view.SimpleCardView


                        case "Select a starting player":
                            session.sendPlayerUUID(gameId, playerId);
                            break;
                        case "Select a card to discard":
                            log.info("hand size: " + gameView.getHand().size());
                            SimpleCardView card = gameView.getHand().values().iterator().next();
                            session.sendPlayerUUID(gameId, card.getId());
                            break;
                    }
                    break;
                }
            case "gameAsk":
View Full Code Here


            public void event(Event event) {
                if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
                    switch (event.getEventName()) {
                        case "double-click":
                        {
                            SimpleCardView cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getCards()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getCards().remove(card);
                                    break;
                                }
                            }
                            hidePopup();
                            refreshDeck();
                            break;
                        }
                        case "alt-double-click":
                        {
                            SimpleCardView cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getCards()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getCards().remove(card);
                                    deck.getSideboard().add(card);
                                    break;
                                }
                            }
                            hidePopup();
                            refreshDeck();
                            break;
                        }
                        case "set-number":
                        {
                            setCardNumberToCardsList(event, deck.getCards());
                        }                       
                    }
                } else {
                    // constructing phase or sideboarding during match -> card goes always to sideboard
                    switch (event.getEventName()) {
                        case "double-click":
                        case "alt-double-click":
                        {
                            SimpleCardView cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getCards()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getCards().remove(card);
                                    deck.getSideboard().add(card);
                                    cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
                                    break;
                                }
                            }      
                            hidePopup();
                            refreshDeck();
                            break;
                        }
                    }                   
                }
            }
        });
        this.deckArea.addSideboardEventListener(
                new Listener<Event>() {
            @Override
            public void event(Event event) {
                if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
                    // normal edit mode
                    switch (event.getEventName()) {
                        case "double-click":
                            // remove card from sideboard (don't add it to deck)
                            SimpleCardView cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getSideboard()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getSideboard().remove(card);
                                    break;
                                }
                            }  
                            hidePopup();
                            refreshDeck();
                            break;
                        case "alt-double-click":
                            // remove card from sideboard
                            cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getSideboard()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getSideboard().remove(card);
                                    deck.getCards().add(card);
                                    break;
                                }
                            }  
                            hidePopup();
                            refreshDeck();                           
                            break;
                        case "set-number":
                        {
                            setCardNumberToCardsList(event, deck.getSideboard());
                        }                            
                    }                   
                } else {
                    // construct phase or sideboarding during match
                    switch (event.getEventName()) {
                        case "double-click":
                        case "alt-double-click":
                            SimpleCardView cardView = (SimpleCardView) event.getSource();
                            for (Card card : deck.getSideboard()) {
                                if (card.getId().equals(cardView.getId())) {
                                    deck.getSideboard().remove(card);
                                    deck.getCards().add(card);
                                    break;
                                }
                            }   hidePopup();
View Full Code Here

        hidePopup();
        refreshDeck();
    }
   
    private void moveSelectorCardToDeck(Event event) {
        SimpleCardView cardView = (SimpleCardView) event.getSource();
        CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
        Card card = null;
        if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
            Iterator sideboard = deck.getSideboard().iterator();
            while (sideboard.hasNext()) {
                card = (Card) sideboard.next();
                if (card.getId().equals(cardView.getId())) {
                    break;
                }
            }
        } else {
            card = cardInfo != null ? cardInfo.getMockCard() : null;
View Full Code Here

            hidePopup();
        }       
    }

    private void moveSelectorCardToSideboard(Event event) {
        SimpleCardView cardView = (SimpleCardView) event.getSource();
        CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
        Card card = cardInfo != null ? cardInfo.getMockCard() : null;
        if (card != null) {
            deck.getSideboard().add(card);
        }
        if (cardInfoPane instanceof CardInfoPane) {
View Full Code Here

        this.draftBooster.addCardEventListener(
            new Listener<Event> () {
                @Override
                public void event(Event event) {
                    if (event.getEventName().equals("pick-a-card")) {
                        SimpleCardView source = (SimpleCardView) event.getSource();
                        DraftPickView view = session.sendCardPick(draftId, source.getId());
                        if (view != null) {
                            draftBooster.loadBooster(emptyView, bigCard);
                            draftPicks.loadCards(CardsViewUtil.convertSimple(view.getPicks()), bigCard, null);
                            Plugins.getInstance().getActionCallback().hidePopup();
                            setMessage("Waiting for other players");
                        }
                    }
                    if (event.getEventName().equals("mark-a-card")) {
                        SimpleCardView source = (SimpleCardView) event.getSource();
                        session.sendCardMark(draftId, source.getId());
                    }
                }
            }
        );
        setMessage("Pick a card");
View Full Code Here

TOP

Related Classes of mage.view.SimpleCardView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.