本文整理汇总了C++中aurora::nwscript::FunctionContext::getCurrentEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionContext::getCurrentEnvironment方法的具体用法?C++ FunctionContext::getCurrentEnvironment怎么用?C++ FunctionContext::getCurrentEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::nwscript::FunctionContext
的用法示例。
在下文中一共展示了FunctionContext::getCurrentEnvironment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeScript
void Functions::executeScript(Aurora::NWScript::FunctionContext &ctx) {
Common::UString script = ctx.getParams()[0].getString();
// Max resource name length is 16, and ExecuteScript should truncate accordingly
script.truncate(16);
if (!ResMan.hasResource(script, Aurora::kFileTypeNCS))
return;
Aurora::NWScript::Object *object = getParamObject(ctx, 1);
try {
Aurora::NWScript::NCSFile ncs(script);
// Let the child script inherit the environment of this parent script
Aurora::NWScript::VariableContainer *env = ctx.getCurrentEnvironment();
if (env)
ncs.setEnvironment(*env);
ncs.run(object);
} catch (Common::Exception &e) {
e.add("Failed ExecuteScript(\"%s\", %s)", script.c_str(), Aurora::NWScript::formatTag(object).c_str());
Common::printException(e, "WARNING: ");
}
}
示例2: getCurrentEvent
void Functions::getCurrentEvent(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = (const Aurora::NWScript::EngineType *) 0;
Aurora::NWScript::VariableContainer *env = ctx.getCurrentEnvironment();
if (!env || !env->hasVariable("Event"))
return;
ctx.getReturn() = env->getVariable("Event");
}
示例3: getCurrentEventType
void Functions::getCurrentEventType(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = (int32) kEventTypeInvalid;
Aurora::NWScript::VariableContainer *env = ctx.getCurrentEnvironment();
if (!env || !env->hasVariable("Event"))
return;
const Event *event = DragonAge2::ObjectContainer::toEvent(env->getVariable("Event").getEngineType());
if (!event)
return;
ctx.getReturn() = (int32) event->getType();
}