示例#1
0
 public static void ReleaseAsset(string key)
 {
     if (!AssetPool.IsInStrongDict(key))
     {
         return;
     }
     AssetPool.Asset asset = AssetPool._strongAssetDict[key];
     asset.ReferenceCount--;
 }
示例#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);
 }
示例#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]);
     }
 }