本文整理汇总了C++中GameObject::ConditionalFinalizeLoad方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::ConditionalFinalizeLoad方法的具体用法?C++ GameObject::ConditionalFinalizeLoad怎么用?C++ GameObject::ConditionalFinalizeLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::ConditionalFinalizeLoad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TickCacheLoad
/// Tick the async loading of binary serialized data from the object cache for the given load request.
///
/// @param[in] pRequest Load request.
///
/// @return True if the cache load process has completed, false if it still requires processing.
bool CachePackageLoader::TickCacheLoad( LoadRequest* pRequest )
{
HELIUM_ASSERT( pRequest );
HELIUM_ASSERT( !( pRequest->flags & LOAD_FLAG_PRELOADED ) );
AsyncLoader& rAsyncLoader = AsyncLoader::GetStaticInstance();
size_t bytesRead = 0;
if( !rAsyncLoader.TrySyncRequest( pRequest->asyncLoadId, bytesRead ) )
{
return false;
}
SetInvalid( pRequest->asyncLoadId );
if( bytesRead == 0 || IsInvalid( bytesRead ) )
{
HELIUM_ASSERT( pRequest->pEntry );
HELIUM_TRACE(
TraceLevels::Error,
TXT( "CachePackageLoader: Failed to read cache data for object \"%s\".\n" ),
*pRequest->pEntry->path.ToString() );
}
else
{
uint8_t* pBufferEnd = pRequest->pAsyncLoadBuffer + bytesRead;
pRequest->pPropertyStreamEnd = pBufferEnd;
pRequest->pPersistentResourceStreamEnd = pBufferEnd;
if( DeserializeLinkTables( pRequest ) )
{
return true;
}
}
// An error occurred attempting to load the property data, so mark any existing object as fully loaded (nothing
// else will be done with the object itself from here on out).
DefaultAllocator().Free( pRequest->pAsyncLoadBuffer );
pRequest->pAsyncLoadBuffer = NULL;
GameObject* pObject = pRequest->spObject;
if( pObject )
{
pObject->SetFlags( GameObject::FLAG_PRELOADED | GameObject::FLAG_LINKED );
pObject->ConditionalFinalizeLoad();
}
pRequest->flags |= LOAD_FLAG_PRELOADED | LOAD_FLAG_ERROR;
return true;
}
示例2: TickDeserialize
/// Tick the object deserialization process for the given object load request.
///
/// @param[in] pRequest Load request.
///
/// @return True if the deserialization process has completed, false if it still needs time to process.
bool CachePackageLoader::TickDeserialize( LoadRequest* pRequest )
{
HELIUM_ASSERT( pRequest );
HELIUM_ASSERT( !( pRequest->flags & LOAD_FLAG_PRELOADED ) );
GameObject* pObject = pRequest->spObject;
const Cache::Entry* pCacheEntry = pRequest->pEntry;
HELIUM_ASSERT( pCacheEntry );
// Wait for the template and owner objects to load.
GameObjectLoader* pObjectLoader = GameObjectLoader::GetStaticInstance();
HELIUM_ASSERT( pObjectLoader );
if( IsValid( pRequest->templateLinkIndex ) )
{
HELIUM_ASSERT( pRequest->templateLinkIndex < pRequest->objectLinkTable.GetSize() );
size_t templateLoadId = pRequest->objectLinkTable[ pRequest->templateLinkIndex ];
if( IsValid( templateLoadId ) && !pObjectLoader->TryFinishLoad( templateLoadId, pRequest->spTemplate ) )
{
return false;
}
SetInvalid( pRequest->templateLinkIndex );
if( !pRequest->spTemplate )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "CachePackageLoader: Failed to load template object for \"%s\".\n" ),
*pCacheEntry->path.ToString() );
if( pObject )
{
pObject->SetFlags( GameObject::FLAG_PRELOADED | GameObject::FLAG_LINKED );
pObject->ConditionalFinalizeLoad();
}
DefaultAllocator().Free( pRequest->pAsyncLoadBuffer );
pRequest->pAsyncLoadBuffer = NULL;
pRequest->flags |= LOAD_FLAG_PRELOADED | LOAD_FLAG_ERROR;
return true;
}
}
GameObject* pTemplate = pRequest->spTemplate;
if( IsValid( pRequest->ownerLinkIndex ) )
{
HELIUM_ASSERT( pRequest->ownerLinkIndex < pRequest->objectLinkTable.GetSize() );
size_t ownerLoadId = pRequest->objectLinkTable[ pRequest->ownerLinkIndex ];
if( IsValid( ownerLoadId ) && !pObjectLoader->TryFinishLoad( ownerLoadId, pRequest->spOwner ) )
{
return false;
}
SetInvalid( pRequest->ownerLinkIndex );
if( !pRequest->spOwner )
{
HELIUM_TRACE(
TraceLevels::Error,
TXT( "CachePackageLoader: Failed to load owner object for \"%s\".\n" ),
*pCacheEntry->path.ToString() );
if( pObject )
{
pObject->SetFlags( GameObject::FLAG_PRELOADED | GameObject::FLAG_LINKED );
pObject->ConditionalFinalizeLoad();
}
DefaultAllocator().Free( pRequest->pAsyncLoadBuffer );
pRequest->pAsyncLoadBuffer = NULL;
pRequest->flags |= LOAD_FLAG_PRELOADED | LOAD_FLAG_ERROR;
return true;
}
}
GameObject* pOwner = pRequest->spOwner;
HELIUM_ASSERT( !pOwner || pOwner->IsFullyLoaded() );
HELIUM_ASSERT( !pTemplate || pTemplate->IsFullyLoaded() );
GameObjectType* pType = pRequest->spType;
HELIUM_ASSERT( pType );
// If we already had an existing object, make sure the type and template match.
if( pObject )
{
const GameObjectType* pExistingType = pObject->GetGameObjectType();
HELIUM_ASSERT( pExistingType );
//.........这里部分代码省略.........