示例#1
0
bool CMonoFlowNode::CreatedNode(TFlowNodeId id, const char *name, TFlowNodeTypeId typeId, IFlowNodePtr pNode) 
{ 
	if(pNode==this)
	{
		const char *typeName = gEnv->pFlowSystem->GetTypeName(typeId);

		IMonoObject *pScript = g_pScriptSystem->InstantiateScript(gEnv->pFlowSystem->GetTypeName(typeId), eScriptFlag_FlowNode);

		IMonoClass *pNodeInfo = g_pScriptSystem->GetCryBraryAssembly()->GetClass("NodeInitializationParams", "CryEngine.Flowgraph.Native");
		
		IMonoArray *pArgs = CreateMonoArray(1);
		pArgs->InsertMonoObject(pNodeInfo->BoxObject(&SMonoNodeInfo(this, id, m_pActInfo->pGraph->GetGraphId())));

		mono::object result = g_pScriptSystem->InitializeScriptInstance(pScript, pArgs);
		pArgs->Release();
		
		m_pScript = pScript;
		if(result)
		{
			IMonoObject *pResult = *result;
			bool bResult = pResult->Unbox<bool>();
			SAFE_RELEASE(pResult);

			return bResult;
		}

		CryLogAlways("Failed to create node %s", gEnv->pFlowSystem->GetTypeName(typeId));
		return false;
	}

	return true; 
}
示例#2
0
bool CFlowNode::CreatedNode(TFlowNodeId id, const char *name, TFlowNodeTypeId typeId, IFlowNodePtr pNode) 
{ 
	if(pNode==this)
	{
		IMonoObject *pScript = g_pScriptSystem->InstantiateScript(gEnv->pFlowSystem->GetTypeName(typeId), eScriptFlag_FlowNode);

		IMonoClass *pNodeInfo = g_pScriptSystem->GetCryBraryAssembly()->GetClass("NodeInfo", "CryEngine.FlowSystem.Native");
		pScript->CallMethod("InternalInitialize", pNodeInfo->BoxObject(&SMonoNodeInfo(this, id, m_pActInfo->pGraph->GetGraphId())));

		m_pScript = pScript;

		return pScript != nullptr;
	}

	return true; 
}