#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static Boolean Loadable(Enum index) #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member { if (AssetsCore.assetAssociations.TryGetValue(index.GetType(), out Type assetType)) { return(AssetsCore.ReflectedCanLoadAsset(assetType, index)); } throw new ArgumentException("Invalid index type"); }
internal Boolean CanLoad() { Boolean val = true; for (Int32 i = 0; i < this.dependencies.Length; ++i) { val &= AssetsCore.Loadable(this.dependencies[i]); } return(val); }
internal static Boolean CanGetAsset(Enum index) { if (!AssetsCore.MatchAssetIndexType(typeof(TAsset), index.GetType())) { throw new ArgumentException("Incorrect index type", nameof(index)); } UInt64 ind = index.GetValue <UInt64>(); return(assets[ind].CanLoad()); }
internal AssetAccessor(Enum index, AssetAccessDelegate <TAsset> del, params Enum[] dependencies) { if (!AssetsCore.MatchAssetIndexType(typeof(TAsset), index.GetType())) { throw new ArgumentException("Incorrect index type"); } this.index = index; this.accessDelegate = del; this.dependencies = dependencies; }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static Boolean CanLoadAsset <TAsset>(Enum index) where TAsset : UnityEngine.Object #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member { if (!AssetsCore.loaded) { throw new CoreNotLoadedException(nameof(AssetsCore)); } if (!AssetsCore.MatchAssetIndexType(typeof(TAsset), index.GetType())) { throw new ArgumentException("Incorrect index type", "index"); } return(AssetLibrary <TAsset> .CanGetAsset(index)); }
internal static TAsset GetAsset(Enum index) { if (!AssetsCore.MatchAssetIndexType(typeof(TAsset), index.GetType())) { throw new ArgumentException("Incorrect index type.", nameof(index)); } UInt64 ind = index.GetValue <UInt64>(); if (assets.TryGetValue(ind, out AssetAccessor <TAsset> asset)) { return(asset.value); } else { throw new KeyNotFoundException(String.Format("The Key:{0} was not found.", index.GetName())); } }
public static TAsset LoadAsset <TAsset>(Enum index) where TAsset : UnityEngine.Object { //var timer = new Stopwatch(); //timer.Start(); if (!AssetsCore.loaded) { throw new CoreNotLoadedException(nameof(AssetsCore)); } if (!AssetsCore.MatchAssetIndexType(typeof(TAsset), index.GetType())) { throw new ArgumentException("Incorrect index type", nameof(index)); } TAsset asset = AssetLibrary <TAsset> .GetAsset(index); //timer.Stop(); //Log.Warning( String.Format( "Time for asset {0}: {1} ticks, {2} ms", index.GetName(), timer.ElapsedTicks, timer.ElapsedMilliseconds ) ); return(asset); }