public void TryAdd(BlobAssetPtr blobAssetPtr)
            {
                if (BlobAssetsMap.TryGetValue(blobAssetPtr.Header->Hash, out _))
                {
                    return;
                }

                BlobAssetsMap.TryAdd(blobAssetPtr.Header->Hash, BlobAssets.Length);
                BlobAssets.Add(new BlobAssetPtr(blobAssetPtr.Header));
            }
예제 #2
0
        /// <summary>
        /// Invoked for each <see cref="Entity"/> member encountered.
        /// </summary>
        /// <param name="property">The property being visited.</param>
        /// <param name="container">The source container.</param>
        /// <param name="value">The entity value.</param>
        /// <typeparam name="TContainer">The container type.</typeparam>
        /// <returns>The status of the adapter visit.</returns>
        VisitStatus IVisit <BlobAssetReferenceData> .Visit <TContainer>(Property <TContainer, BlobAssetReferenceData> property, ref TContainer container, ref BlobAssetReferenceData value)
        {
            if (null == value.m_Ptr)
            {
                return(VisitStatus.Stop);
            }

            var blobAssetPtr = new BlobAssetPtr(value.Header);

            if (!m_BlobAssetMap.TryGetValue(blobAssetPtr, out _))
            {
                var index = m_BlobAssets.Length;
                m_BlobAssets.Add(blobAssetPtr);
                m_BlobAssetMap.Add(blobAssetPtr, index);
            }
            return(VisitStatus.Stop);
        }
        public bool TryGetBlobAsset(ulong hash, out BlobAssetPtr blobAssetPtr)
        {
            var blobAssets = (BlobAssetPtr *)m_BlobAssets->Ptr;

            for (var i = 0; i < m_BlobAssets->Length; i++)
            {
                if (blobAssets[i].Header->Hash != hash)
                {
                    continue;
                }

                blobAssetPtr = new BlobAssetPtr(blobAssets[i].Header);
                return(true);
            }

            blobAssetPtr = default;
            return(false);
        }
예제 #4
0
 public bool TryGetBlobAsset(ulong hash, out BlobAssetPtr ptr)
 {
     return(m_BlobAssetBatchPtr->TryGetBlobAsset(hash, out ptr));
 }