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


C++ ActionEvent类代码示例

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


在下文中一共展示了ActionEvent类的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: ActionEventTransitPtr

ActionEventTransitPtr ActionEvent::create(FieldContainerRefPtr Source,
        Time TimeStamp)
{
    ActionEvent* TheEvent = ActionEvent::createEmpty();

    TheEvent->setSource(Source);
    TheEvent->setTimeStamp(TimeStamp);

    return ActionEventTransitPtr(TheEvent);
}
开发者ID:rdgoetz,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGActionEvent.cpp

示例3: onAction

double RobotController::onAction(ActionEvent &evt)
{

#if 1
	sendText(evt.time(), "Robot2", "hello!");
#else

	double distance = 10.0;
	sendText(evt.time(), NULL, "hello!", distance);
#endif
	return 3.0;
}
开发者ID:Aharobot,项目名称:SIGServer,代码行数:12,代码来源:SendText.cpp

示例4: 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

示例5: 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

示例6: close

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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: onAction

double RobotController::onAction(ActionEvent &evt)
{
	LOG_MSG(("\ncurrent time : %f", evt.time()));

	static int cnt = 0;

	try {
		const char *name = myname();
		SimObj *obj = getObj(name);
		obj->dump();
		if (!obj->dynamics()) {

			double angle = 2*PI*cnt*0.01;

			double xx = 5*sin(angle);
			double yy = 0.5;
			double zz = 5*cos(angle);
		
			LOG_MSG(("pos (%f, %f, %f)", xx, yy, zz));
			obj->setPosition(xx, yy, zz);
			obj->setAxisAndAngle(0.0, 1.0, 0.0, angle);
		}
		obj->dump();

	} catch(SimObj::NoAttributeException &) {
		
	} catch(SimObj::AttributeReadOnlyException &) {
		
	} catch(SimObj::Exception &) {
		
	}
	cnt++;

	return 0.1;
}
开发者ID:Aharobot,项目名称:SIGServer,代码行数:35,代码来源:GoRound.cpp

示例12: 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

示例13: action

void ChangePincodeListener::action(const ActionEvent &event)
{
    if (event.getId() == "ok")
    {
        const PincodeDialog *const dialog = dynamic_cast<PincodeDialog*>(
            event.getSource());
        if (dialog != nullptr)
        {
            const std::string &pincode = dialog->getMsg();
            pincodeManager.changePincode(pincode);
        }
    }
    else
    {
        client->setState(State::SWITCH_LOGIN);
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:17,代码来源:changepincodelistener.cpp

示例14: 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

示例15: action

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

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


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