本文整理汇总了C++中SmartScriptTable::Clone方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartScriptTable::Clone方法的具体用法?C++ SmartScriptTable::Clone怎么用?C++ SmartScriptTable::Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartScriptTable
的用法示例。
在下文中一共展示了SmartScriptTable::Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateScriptTable
void CScriptProxy::CreateScriptTable( SEntitySpawnParams* pSpawnParams )
{
m_pThis = m_pScript->GetScriptSystem()->CreateTable();
m_pThis->AddRef();
//m_pThis->Clone( m_pScript->GetScriptTable() );
CEntitySystem* pEntitySystem = (CEntitySystem*)m_pEntity->GetEntitySystem();
if (pEntitySystem)
{
//pEntitySystem->GetScriptBindEntity()->DelegateCalls( m_pThis );
m_pThis->Delegate(m_pScript->GetScriptTable());
}
// Clone Properties table recursively.
if (m_pScript->GetPropertiesTable())
{
// If entity have an archetype use shared property table.
IEntityArchetype* pArchetype = m_pEntity->GetArchetype();
if (!pArchetype)
{
// Custom properties table passed
if (pSpawnParams && pSpawnParams->pPropertiesTable)
{
m_pThis->SetValue( SCRIPT_PROPERTIES_TABLE, pSpawnParams->pPropertiesTable);
}
else
{
SmartScriptTable pProps;
pProps.Create( m_pScript->GetScriptSystem());
pProps->Clone( m_pScript->GetPropertiesTable(),true,true );
m_pThis->SetValue( SCRIPT_PROPERTIES_TABLE,pProps );
}
}
else
{
IScriptTable* pPropertiesTable = pArchetype->GetProperties();
if (pPropertiesTable)
m_pThis->SetValue( SCRIPT_PROPERTIES_TABLE,pPropertiesTable );
}
SmartScriptTable pEntityPropertiesInstance;
SmartScriptTable pPropsInst;
if (m_pThis->GetValue("PropertiesInstance",pEntityPropertiesInstance))
{
pPropsInst.Create( m_pScript->GetScriptSystem());
pPropsInst->Clone( pEntityPropertiesInstance, true,true );
m_pThis->SetValue("PropertiesInstance", pPropsInst);
}
}
// Set self.__this to this pointer of CScriptProxy
ScriptHandle handle;
handle.ptr = m_pEntity;
m_pThis->SetValue( "__this",handle );
handle.n = m_pEntity->GetId();
m_pThis->SetValue( "id",handle );
m_pThis->SetValue( "class",m_pEntity->GetClass()->GetName());
}