当前位置: 首页>>代码示例>>C++>>正文


C++ SmartScriptTable::GetPtr方法代码示例

本文整理汇总了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;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:25,代码来源:ScriptRMI.cpp

示例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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:25,代码来源:ScriptRMI.cpp

示例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 );
}
开发者ID:aronarts,项目名称:FireNET,代码行数:12,代码来源:ScriptRMI.cpp

示例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();
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:20,代码来源:ScriptRMI.cpp

示例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);
}
开发者ID:aronarts,项目名称:FireNET,代码行数:68,代码来源:ScriptRMI.cpp


注:本文中的SmartScriptTable::GetPtr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。