Example #1
0
 public BundleStartBody(string name, string url = null) : base(name, url)
 {
     constUpdate            = new Body(URLConfig.ConstUpdate);
     appUpdate              = new VersionInfoBody(URLConfig.AppVersion);
     appUpdate.assetVersion = AssetBundleManager.Inst.GetVersion();
     login = LoginManager.Inst.GetLoginBody();
 }
Example #2
0
        /// <summary>
        /// 获取最新的版本信息
        /// </summary>
        /// <param name="upgradeInfo"></param>
        /// <returns></returns>
        public IEnumerator Upgrade(GameController.UpgradeInfo upgradeInfo)
        {
            //yield break;
            if (!AssetBundleConfig.Inst.UseAssetBundle)
            {
                yield break;
            }

            //请求服务器版本信息
            bool            finishCheckVersion = false;
            DataContainer   dataContainer      = new DataContainer();
            VersionInfoBody vb = new VersionInfoBody(URLConfig.AppVersion);

            vb.assetVersion = this._versionInfo.Version;
            HttpRequestTool.SendMessage(vb,
                                        (sucessData) =>
            {
                DebugUtil.Log("appversion sucess:" + sucessData);
                JSONNode jsonNode = JSONNode.Parse(sucessData);
                latestAssetUrl    = jsonNode["assetUrl"];
                if (string.IsNullOrEmpty(assetUrl))
                {
                    assetUrl = latestAssetUrl;
                }

                if (upgradeInfo != null)
                {
                    upgradeInfo.appUrl   = jsonNode["appUrl"];
                    upgradeInfo.assetUrl = latestAssetUrl;

                    upgradeInfo.assetUpdateType = jsonNode["assetUpdateType"];
                    upgradeInfo.appUpdateType   = jsonNode["appUpdateType"];

                    upgradeInfo.appVersion   = jsonNode["appVersion"];
                    upgradeInfo.assetVersion = jsonNode["assetVersion"];

                    if (upgradeInfo.appUpdateType == 1 || upgradeInfo.appUpdateType == 2)
                    {
                        upgradeInfo.noticeTitle   = jsonNode["appNotice"]["noticeTitle"];
                        upgradeInfo.noticeContent = jsonNode["appNotice"]["noticeContent"];
                        TableBI.Version_Updating(vb.appVersion, upgradeInfo.appVersion, vb.assetVersion, upgradeInfo.assetVersion);
                    }
                    else if (upgradeInfo.assetUpdateType == 1)
                    {
                        upgradeInfo.noticeTitle   = jsonNode["assetNotice"]["noticeTitle"];
                        upgradeInfo.noticeContent = jsonNode["assetNotice"]["noticeContent"];
                        TableBI.Version_Updating(vb.appVersion, upgradeInfo.appVersion, vb.assetVersion, upgradeInfo.assetVersion);
                    }
                }
                finishCheckVersion = true;
            },
                                        (failData) =>
            {
                DebugUtil.LogError("appversion fail:" + failData);
                finishCheckVersion = true;
            }, null, false);


            //等待版本信息
            while (!finishCheckVersion)
            {
                yield return(null);
            }
        }