Example #1
0
        public static void ClearStackItem(string name, bool clearMemory)
        {
            if (0 > Holder.m_stackIP)
            {
                Holder._CreateDefaultStack();
            }
            name = name.ToLower();
            bool flag = false;
            Dictionary <string, WWWItem> dictionary = null;

            for (int i = Holder.m_stackIP; i >= 0; i--)
            {
                string b = Holder.m_bundleNameStack[i].ToLower();
                if (name == b)
                {
                    dictionary = Holder.m_bundleGroupStack[i];
                    foreach (KeyValuePair <string, WWWItem> current in dictionary)
                    {
                        Holder._UnloadAssetBundle(current.Value, clearMemory);
                    }
                    dictionary.Clear();
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                TsLog.Log("[TsBundle] ClearStackItem() Cannot found StackName= {0}", new object[]
                {
                    name
                });
            }
        }
Example #2
0
        private static WWWItem TryGetBundle(string key)
        {
            if (0 > Holder.m_stackIP)
            {
                Holder._CreateDefaultStack();
            }
            key = key.ToLower();
            WWWItem result = null;

            Holder._TryGetBundle(key, out result);
            return(result);
        }
Example #3
0
 public static void PushBundleGroup(string name)
 {
     if (0 > Holder.m_stackIP)
     {
         Holder._CreateDefaultStack();
     }
     Holder.m_stackIP++;
     if (name == null)
     {
         name = Holder.m_stackIP.ToString();
     }
     Holder.m_bundleGroupStack.Add(new Dictionary <string, WWWItem>());
     Holder.m_bundleNameStack.Add(name);
 }
Example #4
0
 private static void PopBundleGroup()
 {
     if (0 > Holder.m_stackIP)
     {
         Holder._CreateDefaultStack();
     }
     else
     {
         Dictionary <string, WWWItem> dictionary = Holder.m_bundleGroupStack[Holder.m_stackIP];
         foreach (KeyValuePair <string, WWWItem> current in dictionary)
         {
             Holder._UnloadAssetBundle(current.Value, true);
         }
         dictionary.Clear();
         Holder.m_bundleGroupStack.RemoveAt(Holder.m_stackIP);
         Holder.m_bundleNameStack.RemoveAt(Holder.m_stackIP);
         Holder.m_stackIP--;
     }
 }
Example #5
0
        public static WWWItem TryGetOrCreateBundle(string key, string stackName, bool immediatelyUrl)
        {
            if (0 > Holder.m_stackIP)
            {
                Holder._CreateDefaultStack();
            }
            if (!key.Contains("?notlow"))
            {
                key = key.ToLower();
            }
            WWWItem wWWItem = null;

            Holder._TryGetBundle(key, out wWWItem);
            if (wWWItem == null)
            {
                Dictionary <string, WWWItem> dictionary = Holder._FindStack(stackName);
                dictionary.TryGetValue(key, out wWWItem);
                if (wWWItem == null)
                {
                    int index = Holder.m_bundleGroupStack.IndexOf(dictionary);
                    stackName = Holder.m_bundleNameStack[index];
                    wWWItem   = new WWWItem(stackName);
                    if (immediatelyUrl)
                    {
                        wWWItem.SetAnotherUrl(key);
                    }
                    else
                    {
                        wWWItem.SetAssetPath(key);
                    }
                    Holder._AddTo(stackName, wWWItem);
                }
            }
            wWWItem.refCnt++;
            return(wWWItem);
        }