本文整理汇总了C++中gcn::ActionEvent::trigger方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionEvent::trigger方法的具体用法?C++ ActionEvent::trigger怎么用?C++ ActionEvent::trigger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcn::ActionEvent
的用法示例。
在下文中一共展示了ActionEvent::trigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: action
void NpcDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok")
{
if (mActionState == NPC_ACTION_NEXT)
{
nextDialog();
// TRANSLATORS: Please leave the \n sequences intact.
addText(_("\n> Next\n"), false);
}
else if (mActionState == NPC_ACTION_CLOSE)
{
closeDialog();
}
else if (mActionState == NPC_ACTION_INPUT)
{
std::string printText = ""; // Text that will get printed in the textbox
if (mInputState == NPC_INPUT_LIST)
{
int selectedIndex = mItemList->getSelected();
if (selectedIndex >= (int) mItems.size() || selectedIndex < 0)
return;
printText = mItems[selectedIndex];
NpcEvent("doMenu")
event.setInt("choice", selectedIndex + 1);
event.trigger("NPC");
}
else if (mInputState == NPC_INPUT_STRING)
{
printText = mTextField->getText();
NpcEvent("doStringInput")
event.setString("value", printText);
event.trigger("NPC");
}
else if (mInputState == NPC_INPUT_INTEGER)
{
printText = strprintf("%d", mIntField->getValue());
NpcEvent("doIntegerInput")
event.setInt("value", mIntField->getValue());
event.trigger("NPC");
}
// addText will auto remove the input layout
addText(strprintf("\n> \"%s\"\n", printText.c_str()), false);
mNewText.clear();
}
if (!mLogInteraction)
setText("");
}
else if (event.getId() == "reset")
{
if (mInputState == NPC_INPUT_STRING)
{
mTextField->setText(mDefaultString);
}
else if (mInputState == NPC_INPUT_INTEGER)
{
mIntField->setValue(mDefaultInt);
}
}
else if (event.getId() == "inc")
{
mIntField->setValue(mIntField->getValue() + 1);
}
else if (event.getId() == "dec")
{
mIntField->setValue(mIntField->getValue() - 1);
}
else if (event.getId() == "clear")
{
setText(mNewText);
}
}