当前位置: 首页>>代码示例>>C++>>正文


C++ ActionEvent::getId方法代码示例

本文整理汇总了C++中ActionEvent::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionEvent::getId方法的具体用法?C++ ActionEvent::getId怎么用?C++ ActionEvent::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionEvent的用法示例。


在下文中一共展示了ActionEvent::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sellAction

void NpcSellDialog::sellAction(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    const int selectedItem = mShopItemList->getSelected();
    ShopItem *const item = mShopItems->at(selectedItem);
    if (!item || PlayerInfo::isItemProtected(item->getId()))
        return;

    if (eventId == "presell")
    {
        if (mAmountItems <= 0 || mAmountItems > mMaxItems)
            return;

        const ItemInfo &info = ItemDB::get(item->getId());
        if (info.isProtected())
        {
            ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog,
                                          // TRANSLATORS: sell confirmation header
                                          _("sell item"),
                                          // TRANSLATORS: sell confirmation message
                                          strprintf(_("Do you really want to sell %s?"),
                                                    info.getName().c_str()),
                                          SOUND_REQUEST,
                                          false,
                                          Modal_true);
            dialog->addActionListener(this);
            return;
        }
    }

    if (mAdvanced)
        sellManyItems(event.getId());
    else
        sellOneItem();
}
开发者ID:supermukmin,项目名称:ManaPlus,代码行数:35,代码来源:npcselldialog.cpp

示例2: action

void OutfitWindow::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "next")
    {
        next();
    }
    else if (eventId == "previous")
    {
        previous();
    }
    else if (eventId == "unequip")
    {
        if (mCurrentOutfit >= 0 && mCurrentOutfit < static_cast<int>(
            OUTFITS_COUNT))
        {
            mItemsUnequip[mCurrentOutfit] = mUnequipCheck->isSelected();
        }
    }
    else if (eventId == "equip")
    {
        wearOutfit(mCurrentOutfit);
        if (Game::instance())
            Game::instance()->setValidSpeed();
    }
    else if (eventId == "away")
    {
        mAwayOutfit = mCurrentOutfit;
        if (!mAwayOutfitCheck->isSelected())
            mAwayOutfitCheck->setSelected(true);
    }
}
开发者ID:nashley,项目名称:ManaPlus,代码行数:32,代码来源:outfitwindow.cpp

示例3: action

void NpcPostDialog::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "send")
    {
        if (mSender->getText().empty() || mText->getText().empty())
        {
            if (localChatTab)
            {
                // TRANSLATORS: npc post message error
                localChatTab->chatLog(_("Failed to send as sender or letter "
                    "invalid."));
            }
        }
        else
        {
            Net::getNpcHandler()->sendLetter(mNpcId, mSender->getText(),
                                             mText->getText());
        }
        setVisible(false);
    }
    else if (eventId == "cancel")
    {
        setVisible(false);
    }
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:26,代码来源:npcpostdialog.cpp

示例4: action

void DidYouKnowWindow::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "close")
    {
        setVisible(false);
    }
    else
    {
        const unsigned num = config.getIntValue("currentTip");
        if (eventId == "prev")
        {
            loadData(num - 1);
        }
        else if (eventId == "next")
        {
            loadData(num + 1);
        }
        else if (eventId == "openagain")
        {
            config.setValue("showDidYouKnow",
                mOpenAgainCheckBox->isSelected());
        }
    }
}
开发者ID:nashley,项目名称:ManaPlus,代码行数:25,代码来源:didyouknowwindow.cpp

示例5: action

void RenameListener::action(const ActionEvent &event)
{
    if (event.getId() == "ok" && viewport && mDialog)
    {
        const Map *const map = viewport->getMap();
        if (!map)
            return;

        const SpecialLayer *const sl = map->getSpecialLayer();
        MapItem *item = nullptr;
        if (sl)
        {
            item = sl->getTile(mMapItemX, mMapItemY);
            if (item)
                item->setComment(mDialog->getText());
        }
        item = map->findPortalXY(mMapItemX, mMapItemY);
        if (item)
            item->setComment(mDialog->getText());

        if (socialWindow)
            socialWindow->updatePortalNames();
    }
    mDialog = nullptr;
}
开发者ID:Action-Committee,项目名称:ManaPlus,代码行数:25,代码来源:renamelistener.cpp

示例6: action

void TextCommandEditor::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "magic")
    {
        mIsMagicCommand = true;
        showControls(Visible_true);
    }
    else if (eventId == "other")
    {
        mIsMagicCommand = false;
        showControls(Visible_false);
    }
    else if (eventId == "save")
    {
        save();
        scheduleDelete();
    }
    else if (eventId == "cancel")
    {
        scheduleDelete();
    }
    else if (eventId == "delete")
    {
        deleteCommand();
        scheduleDelete();
    }
}
开发者ID:Rawng,项目名称:ManaPlus,代码行数:28,代码来源:textcommandeditor.cpp

示例7: action

void MailViewWindow::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "close")
    {
        scheduleDelete();
    }
    else if (eventId == "attach")
    {
        if (mGetAttachButton)
            mailHandler->getAttach(mMessage->id);
    }
    else if (eventId == "next")
    {
        if (mMessage)
            mailWindow->viewNext(mMessage->id);
    }
    else if (eventId == "prev")
    {
        if (mMessage)
            mailWindow->viewPrev(mMessage->id);
    }
    else if (eventId == "reply")
    {
        if (!mMessage)
            return;
        if (mailEditWindow)
            mailEditWindow->scheduleDelete();
        CREATEWIDGETV0(mailEditWindow, MailEditWindow);
        mailEditWindow->setTo(mMessage->sender);
        mailEditWindow->setSubject("Re:" + mMessage->title);
        mailEditWindow->setMessage(">" + mMessage->text);
        scheduleDelete();
    }
}
开发者ID:supermukmin,项目名称:ManaPlus,代码行数:35,代码来源:mailviewwindow.cpp

示例8: action

void TextSelectDialog::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();

    if (eventId == "quit")
    {
        close();
        return;
    }

    const int selectedItem = mItemList->getSelected();

    // The following actions require a valid item selection
    if (selectedItem == -1 ||
        selectedItem >= mModel->getNumberOfElements())
    {
        return;
    }
    else if (eventId == "select")
    {
        const int index = mItemList->getSelected();
        if (index < 0 || index >= CAST_S32(mModel->size()))
            return;
        mText = mModel->getElementAt(index);
        distributeActionEvent();
        close();
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:28,代码来源:textselectdialog.cpp

示例9: action

void KillStats::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "reset")
    {
        mKillCounter = 0;
        mExpCounter = 0;
        mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s",
            PlayerInfo::getAttribute(Attributes::EXP_NEEDED) / 100, "?"));
        // TRANSLATORS: kill stats window label
        mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"), "?", "?"));
        // TRANSLATORS: kill stats window label
        mLine5->setCaption(strprintf(_("Avg Exp: %s"), "?"));
        mLine6->setCaption(strprintf(
            // TRANSLATORS: kill stats window label
            _("No. of avg mob to next level: %s"), "?"));

        resetTimes();
    }
    else if (eventId == "timer")
    {
        mKillTimer = 0;
        mKillTCounter = 0;
        mExpTCounter = 0;
        mLine7->setCaption(strprintf(
            // TRANSLATORS: kill stats window label
            _("Kills/Min: %s, Exp/Min: %s"), "?", "?"));

        resetTimes();
    }
}
开发者ID:Rawng,项目名称:ManaPlus,代码行数:31,代码来源:killstats.cpp

示例10: action

void BankWindow::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "deposit")
        bankHandler->deposit(mInputMoneyTextField->getValue());
    else if (eventId == "withdraw")
        bankHandler->withdraw(mInputMoneyTextField->getValue());
}
开发者ID:Action-Committee,项目名称:ManaPlus,代码行数:8,代码来源:bankwindow.cpp

示例11: action

void SetupItem::action(const ActionEvent &event)
{
    if (!mWidget)
        return;

    if (event.getId() == mWidget->getActionEventId())
        action();
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:8,代码来源:setupitem.cpp

示例12: action

void ShopRenameListener::action(const ActionEvent &event)
{
    if (event.getId() != "OK")
        return;
    if (mDialog != nullptr)
    {
        shopWindow->setShopName(mDialog->getMsg());
        mDialog = nullptr;
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:10,代码来源:shoprenamelistener.cpp

示例13: action

void SkillDialog::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();
    if (eventId == "inc")
    {
        const SkillTab *const tab = static_cast<const SkillTab *const>(
                                        mTabs->getSelectedTab());
        if (tab)
        {
            if (const SkillInfo *const info = tab->getSelectedInfo())
                playerHandler->increaseSkill(static_cast<uint16_t>(info->id));
        }
    }
    else if (eventId == "sel")
    {
        const SkillTab *const tab = static_cast<const SkillTab *const>(
                                        mTabs->getSelectedTab());
        if (tab)
        {
            if (const SkillInfo *const info = tab->getSelectedInfo())
            {
                mUseButton->setEnabled(info->isUsable());
                mUseButton->setCaption(info->useButton);
                mIncreaseButton->setEnabled(info->id < SKILL_VAR_MIN_ID);
                const int num = itemShortcutWindow->getTabIndex();
                if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)
                        && itemShortcut[num])
                {
                    itemShortcut[num]->setItemSelected(
                        info->id + SKILL_MIN_ID);
                }
            }
            else
            {
                mUseButton->setEnabled(false);
                mIncreaseButton->setEnabled(false);
                mUseButton->setCaption(_("Use"));
            }
        }
    }
    else if (eventId == "use")
    {
        const SkillTab *const tab = static_cast<const SkillTab *const>(
                                        mTabs->getSelectedTab());
        if (tab)
        {
            const SkillInfo *const info = tab->getSelectedInfo();
            useSkill(info);
        }
    }
    else if (eventId == "close")
    {
        setVisible(Visible_false);
    }
}
开发者ID:Rawng,项目名称:ManaPlus,代码行数:55,代码来源:skilldialog.cpp

示例14: action

void QuitDialog::action(const ActionEvent &event)
{
    soundManager.playGuiSound(SOUND_HIDE_WINDOW);
    if (event.getId() == "ok")
    {
        if (viewport)
        {
            const Map *const map = viewport->getMap();
            if (map)
                map->saveExtraLayer();
        }

        if (mForceQuit->isSelected())
        {
            client->setState(STATE_FORCE_QUIT);
        }
        else if (mLogoutQuit->isSelected())
        {
            DialogsManager::closeDialogs();
            client->setState(STATE_EXIT);
        }
        else if (mRate && mRate->isSelected())
        {
            openBrowser("https://play.google.com/store/apps/details?"
                "id=org.evolonline.beta.manaplus");
            config.setValue("rated", true);
            if (mNeedForceQuit)
            {
                client->setState(STATE_FORCE_QUIT);
            }
            else
            {
                DialogsManager::closeDialogs();
                client->setState(STATE_EXIT);
            }
        }
        else if (Net::getGameHandler()->isConnected()
                 && mSwitchAccountServer->isSelected())
        {
            DialogsManager::closeDialogs();
            client->setState(STATE_SWITCH_SERVER);
        }
        else if (mSwitchCharacter->isSelected())
        {
            if (client->getState() == STATE_GAME)
            {
                Net::getCharServerHandler()->switchCharacter();
                DialogsManager::closeDialogs();
                serverConfig.write();
            }
        }
    }
    scheduleDelete();
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:54,代码来源:quitdialog.cpp

示例15: action

void AwayListener::action(const ActionEvent &event)
{
    if (event.getId() == "ok" && modifiers && player_node && settings.awayMode)
    {
        modifiers->changeAwayMode();
        player_node->updateStatus();
        if (outfitWindow)
            outfitWindow->unwearAwayOutfit();
        UpdateStatusListener::distributeEvent();
    }
}
开发者ID:KaneHart,项目名称:Elmlor-Client,代码行数:11,代码来源:awaylistener.cpp


注:本文中的ActionEvent::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。