예제 #1
0
        public static void ChangeMode(UnloadMode mode)
        {
            Log.Trace("[ilib-abloader]AutoUnloader change mode:{0}", mode);

            if (mode != UnloadMode.Auto)
            {
                if (s_Updater != null)
                {
                    GameObject.Destroy(s_Updater.gameObject);
                    s_Updater = null;
                }
            }
            else if (s_Updater == null)
            {
                GameObject obj = new GameObject("ILib.ABLoader.AutoUnloader");
                GameObject.DontDestroyOnLoad(obj);
                obj.hideFlags = HideFlags.DontSave;
                s_Updater     = obj.AddComponent <AutoUnloaderUpdater>();
            }
        }
예제 #2
0
 public static AssetBundleInfo FromString(string str)
 {
     if (string.IsNullOrEmpty(str))
     {
         return(null);
     }
     try
     {
         JSONNode         node         = JSON.Parse(str);
         string           name         = (string)node[FileNamePattern];
         long             asInt        = node[FileCompressedSizePattern].AsInt;
         string           crc          = (string)node[FileCrcPattern];
         UnloadMode       unloadMode   = (UnloadMode)node[FileUnloadModePattern].AsInt;
         DownloadMode     downloadMode = (DownloadMode)node[FileDownloadModePattern].AsInt;
         BundleType       bundleType   = (BundleType)node[FileBundleTypePattern].AsInt;
         bool             asBool       = node[RemainPattern].AsBool;
         string           remoteDir    = (string)node[RemoteDirPattern];
         HashSet <string> assetPathSet = new HashSet <string>();
         JSONArray        asArray      = node[AssetPathSetPattern].AsArray;
         for (int i = 0; i < asArray.Count; i++)
         {
             assetPathSet.Add((string)asArray[i]);
         }
         HashSet <string> parentFileNameSet = new HashSet <string>();
         JSONArray        array2            = node[ParentFileNamePattern].AsArray;
         for (int j = 0; j < array2.Count; j++)
         {
             parentFileNameSet.Add((string)array2[j]);
         }
         return(new AssetBundleInfo(name, asInt, crc, parentFileNameSet, assetPathSet, unloadMode, downloadMode, bundleType, asBool, remoteDir));
     }
     catch (Exception)
     {
         return(null);
     }
 }
예제 #3
0
 public AssetBundleInfo(string name, long compressedSize, string crc, HashSet <string> parentFileNameSet, HashSet <string> assetPathSet, UnloadMode unloadMode, DownloadMode downloadMode, BundleType bundleType, bool remain, string remoteDir)
 {
     this.FileName               = name;
     this.FileCompressedSize     = compressedSize;
     this.FileCrc                = crc;
     this.ParentFileNameSet      = parentFileNameSet;
     this.AssetPathSet           = assetPathSet;
     this.FileUnloadMode         = unloadMode;
     this.FileDownloadMode       = downloadMode;
     this.FileBundleType         = bundleType;
     this.RemainInInstallPackage = remain;
     this.RemoteDir              = remoteDir;
     this._assetBundle           = null;
     this._completeness          = false;
 }