本文整理汇总了C++中SmartScriptTable::GetValueType方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartScriptTable::GetValueType方法的具体用法?C++ SmartScriptTable::GetValueType怎么用?C++ SmartScriptTable::GetValueType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartScriptTable
的用法示例。
在下文中一共展示了SmartScriptTable::GetValueType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPostInitClient
void CScriptRMI::OnPostInitClient( uint16 channelId, IEntity * pEntity )
{
SmartScriptTable server;
SmartScriptTable entity = pEntity->GetScriptTable();
if (!entity.GetPtr())
return;
if (!entity->GetValue( "Server", server ) || !server.GetPtr())
return;
IScriptSystem * pSystem = entity->GetScriptSystem();
if ((server->GetValueType( "OnPostInitClient" ) == svtFunction) &&
pSystem->BeginCall( server, "OnPostInitClient" ))
{
pSystem->PushFuncParam( entity );
pSystem->PushFuncParam( channelId );
pSystem->EndCall();
}
}
示例2: ValidateDispatchTable
// one-time validation of entity tables
bool CScriptRMI::ValidateDispatchTable( const char * clazz, SmartScriptTable dispatch, SmartScriptTable methods, bool bServerTable )
{
CryAutoCriticalSection lkDispatch(m_dispatchMutex);
std::map<string,size_t>::iterator iterN = m_entityClassToEntityTypeID.lower_bound(clazz);
if (iterN == m_entityClassToEntityTypeID.end() || iterN->first != clazz)
{
iterN = m_entityClassToEntityTypeID.insert( iterN, std::make_pair(clazz, m_entityClassToEntityTypeID.size()) );
CRY_ASSERT(iterN->second == m_dispatch.size());
m_dispatch.push_back(SDispatch());
}
SDispatch& dispatchTblCont = m_dispatch[iterN->second];
SFunctionDispatchTable& dispatchTbl = bServerTable ? dispatchTblCont.server : dispatchTblCont.client;
IScriptTable::Iterator iter = dispatch->BeginIteration();
while (dispatch->MoveNext(iter))
{
if (iter.sKey)
{
if (iter.sKey[0] == '_' && iter.sKey[1] == '_')
continue;
ScriptVarType type = methods->GetValueType( iter.sKey );
if (type != svtFunction)
{
GameWarning( "In class %s: function %s is exposed but not defined",
clazz, iter.sKey );
dispatch->EndIteration(iter);
return false;
}
}
else
{
int id = iter.nKey;
CRY_ASSERT(id>0);
id--;
if (id >= dispatchTbl.size())
dispatchTbl.resize(id+1);
SFunctionDispatch& dt = dispatchTbl[id];
if (iter.value.GetVarType() != svtString)
{
GameWarning("Expected a string in dispatch table, got type %d", iter.value.GetVarType());
dispatch->EndIteration(iter);
return false;
}
const char * funcData = iter.value.str;
const char * colon = strchr(funcData, ':');
if (colon == NULL)
{
dispatch->EndIteration(iter);
return false;
}
if (colon - funcData > MaxSynchedPropertyNameLength)
{
dispatch->EndIteration(iter);
return false;
}
memcpy( dt.name, funcData, colon-funcData );
dt.name[colon-funcData] = 0;
strcpy(dt.format, colon + 1);
}
}
dispatch->EndIteration(iter);
dispatch->SetValue( VALIDATED_FIELD, true );
if (bServerTable)
{
dispatchTblCont.m_serverDispatchScriptTable = dispatch;
}
else
{
dispatchTblCont.m_clientDispatchScriptTable = dispatch;
}
return true;
}