示例#1
0
        public CustomModelLoaderCancelable Create(CustomModelLoaderCreationContext context)
        {
            if (!ContentResourceManagers.ContainsKey(context.ContentType))
            {
                throw new InvalidOperationException($"Cannot load content for EntityType: {context.EntityGuid.EntityType}");
            }

            ILoadableContentResourceManager contentResourceManager = ContentResourceManagers[context.ContentType];

            return(CreateFromResourceManager(context, contentResourceManager));
        }
示例#2
0
        private CustomModelLoaderCancelable CreateFromResourceManager(CustomModelLoaderCreationContext context, ILoadableContentResourceManager contentResourceManager)
        {
            Task <IPrefabContentResourceHandle> avatarPrefabAsync = contentResourceManager.LoadContentPrefabAsync(context.ContentId);

            return(new CustomModelLoaderCancelable(avatarPrefabAsync, Logger, prefab =>
            {
                //Callback should only occur is avatarPrefabAsync has completed
                IPrefabContentResourceHandle handle = avatarPrefabAsync.Result;

                OnContentPrefabCompletedDownloading?.Invoke(this, new ContentPrefabCompletedDownloadEventArgs(handle, prefab, context.EntityGuid));
            }));
        }