Ejemplo n.º 1
0
        private IEnumerator _CreateInnerObject <AssetType, CallbackParamType>(
            PoolItem <AssetData> poolItem,
            CreateAssetPoolItemParam param,
            Action <CallbackParamType> callback) where AssetType : IDynamicObject, new() where CallbackParamType : ScriptableObject
        {
            yield return(poolItem.CreateInnerObject <AssetType, CallbackParamType>(param));

            _assetPool.UpdatePoolItemIdentifier(poolItem);

            callback((CallbackParamType)poolItem.InnerObject);
        }
Ejemplo n.º 2
0
        private IEnumerator _FindAsset <AssetType, CallbackParamType>(string assetPath, string assetName,
                                                                      Action <CallbackParamType> callback) where AssetType : AssetData, new() where CallbackParamType : ScriptableObject
        {
            var identifier             = assetPath + assetName;
            PoolItem <AssetData> pItem = _assetPool.FindPoolItem(identifier);

            if (pItem.HasInnerObject)
            {
                callback((CallbackParamType)pItem.InnerObject);
            }
            else
            {
                CreateAssetPoolItemParam param = new CreateAssetPoolItemParam();
                param.BundleName = assetPath;
                param.AssetName  = assetName;
                var coroutine = _CreateInnerObject <AssetType, CallbackParamType>(pItem, param, callback);
                yield return(coroutine);
            }

            _assetPool.FreeUsingItem(pItem);
        }