QWidget *PlayerCardDialog::createEquipArea() {
    QGroupBox *area = new QGroupBox(tr("Equip area"));
    QVBoxLayout *layout = new QVBoxLayout;

    WrappedCard *weapon = player->getWeapon();
    if (weapon) {
        PlayerCardButton *button = new PlayerCardButton(weapon->getFullName());
        button->setIcon(G_ROOM_SKIN.getCardSuitPixmap(Sanguosha->getEngineCard(weapon->getId())->getSuit()));
        button->setEnabled(!disabled_ids.contains(weapon->getEffectiveId())
							&& (method != Card::MethodDiscard || Self->canDiscard(player, weapon->getEffectiveId())));
        mapper.insert(button, weapon->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    WrappedCard *armor = player->getArmor();
    if (armor) {
        PlayerCardButton *button = new PlayerCardButton(armor->getFullName());
        button->setIcon(G_ROOM_SKIN.getCardSuitPixmap(Sanguosha->getEngineCard(armor->getId())->getSuit()));
        button->setEnabled(!disabled_ids.contains(armor->getEffectiveId())
							&& (method != Card::MethodDiscard || Self->canDiscard(player, armor->getEffectiveId())));
        mapper.insert(button, armor->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    WrappedCard *horse = player->getDefensiveHorse();
    if (horse) {
        PlayerCardButton *button = new PlayerCardButton(horse->getFullName() + tr("(+1 horse)"));
        button->setIcon(G_ROOM_SKIN.getCardSuitPixmap(Sanguosha->getEngineCard(horse->getId())->getSuit()));
        button->setEnabled(!disabled_ids.contains(horse->getEffectiveId())
							&& (method != Card::MethodDiscard || Self->canDiscard(player, horse->getEffectiveId())));
        mapper.insert(button, horse->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    horse = player->getOffensiveHorse();
    if (horse) {
        PlayerCardButton *button = new PlayerCardButton(horse->getFullName() + tr("(-1 horse)"));
        button->setIcon(G_ROOM_SKIN.getCardSuitPixmap(Sanguosha->getEngineCard(horse->getId())->getSuit()));
        button->setEnabled(!disabled_ids.contains(horse->getEffectiveId())
							&& (method != Card::MethodDiscard || Self->canDiscard(player, horse->getEffectiveId())));
        mapper.insert(button, horse->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    if (layout->count() == 0) {
        PlayerCardButton *no_equip = new PlayerCardButton(tr("No equip"));
        no_equip->setEnabled(false);
        no_equip->setObjectName("noequip_button");
        return no_equip;
    } else {
        area->setLayout(layout);
        return area;
    }
}
Ejemplo n.º 2
0
QWidget *PlayerCardDialog::createHandcardButton()
{
    if (!player->isKongcheng() && (Self == player || handcard_visible)) {
        QGroupBox *area = new QGroupBox(tr("Handcard area"));
        QVBoxLayout *layout = new QVBoxLayout;
        QList<const Card *> cards = player->getHandcards();
        for (int i = 0; i < cards.length(); i += 2) {
            const Card *card = Sanguosha->getEngineCard(cards.at(i)->getId());
            PlayerCardButton *button1 = new PlayerCardButton(card->getFullName());
            button1->setIcon(G_ROOM_SKIN.getCardSuitPixmap(card->getSuit()));

            mapper.insert(button1, card->getId());
            connect(button1, SIGNAL(clicked()), this, SLOT(emitId()));

            PlayerCardButton *button2 = NULL;
            if (i < cards.length() - 1) {
                card = Sanguosha->getEngineCard(cards.at(i + 1)->getId());;
                button2 = new PlayerCardButton(card->getFullName());
                button2->setIcon(G_ROOM_SKIN.getCardSuitPixmap(card->getSuit()));

                mapper.insert(button2, card->getId());
                connect(button2, SIGNAL(clicked()), this, SLOT(emitId()));
            }
            if (button1 && button2) {
                QHBoxLayout *hlayout = new QHBoxLayout;
                button1->setScale(0.65);
                button2->setScale(0.65);
                hlayout->addWidget(button1);
                hlayout->addWidget(button2);
                layout->addLayout(hlayout);
            } else {
                Q_ASSERT(button1 != NULL);
                layout->addWidget(button1);
            }
        }

        area->setLayout(layout);
        return area;
    }

    PlayerCardButton *button = new PlayerCardButton(tr("Handcard"));
    button->setObjectName("handcard_button");
    int num = player->getHandcardNum();
    if (num == 0) {
        button->setDescription(tr("This guy has no any hand cards"));
        button->setEnabled(false);
    } else {
        button->setDescription(tr("This guy has %1 hand card(s)").arg(num));
        button->setEnabled(method != Card::MethodDiscard || Self->canDiscard(player, "h"));
        mapper.insert(button, -1);
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
    }

    return button;
}
Ejemplo n.º 3
0
QWidget *PlayerCardDialog::createEquipArea(){
    QGroupBox *area = new QGroupBox(tr("Equip area"));
    QVBoxLayout *layout = new QVBoxLayout();

    const Weapon *weapon = player->getWeapon();
    if(weapon){
        QCommandLinkButton *button = new QCommandLinkButton(weapon->getFullName());
        button->setIcon(weapon->getSuitIcon());

        mapper.insert(button, weapon->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    const Armor *armor = player->getArmor();
    if(armor){
        QCommandLinkButton *button = new QCommandLinkButton(armor->getFullName());
        button->setIcon(armor->getSuitIcon());

        mapper.insert(button, armor->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    const Horse *horse = player->getDefensiveHorse();
    if(horse){
        QCommandLinkButton *button = new QCommandLinkButton(horse->getFullName() + tr("(+1 horse)"));
        button->setIcon(horse->getSuitIcon());

        mapper.insert(button, horse->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    horse = player->getOffensiveHorse();
    if(horse){
        QCommandLinkButton *button = new QCommandLinkButton(horse->getFullName() + tr("(-1 horse)"));
        button->setIcon(horse->getSuitIcon());

        mapper.insert(button, horse->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
        layout->addWidget(button);
    }

    if(layout->count() == 0){
        QCommandLinkButton *no_equip = new QCommandLinkButton(tr("No equip"));
        no_equip->setEnabled(false);
        return no_equip;
    }else{
        area->setLayout(layout);
        return area;
    }
}
QWidget *PlayerCardDialog::createJudgingArea() {
    QGroupBox *area = new QGroupBox(tr("Judging Area"));
    QVBoxLayout *layout = new QVBoxLayout;
    QList<const Card *> cards = player->getJudgingArea();
    foreach (const Card *card, cards) {
        const Card *real = Sanguosha->getEngineCard(card->getId());
        PlayerCardButton *button = new PlayerCardButton(real->getFullName());
        button->setIcon(G_ROOM_SKIN.getCardSuitPixmap(real->getSuit()));
        layout->addWidget(button);
        button->setEnabled(!disabled_ids.contains(card->getEffectiveId())
                            && (method != Card::MethodDiscard || Self->canDiscard(player, card->getEffectiveId())));
        mapper.insert(button, card->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
    }

    if (layout->count() == 0) {
        PlayerCardButton *button = new PlayerCardButton(tr("No judging cards"));
        button->setEnabled(false);
        button->setObjectName("nojuding_button");
        return button;
    } else {
        area->setLayout(layout);
        return area;
    }
}
Ejemplo n.º 5
0
QWidget *PlayerCardDialog::createJudgingArea(){
    QGroupBox *area = new QGroupBox(tr("Judging Area"));
    QVBoxLayout *layout = new QVBoxLayout;
    QStack<const Card *> cards = player->getJudgingArea();
    foreach(const Card *card, cards){
        QCommandLinkButton *button = new QCommandLinkButton(card->getFullName());
        button->setIcon(card->getSuitIcon());
        layout->addWidget(button);

        mapper.insert(button, card->getId());
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
    }
Ejemplo n.º 6
0
QWidget *PlayerCardDialog::createHandcardButton(){
    if(!player->isKongcheng() && ((Self->hasSkill("dongcha") && player->hasFlag("dongchaee")) || Self == player)){
        QGroupBox *area = new QGroupBox(tr("Handcard area"));
        QVBoxLayout *layout =  new QVBoxLayout;
        QList<const Card *> cards = player->getCards();
        foreach(const Card *card, cards){
            QCommandLinkButton *button = new QCommandLinkButton(card->getFullName());
            button->setIcon(card->getSuitIcon());

            mapper.insert(button, card->getId());
            connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
            layout->addWidget(button);
        }
Ejemplo n.º 7
0
QWidget *PlayerCardDialog::createHandcardButton(){
    QCommandLinkButton *button = new QCommandLinkButton(tr("Handcard"));
    int num = player->getHandcardNum();
    if(num == 0){
        button->setDescription(tr("This guy has no any hand cards"));
        button->setEnabled(false);
    }else{
        button->setDescription(tr("This guy has %1 hand card(s)").arg(num));

        mapper.insert(button, -1);
        connect(button, SIGNAL(clicked()), this, SLOT(emitId()));
    }

    return button;
}