本文整理汇总了C++中SmartScriptTable::GetPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartScriptTable::GetPtr方法的具体用法?C++ SmartScriptTable::GetPtr怎么用?C++ SmartScriptTable::GetPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartScriptTable
的用法示例。
在下文中一共展示了SmartScriptTable::GetPtr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SerializeScript
bool CScriptRMI::SerializeScript( TSerialize ser, IEntity * pEntity )
{
SSerializeFunctionParams p( ser, pEntity );
ScriptHandle hdl( &p );
IScriptTable * pTable = pEntity->GetScriptTable();
if (pTable)
{
SmartScriptTable serTable;
SmartScriptTable synchedTable;
pTable->GetValue( "synched", synchedTable );
if (synchedTable.GetPtr())
{
synchedTable->GetValue( HIDDEN_FIELD, serTable );
if (serTable.GetPtr())
{
IScriptSystem * pScriptSystem = pTable->GetScriptSystem();
pScriptSystem->BeginCall( serTable.GetPtr(), SERIALIZE_FUNCTION );
pScriptSystem->PushFuncParam( serTable );
pScriptSystem->PushFuncParam( hdl );
return pScriptSystem->EndCall();
}
}
}
return true;
}
示例2: SerializeFunction
int CScriptRMI::SerializeFunction( IFunctionHandler * pH, void * pBuffer, int nSize )
{
SmartScriptTable serTable;
ScriptHandle hdl;
pH->GetParam( 1, serTable );
pH->GetParam( 2, hdl );
SSerializeFunctionParams * p = (SSerializeFunctionParams *) hdl.ptr;
SSynchedPropertyInfo * pInfo = (SSynchedPropertyInfo *) pBuffer;
int nProperties = nSize / sizeof(SSynchedPropertyInfo);
if (p->ser.IsReading())
{
for (int i=0; i < nProperties; i++)
if (!m_pThis->ReadValue( pInfo[i].name, pInfo[i].type, p->ser, serTable.GetPtr() ))
return pH->EndFunction(false);
}
else
{
for (int i=0; i < nProperties; i++)
if (!m_pThis->WriteValue( pInfo[i].name, pInfo[i].type, p->ser, serTable.GetPtr() ))
return pH->EndFunction(false);
}
return pH->EndFunction(true);
}
示例3: AddProxyTable
// add a dispatch proxy table to an entity
void CScriptRMI::AddProxyTable( IScriptTable * pEntityTable,
ScriptHandle id, ScriptHandle flags,
const char * name, SmartScriptTable dispatchTable )
{
SmartScriptTable proxyTable( pEntityTable->GetScriptSystem() );
proxyTable->Delegate( dispatchTable.GetPtr() );
proxyTable->SetValue( FLAGS_FIELD, flags );
proxyTable->SetValue( ID_FIELD, id );
proxyTable->SetValue( "__nopersist", true );
pEntityTable->SetValue( name, proxyTable );
}
示例4: 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();
}
}
示例5: ExposeClass
// implementation of Net.Expose() - exposes a class
int CScriptRMI::ExposeClass( IFunctionHandler * pFH )
{
SmartScriptTable params, cls, clientMethods, serverMethods;
SmartScriptTable clientTable, serverTable;
SmartScriptTable serverProperties;
IScriptSystem * pSS = pFH->GetIScriptSystem();
if (pFH->GetParamCount() != 1)
{
pSS->RaiseError( "Net.Expose takes only one parameter - a table" );
return pFH->EndFunction(false);
}
if (!pFH->GetParam( 1, params ))
{
pSS->RaiseError( "Net.Expose takes only one parameter - a table" );
return pFH->EndFunction(false);
}
if (!params->GetValue( "Class", cls ))
{
pSS->RaiseError( "No 'Class' parameter to Net.Expose" );
return pFH->EndFunction(false);
}
if (!params->GetValue( "ClientMethods", clientMethods ))
{
GameWarning( "No 'ClientMethods' parameter to Net.Expose" );
}
else if (!cls->GetValue("Client", clientTable))
{
pSS->RaiseError( "'ClientMethods' exposed, but no 'Client' table in class" );
return pFH->EndFunction(false);
}
if (!params->GetValue( "ServerMethods", serverMethods ))
{
GameWarning( "No 'ServerMethods' parameter to Net.Expose" );
}
else if (!cls->GetValue("Server", serverTable))
{
pSS->RaiseError( "'ServerMethods' exposed, but no 'Server' table in class" );
return pFH->EndFunction(false);
}
params->GetValue( "ServerProperties", serverProperties );
if (clientMethods.GetPtr())
{
CRY_ASSERT( clientTable.GetPtr() );
if (!BuildDispatchTable( clientMethods, clientTable, cls, CLIENT_DISPATCH_FIELD ))
return pFH->EndFunction(false);
}
if (serverMethods.GetPtr())
{
CRY_ASSERT( serverTable.GetPtr() );
if (!BuildDispatchTable( serverMethods, serverTable, cls, SERVER_DISPATCH_FIELD ))
return pFH->EndFunction(false);
}
if (serverProperties.GetPtr())
{
if (!BuildSynchTable(serverProperties, cls, SERVER_SYNCHED_FIELD))
return pFH->EndFunction(false);
}
return pFH->EndFunction(true);
}