Exemple #1
0
        private IEnumerator UF_IRequestCheckUpgrade(DelegateBoolMethod callback)
        {
            //先检查源站文件是否能正常下载,否则去CDN获取文件
            string urlVersionFile    = UF_GetUpgradeFileURL(GlobalSettings.UrlRawAssetsUpgrade);
            WWW    wwwResVersionFile = new WWW(urlVersionFile);

            yield return(wwwResVersionFile);

            if (!string.IsNullOrEmpty(wwwResVersionFile.error))
            {
                UF_LogError(string.Format("CheckUpgrade -> Raw wwwResVersionFile error[{0}]  \n errorinfo:[{1}]", wwwResVersionFile.url, wwwResVersionFile.error));
                wwwResVersionFile.Dispose();
                UF_LogInfo("CheckUpgrade -> Try to download version file from CDN");
                urlVersionFile    = UF_GetUpgradeFileURL(GlobalSettings.UrlAssetsUpgrade);
                wwwResVersionFile = new WWW(urlVersionFile);
                yield return(wwwResVersionFile);
            }

            List <UpgradeFileInfo> outFiles = new List <UpgradeFileInfo>();
            string localVersion             = UF_GetLocalResVersion();

            if (!string.IsNullOrEmpty(wwwResVersionFile.error))
            {
                UF_LogError(string.Format("IRequestUpgradeInfo error[{0}]  \n errorinfo:[{1}]", wwwResVersionFile.url, wwwResVersionFile.error));
            }
            else
            {
                string txtVersionFile = wwwResVersionFile.text;
                Debugger.UF_LogTag("version", string.Format("CheckUpgrade:{0} \n {1}", urlVersionFile, txtVersionFile));
                UF_WrapUpdateList(txtVersionFile, localVersion, outFiles);
            }
            wwwResVersionFile.Dispose();
            callback(outFiles.Count > 0);
        }
Exemple #2
0
 protected override void OnDestroy()
 {
     RefObjectManager.UF_GetInstance().UF_ReleaseRef(this.texture);
     this.texture         = null;
     m_OnWebTextureLoaded = null;
     base.OnDestroy();
 }
Exemple #3
0
        //请求是否需要更新
        internal void UF_RequestCheckUpgrade(DelegateBoolMethod callback)
        {
#if UNITY_EDITOR
            callback(false);
#else
            UF_StartCoroutine(UF_IRequestCheckUpgrade(callback));
#endif
        }
Exemple #4
0
 public void UF_Clear(bool alphaZero)
 {
     if (alphaZero)
     {
         this.color = new Color(1, 1, 1, 0);
     }
     UF_SetRawTexture(null);
     m_OnWebTextureLoaded = null;
 }
Exemple #5
0
 public int UF_SetWebTextureWithCallback(string url, DelegateBoolMethod callback)
 {
     //自动调整为不渲染颜色
     this.color = new Color(1, 1, 1, 0);
     if (string.IsNullOrEmpty(url))
     {
         UF_SetRawTexture(null);
         return(0);
     }
     m_OnWebTextureLoaded = callback;
     return(TextureManager.UF_GetInstance().UF_LoadTextureFromCacheOrDownload(url, UF_OnWebTextureLoaded));
 }
Exemple #6
0
 private void UF_OnWebTextureLoaded(Texture2D tex2d)
 {
     if (this != null)
     {
         bool retValue = true;
         if (tex2d != null)
         {
             this.color       = Color.white;
             tex2d.filterMode = FilterMode.Bilinear;
             retValue         = false;
         }
         this.UF_SetRawTexture(tex2d);
         if (m_OnWebTextureLoaded != null)
         {
             DelegateBoolMethod callback = m_OnWebTextureLoaded;
             m_OnWebTextureLoaded = null;
             callback(retValue);
         }
         m_MarkChanged = true;
     }
 }
Exemple #7
0
 //请求是否有最新更新
 public static void UF_RequestCheckUpgrade(DelegateBoolMethod callback)
 {
     UpgradeSystem.UF_GetInstance().UF_RequestCheckUpgrade(callback);
 }
Exemple #8
0
        private IEnumerator UF_Check(DelegateBoolMethod checkFinish)
        {
#if __IGNORE_UPGRADE__
            m_UpgradeView.UF_Show();
            m_UpgradeView.UF_DisplayProgress(false);
            yield return(new WaitForSeconds(0.5f));

            m_UpgradeView.UF_DisplayProgress(true);
            checkFinish(true);
#else
            /// 1.检查获取本地版本号
            int state = STATE_NORMAL;
            UF_StartCoroutine(UF_Start((e) => { state = (int)e; }));
            while (state == STATE_NORMAL)
            {
                yield return(null);
            }
            if (state == STATE_ERROR)
            {
                checkFinish(false); yield break;
            }


            //审核状态跳过安装与更新
            if (GlobalSettings.IsAppCheck)
            {
                checkFinish(true);
                Debugger.UF_Warn("App Check Mode Skip Install and Update");
                yield break;
            }
            //显示更新图
            m_UpgradeView.UF_Show();
            m_UpgradeView.UF_DisplayProgress(true);

            /// 2.检查是否已经初始化安装
            state = STATE_NORMAL;
            UF_StartCoroutine(UF_Install((e) => { state = (int)e; }));
            while (state == STATE_NORMAL)
            {
                yield return(null);
            }
            if (state == STATE_ERROR)
            {
                checkFinish(false); yield break;
            }

            UF_ResfreshVersion();
            yield return(null);

            m_UpgradeView.UF_SetInfo(GlobalText.LAN_START_INIT);
            if (GlobalSettings.UF_GetGlobalValue("DEBUG", "NO_HOTFIX").Equals("1"))
            {
                checkFinish(true);
                Debugger.UF_Warn("NO_HOTFIX Tag Skip File Update");
                yield break;
            }

            /// 3.检查是否有版本更新

            state = STATE_NORMAL;
            UF_StartCoroutine(UF_Upgrade((e) => { state = (int)e; }));
            while (state == STATE_NORMAL)
            {
                yield return(null);
            }
            if (state == STATE_ERROR)
            {
                checkFinish(false); yield break;
            }

            yield return(null);

            m_UpgradeView.UF_SetInfo(GlobalText.LAN_START_INIT);
            yield return(null);

            UF_ResfreshVersion();
            yield return(null);

            m_UpgradeView.UF_DisplayProgress(false);
            yield return(null);

            m_UpgradeView.UF_SetInfo(GlobalText.LAN_TAG_MAINWORK_LOADING);
            checkFinish(true);
#endif
            yield return(null);
        }