Exemplo n.º 1
0
        public byte[] CreateDataSync(AssetUri Uri)
        {
            var Asset = CreateAssetSync <UnityEngine.TextAsset>(Uri);

#if UNITY_EDITOR && LITE_USE_INTERNAL_ASSET
            return((Asset as AssetInternalLoader.AssetInternalTextAsset)?.InternalBytes);
#endif
            return(Asset?.bytes);
        }
Exemplo n.º 2
0
        public void CreateDataAsync(AssetUri Uri, Action <byte[]> Callback = null)
        {
            LoadAssetAsync <UnityEngine.TextAsset>(AssetCacheType.Data, Uri.AssetPath, (IsLoaded) =>
            {
                if (!IsLoaded)
                {
                    Callback?.Invoke(null);
                    return;
                }

                Callback?.Invoke(CreateDataSync(Uri));
            });
        }
Exemplo n.º 3
0
        public void CreatePrefabAsync(AssetUri Uri, Action <UnityEngine.GameObject> Callback = null)
        {
            LoadAssetAsync <UnityEngine.GameObject>(AssetCacheType.Prefab, Uri.AssetPath, (IsLoaded) =>
            {
                if (!IsLoaded)
                {
                    Callback?.Invoke(null);
                    return;
                }

                Callback?.Invoke(CreatePrefabSync(Uri));
            });
        }
Exemplo n.º 4
0
        public void CreateAssetAsync <T>(AssetUri Uri, Action <T> Callback = null) where T : UnityEngine.Object
        {
            LoadAssetAsync <T>(AssetCacheType.Asset, Uri.AssetPath, (IsLoaded) =>
            {
                if (!IsLoaded)
                {
                    Callback?.Invoke(null);
                    return;
                }

                Callback?.Invoke(CreateAssetSync <T>(Uri));
            });
        }
Exemplo n.º 5
0
        public void CreateAssetAsync <T>(AssetUri Uri, LiteAction <T> Callback = null) where T : UnityEngine.Object
        {
            var AssetType = GetAssetTypeWithName <T>(Uri.AssetPath);

            LoadAssetAsync <T>(AssetType, Uri.AssetPath, (IsLoaded) =>
            {
                if (!IsLoaded)
                {
                    Callback?.Invoke(null);
                    return;
                }

                Callback?.Invoke(CreateAssetSync <T>(Uri));
            });
        }
Exemplo n.º 6
0
        public T CreateAssetSync <T>(AssetUri Uri) where T : UnityEngine.Object
        {
            var AssetType = GetAssetTypeWithName <T>(Uri.AssetPath);

            T Asset = null;

            var AssetName = Uri.AssetName;

            if (AssetType == AssetCacheType.Asset)
            {
                AssetName = $"{AssetName}_{typeof(T).Name.ToLower()}";
            }

            BaseAssetCache Cache = null;

            if (!AssetCacheList_.ContainsKey(Uri.AssetPath))
            {
                Cache = LoadAssetSync <UnityEngine.Object>(AssetType, Uri.AssetPath);
            }
            else
            {
                Cache = AssetCacheList_[Uri.AssetPath];
                if (!Cache.IsLoad)
                {
                    Cache.ForeCompleteAsync();
                }
            }

            if (Cache != null)
            {
                Asset = Cache.CreateAsset(AssetName) as T;

                if (Asset != null)
                {
                    if (!AssetPathCacheList_.ContainsKey(Asset.GetInstanceID()))
                    {
                        AssetPathCacheList_.Add(Asset.GetInstanceID(), Uri.AssetPath);
                    }
                }
                else
                {
                    LLogger.LWarning($"Can't Create Asset : {Uri}");
                }
            }

            return(Asset);
        }
Exemplo n.º 7
0
 public UnityEngine.GameObject CreatePrefabSync(AssetUri Uri)
 {
     return(CreateAssetSync <UnityEngine.GameObject>(Uri));
 }
Exemplo n.º 8
0
 public static byte[] CreateDataSync(AssetUri Uri)
 {
     return(Loader_.CreateDataSync(Uri));
 }
Exemplo n.º 9
0
 public static void CreateDataAsync(AssetUri Uri, LiteAction <byte[]> Callback = null)
 {
     Loader_.CreateDataAsync(Uri, Callback);
 }
Exemplo n.º 10
0
 public static GameObject CreatePrefabSync(AssetUri Uri)
 {
     return(Loader_.CreatePrefabSync(Uri));
 }
Exemplo n.º 11
0
 public static void CreatePrefabAsync(AssetUri Uri, LiteAction <GameObject> Callback = null)
 {
     Loader_.CreatePrefabAsync(Uri, Callback);
 }
Exemplo n.º 12
0
 public static T CreateAssetSync <T>(AssetUri Uri) where T : UnityEngine.Object
 {
     return(Loader_.CreateAssetSync <T>(Uri));
 }
Exemplo n.º 13
0
 public static void CreateAssetAsync <T>(AssetUri Uri, LiteAction <T> Callback = null) where T : UnityEngine.Object
 {
     Loader_.CreateAssetAsync <T>(Uri, Callback);
 }