コード例 #1
0
ファイル: LuaStore.cs プロジェクト: tangqi1990/CatLib
        protected IEnumerator LoadHotFixAysn()
        {
            //如果处于编辑器下的自动模式和开发者模式则不进行热补丁
            #if UNITY_EDITOR
            if (Env.DebugLevel == DebugLevels.Auto || Env.DebugLevel == DebugLevels.Dev)
            {
                yield break;
            }
            #endif

            if (hotfixPath == null)
            {
                yield break;
            }

            Event.Trigger(LuaEvents.ON_HOT_FIXED_START);

            string[] filePaths = hotfixPath;

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

            foreach (string filePath in filePaths)
            {
                IFile[] infos = Disk.Directory(Env.AssetPath + "/" + filePath, PathTypes.Absolute).GetFiles(SearchOption.AllDirectories);
                foreach (var info in infos)
                {
                    if (!info.Name.EndsWith(".manifest"))
                    {
                        yield return(resources.LoadAllAsync <TextAsset>(filePath + "/" + info.Name, (textAssets) =>
                        {
                            Event.Trigger(LuaEvents.ON_HOT_FIXED_ACTION);
                            foreach (TextAsset text in textAssets)
                            {
                                LuaEnv.DoString(text.text);
                            }
                        }));
                    }
                }
            }
            Event.Trigger(LuaEvents.ON_HOT_FIXED_END);
            Event.Trigger(LuaEvents.ON_HOT_FIXED_COMPLETE);
        }