예제 #1
0
        protected IEnumerator LoadHotFixAysn()
        {
            Event.Trigger(CLuaEvents.ON_HOT_FIXED_START);

            string[] filePath = Config.Get <string[]>("lua.hotfix");

            IResources resources = App.Make <IResources>();

            foreach (string file in filePath)
            {
                FileInfo[] infos = CDirectory.Walk((CEnv.AssetPath + "/" + file));

                foreach (var info in infos)
                {
                    if (!info.Name.EndsWith(".manifest"))
                    {
                        yield return(resources.LoadAllAsyn <TextAsset>(file + "/" + info.Name, (textAssets) =>
                        {
                            Event.Trigger(CLuaEvents.ON_HOT_FIXED_ACTION);
                            foreach (TextAsset text in textAssets)
                            {
                                LuaEnv.DoString(text.text);
                            }
                        }));
                    }
                }
            }
            Event.Trigger(CLuaEvents.ON_HOT_FIXED_END);
            Event.Trigger(CLuaEvents.ON_HOT_FIXED_COMPLETE);
        }
예제 #2
0
 /// <summary>
 /// 编译AssetBundle标记的名字
 /// </summary>
 /// <param name="path">路径</param>
 protected static void BuildAssetBundleName(string path)
 {
     CDirectory.Walk(path, (file) => {
         if (!file.Name.EndsWith(".meta"))
         {
             CCreateAssetBundles.BuildFileBundleName(file, path);
         }
     });
 }
예제 #3
0
        /// <summary>
        /// 编译列表文件
        /// </summary>
        /// <param name="path">路径</param>
        protected static void BuildListFile(string path)
        {
            CUpdateList lst = new CUpdateList(path);

            CDirectory.Walk(path, (file) => {
                if (!file.Standard().EndsWith(".meta"))
                {
                    string fullName  = file.Standard();
                    string assetName = fullName.Substring(path.Length);
                    lst.Append(assetName, CMD5.ParseFile(file), file.Length);
                }
            });
            lst.Save();
        }
예제 #4
0
        /// <summary>
        /// 获取文件更新列表
        /// </summary>
        /// <returns></returns>
        protected IEnumerator UpdateList(string resUrl)
        {
            base.Event.Trigger(CAutoUpdateEvents.ON_UPDATE_START);
            resUrl = resUrl + "/" + CEnv.PlatformToName(CEnv.SwitchPlatform);
            UnityWebRequest request = UnityWebRequest.Get(resUrl + "/" + CUpdateList.FILE_NAME);

            yield return(request.Send());

            if (request.isError || request.responseCode != 200)
            {
                this.isUpdate = false;
                base.Event.Trigger(CAutoUpdateEvents.ON_UPDATE_LIST_FAILED);
                yield break;
            }

            base.Event.Trigger(CAutoUpdateEvents.ON_SCANNING_DISK_FILE_HASH_START);

            var newLst = new CUpdateList(request).SetPath(CEnv.AssetPath);

            CUpdateList oldLst = new CUpdateList(CEnv.AssetPath);

            CDirectory.CreateDir(CEnv.AssetPath);

            CDirectory.Walk(CEnv.AssetPath, (file) => {
                if (!file.Standard().EndsWith(".meta"))
                {
                    string fullName  = file.Standard();
                    string assetName = fullName.Substring(CEnv.AssetPath.Length);
                    oldLst.Append(assetName, CMD5.ParseFile(file), file.Length);
                }
            });

            base.Event.Trigger(CAutoUpdateEvents.ON_SCANNING_DISK_FILE_HASH_END);

            CUpdateList needUpdateLst, needDeleteLst;

            oldLst.Comparison(newLst, out needUpdateLst, out needDeleteLst);

            yield return(this.DeleteOldAsset(needDeleteLst));

            yield return(this.UpdateAssetFromUrl(needUpdateLst, resUrl));

            newLst.Save();

            base.Event.Trigger(CAutoUpdateEvents.ON_UPDATE_COMPLETE);
        }