本文整理汇总了C++中Costume::getChore方法的典型用法代码示例。如果您正苦于以下问题:C++ Costume::getChore方法的具体用法?C++ Costume::getChore怎么用?C++ Costume::getChore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Costume
的用法示例。
在下文中一共展示了Costume::getChore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getactor
void Lua_V2::GetActorChores() {
lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
Actor *actor = getactor(actorObj);
Costume *costume = actor->getCurrentCostume();
lua_Object result = lua_createtable();
lua_pushobject(result);
if (!costume) {
lua_pushstring("count");
lua_pushnumber(0);
lua_settable();
lua_pushobject(result);
return;
}
int num = costume->getNumChores();
lua_pushstring("count");
lua_pushnumber(num);
lua_settable();
for (int i = 0; i < num; ++i) {
lua_pushobject(result);
lua_pushnumber(i);
lua_pushusertag(((EMIChore *)costume->getChore(i))->getId(), MKTAG('C','H','O','R'));
lua_settable();
}
lua_pushobject(result);
}
示例2: getactor
void Lua_V2::PlayActorChore() {
lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3);
// lua_Object modeObj = lua_getparam(4);
// lua_Object paramObj = lua_getparam(5);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
Actor *actor = getactor(actorObj);
if (!lua_isstring(choreObj) || !lua_isstring(costumeObj))
lua_pushnil();
/* bool mode = false;
float param = 0.0;
if (!lua_isnil(modeObj)) {
if (lua_getnumber(modeObj) != 0.0)
mode = true;
if (!lua_isnil(paramObj))
if (lua_isnumber(paramObj))
param = lua_getnumber(paramObj);
}*/
const char *choreName = lua_getstring(choreObj);
const char *costumeName = lua_getstring(costumeObj);
Costume *costume = actor->findCostume(costumeName);
if (costume == NULL) {
actor->pushCostume(costumeName);
costume = actor->findCostume(costumeName);
}
PoolChore *chore = (PoolChore *)costume->getChore(choreName);
costume->playChore(choreName);
if (chore) {
lua_pushusertag(chore->getId(), MKTAG('C','H','O','R'));
} else {
lua_pushnil();
}
}