Ejemplo n.º 1
0
void CDoorPanel::AssignAsFSCommandHandler()
{
	IEntity* pEntity = GetEntity();
	if (pEntity)
	{
		IEntityRenderProxy* pRenderProxy = static_cast<IEntityRenderProxy*>(pEntity->GetProxy(ENTITY_PROXY_RENDER));
		if (pRenderProxy)
		{
			_smart_ptr<IMaterial> pMaterial = pRenderProxy->GetRenderMaterial(DOOR_PANEL_MODEL_NORMAL_SLOT);
			IFlashPlayer* pFlashPlayer = CHUDUtils::GetFlashPlayerFromMaterialIncludingSubMaterials(pMaterial, true);
			if (pFlashPlayer) // Valid to not have a flash player, since will update when flash setup
			{
				pFlashPlayer->SetFSCommandHandler(this);
				pFlashPlayer->Release();
			}
		}
	}
}
void CDoorPanelBehavior::DeinitFlashResources( CDoorPanel& doorPanel )
{
	if (m_pFlashObjectRoot)
	{
		SAFE_RELEASE(m_pFlashObjectRoot);

		if (doorPanel.m_sharingMaterialEntity == 0)
		{
			IEntity* pEntity = doorPanel.GetEntity();

			IEntityRenderProxy* pRenderProxy = static_cast<IEntityRenderProxy*>(pEntity->GetProxy(ENTITY_PROXY_RENDER));
			if (pRenderProxy)
			{
				IMaterial* pMaterial = pRenderProxy->GetRenderMaterial(DOOR_PANEL_MODEL_NORMAL_SLOT);
				if (pMaterial)
				{
					IFlashPlayer* pFlashPlayer = CHUDUtils::GetFlashPlayerFromMaterialIncludingSubMaterials(pMaterial, true);
					if (pFlashPlayer)
					{
						pFlashPlayer->SetFSCommandHandler(NULL);

						pFlashPlayer->Release();
					}

					CDoorPanelBehavior::DecrementNumUniqueFlashInstances(pMaterial->GetName());
					doorPanel.NotifyScreenSharingEvent(eDoorPanelGameObjectEvent_StopShareScreen);
				}
			}

			if (m_pActualAnimatedMaterial)
			{
				m_pActualAnimatedMaterial->ActivateDynamicTextureSources(false);
			}
		}
	}
}