Beispiel #1
0
        private AssetPackABImpl LoadAssetPackAuto(string abname)
        {
            string[] deps = m_manifest.GetDirectDependencies(abname);
            foreach (string depAbname in deps)
            {
                AssetPackABImpl depAp = GetAssetBundle(depAbname);
            }
            string      abpath = Path.Combine(FileArtPath, abname);
            AssetBundle ab     = AssetBundle.LoadFromFile(abpath);

            return(new AssetPackABImpl(ab));
        }
Beispiel #2
0
        private AssetPackABImpl GetAssetBundle(string abname)
        {
            AssetPackABImpl ap = null;

            if (!m_ab_map.TryGetValue(abname, out ap))
            {
                ap = LoadAssetPackAuto(abname);
                m_ab_map.Add(abname, ap);
            }
            ap.Lock();
            return(ap);
        }
Beispiel #3
0
        public override void UnloadPack(string abname)
        {
            string realname = GetRealABName(abname);
            //减去引用计数,当计数为0时卸载AB
            AssetPackABImpl ap = null;

            if (m_ab_map.TryGetValue(realname, out ap))
            {
                if (ap.Unlock())
                {
                    ap.Unload();
                    string[] depNames = m_manifest.GetDirectDependencies(realname);
                    foreach (var depName in depNames)
                    {
                        UnloadPack(depName);
                    }
                }
            }
        }
Beispiel #4
0
        public override AssetPack LoadPack(string abname)
        {
            AssetPackABImpl ret = GetAssetBundle(GetRealABName(abname));

            return(ret);
        }