Exemple #1
0
 public static void ReleaseAsset(string key)
 {
     if (!AssetPool.IsInStrongDict(key))
     {
         return;
     }
     AssetPool.Asset asset = AssetPool._strongAssetDict[key];
     asset.ReferenceCount--;
 }
Exemple #2
0
 public static UnityEngine.Object GetAsset(string key)
 {
     if (AssetPool.IsInStrongDict(key))
     {
         AssetPool.Asset asset = AssetPool._strongAssetDict[key];
         asset.ReferenceCount++;
         return(asset.Object);
     }
     if (AssetPool.IsInWeakDict(key))
     {
         AssetPool.Asset asset2 = AssetPool._weakAssetDict[key];
         return(asset2.Object);
     }
     return(null);
 }
Exemple #3
0
 private static void DeleteZeroReferenceAsset(Dictionary <string, AssetPool.Asset> assetDict)
 {
     Dictionary <string, AssetPool.Asset> .Enumerator enumerator = assetDict.GetEnumerator();
     while (enumerator.MoveNext())
     {
         KeyValuePair <string, AssetPool.Asset> current = enumerator.Current;
         string key = current.Key;
         KeyValuePair <string, AssetPool.Asset> current2 = enumerator.Current;
         AssetPool.Asset value = current2.Value;
         if (Time.realtimeSinceStartup > value.ReleaseTime)
         {
             AssetPool._deletedKeyList.Add(key);
         }
     }
     for (int i = 0; i < AssetPool._deletedKeyList.Count; i++)
     {
         assetDict.Remove(AssetPool._deletedKeyList[i]);
     }
 }