Exemplo n.º 1
0
        private async ETVoid InternalAwake()
        {
            try
            {
                // 设置全局模式
                GlobalDefine.ILRuntimeMode = this.ILRuntimeMode;
                GlobalDefine.DevelopMode   = this.DevelopMode;
                GlobalDefine.SetLoginAddress(LoginAddress);

                // 限制帧率,尽量避免手机发烫
                QualitySettings.vSyncCount  = 0;
                Application.targetFrameRate = 60;

                SynchronizationContext.SetSynchronizationContext(ThreadSynchronizationContext.Instance);

                DontDestroyOnLoad(gameObject);

                // 初始化FGUI系统
                FUIEntry.Init();

                Updater updater = this.GetComponent <Updater>();
                m_XAssetUpdater = new XAssetUpdater(updater);

                FUI_CheckForResUpdateComponent.Init(m_XAssetUpdater.Updater);

                await m_XAssetUpdater.StartUpdate();

                byte[] dllByte = XAssetLoader.LoadAsset <TextAsset>(XAssetPathUtilities.GetHotfixDllPath("Hotfix"))
                                 .bytes;
                byte[] pdbByte = XAssetLoader.LoadAsset <TextAsset>(XAssetPathUtilities.GetHotfixPdbPath("Hotfix"))
                                 .bytes;

                HotfixHelper.GoToHotfix(dllByte, pdbByte);

                GloabLifeCycle.StartAction?.Invoke();
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
Exemplo n.º 2
0
        public static void Init(Updater updater)
        {
            s_Updater = updater;


            FUIEntry.LoadPackage_MonoOnly("CheckForResUpdate");

            FUI_CheckForResUpdateBinder.BindAll();
            FUI_CheckForResUpdate forResUpdate = FUI_CheckForResUpdate.CreateInstance();

            forResUpdate.m_processbar.max   = 100;
            forResUpdate.m_processbar.value = 0;

            FUIManager_MonoOnly.AddUI(nameof(FUI_CheckForResUpdate), forResUpdate);

            s_Updater.OnStateUpdate    += (msg) => { forResUpdate.m_updateInfo.text = msg; };
            s_Updater.OnProgressUpdate += (progress) => { forResUpdate.m_processbar.value = progress * 100; };

            s_Updater.ResPreparedCompleted += () =>
            {
                FUIManager_MonoOnly.RemoveUI(nameof(FUI_CheckForResUpdate));
                FUIEntry.RemovePackage_MonoOnly("CheckForResUpdate");
            };
        }