public Asset(string name, AssetFamily family, bool persistent = false) { this.m_name = name; this.m_family = family; this.m_persistent = persistent; this.m_path = string.Format(AssetPathInfo.FamilyInfo[family].format, name); }
private Asset(string name, AssetFamily family, bool persistent, bool loadAsync, bool preloadOnly) { this.Name = name; this.Family = family; this.Persistent = persistent; this.LoadAsync = loadAsync; this.PreloadOnly = preloadOnly; }
public static Asset Create(string assetName, AssetFamily family, bool persistent = false, bool loadAsync = false, bool preloadOnly = false) { return(new Asset(assetName, family, persistent, loadAsync, preloadOnly) { m_path = new Dictionary <LoadModel, string>() { { LoadModel.FromBundle, string.Format(Asset.paths[family].bundleDir, family.ToString()) }, { LoadModel.FromResources, string.Format(Asset.paths[family].resourceDir, assetName) } } }); }
public static List <Locale> GetLoadOrder(AssetFamily family) { Class272.Enum20[] enumArray1 = new Class272.Enum20[] { Class272.Enum20.ValueType }; object[] objArray1 = new object[] { family }; Class246 <Locale> class2 = MonoClass.smethod_16 <Class246 <Locale> >(TritonHs.MainAssemblyPath, "", "Localization", "GetLoadOrder", enumArray1, objArray1); if (class2 != null) { return(class2.method_25()); } return(null); }
static void copyToResources() { Caching.CleanCache(); string resDir = FileUtils.GetFullPathOfAssets("Resources"); if (!Directory.Exists(resDir)) { Directory.CreateDirectory(resDir); AssetDatabase.Refresh(); } foreach (string types in System.Enum.GetNames(typeof(AssetFamily))) { AssetFamily family = EnumUtils.GetEnum <AssetFamily>(types); Asset asset = Asset.Create("public", family, false, false, false); copyAssetToResources(asset, false); } }
private bool LoadObject(string assetName, AssetFamily family, AssetLoader.ObjectCallback callback, AssetLoader.ProgressCallback progressCallback, object callbackData, bool persistent = false, bool loadAsync = false) { if (string.IsNullOrEmpty(assetName)) { Log.Asset.Print("AssetLoader.LoadObject() - name was null or empty"); return(false); } Asset asset = Asset.Create(assetName, family, persistent, loadAsync, false); Object target = getInCache(asset); if (target != null) //got in cache { if (callback != null) { callback(asset.Name, target, callbackData); } return(true); } else { if (asset.loadModel() == Asset.LoadModel.FromBundle) { StartCoroutine(createBundleAsset(asset, callback, progressCallback, callbackData, persistent, loadAsync)); } else if (asset.loadModel() == Asset.LoadModel.FromResources) { Object obj = Resources.Load(asset.GetPath()); if (obj == null) { Log.Asset.Print("AssetLoader.LoadObject() - load object from Resources was failed ,path is:" + asset.GetPath()); } else { CacheAsset(asset, obj); if (callback != null) { callback(asset.Name, obj, callbackData); } } } } return(true); }
public static void Initialize() { IEnumerator enumerator = Enum.GetValues(typeof(AssetFamily)).GetEnumerator(); try { while (enumerator.MoveNext()) { AssetFamily current = (AssetFamily)((int)enumerator.Current); AssetCache cache = new AssetCache(); s_cacheTable.Add(current, cache); } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } }
static void CreateAssetBunldesALL(BuildTarget target) { Caching.CleanCache(); string resDir = FileUtils.GetFullPathOfAssets("StreamingAssets"); if (!Directory.Exists(resDir)) { Directory.CreateDirectory(resDir); AssetDatabase.Refresh(); } foreach (string types in System.Enum.GetNames(typeof(AssetFamily))) { AssetFamily family = EnumUtils.GetEnum <AssetFamily>(types); Asset asset = Asset.Create("public", family, false, false, false); loadAsset(asset, target); } string tmpPath = FileUtils.GetFullBundleTempPath(""); FileUtil.DeleteFileOrDirectory(tmpPath); AssetDatabase.Refresh(); }
public static void LogMissingAsset(AssetFamily family, string assetname) { object[] objArray1 = new object[] { family, assetname }; MonoClass.smethod_18(TritonHs.MainAssemblyPath, "", "AssetLoader", "LogMissingAsset", objArray1); }
public static Asset Create(string assetName, AssetFamily family, bool persistent = false, bool loadAsync = false, bool preloadOnly = false) { return new Asset(assetName, family, persistent, loadAsync, preloadOnly) { m_path = new Dictionary<LoadModel, string>() { {LoadModel.FromBundle,string.Format(Asset.paths[family].bundleDir, family.ToString())}, {LoadModel.FromResources,string.Format(Asset.paths[family].resourceDir, assetName)} } }; }
public static Locale[] GetLoadOrder(AssetFamily family) { return(GetLoadOrder((family == AssetFamily.CardTexture) || (family == AssetFamily.CardPremium))); }
private bool LoadObject(string assetName, AssetFamily family, AssetLoader.ObjectCallback callback, AssetLoader.ProgressCallback progressCallback, object callbackData, bool persistent = false, bool loadAsync = false) { if (string.IsNullOrEmpty(assetName)) { Log.Asset.Print("AssetLoader.LoadObject() - name was null or empty"); return false; } Asset asset = Asset.Create(assetName, family, persistent, loadAsync, false); Object target = getInCache (asset); if(target != null) //got in cache { if(callback != null) { callback(asset.Name,target,callbackData); } return true; } else { if(asset.loadModel() == Asset.LoadModel.FromBundle) { StartCoroutine(createBundleAsset(asset,callback,progressCallback,callbackData,persistent,loadAsync)); } else if(asset.loadModel() == Asset.LoadModel.FromResources) { Object obj = Resources.Load(asset.GetPath()); if(obj == null) { Log.Asset.Print("AssetLoader.LoadObject() - load object from Resources was failed ,path is:"+asset.GetPath()); } else { CacheAsset(asset,obj); if(callback != null) { callback(asset.Name,obj,callbackData); } } } } return true; }