Пример #1
0
 public static void Open()
 {
     if (UI == null)
     {
         GameObject obj = Instantiate(Resources.Load <GameObject>("UpdateResourceForm"),
                                      GameEntry.UI.transform.Find("UI Form Instances"));
         UI = obj.GetComponent <UpdateResourceForm>();
     }
 }
Пример #2
0
        private void RefreshProgress()
        {
            long currentTotalUpdateLength = 0L;

            for (int i = 0; i < m_UpdateLengthData.Count; i++)
            {
                currentTotalUpdateLength += m_UpdateLengthData[i].Length;
            }

            float  progressTotal   = (float)currentTotalUpdateLength / m_UpdateTotalZipLength;
            string descriptionText = GameEntry.Localization.GetString("UpdateResource.Tips",
                                                                      m_UpdateSuccessCount.ToString(),
                                                                      m_UpdateCount.ToString(),
                                                                      GetByteLengthString(currentTotalUpdateLength),
                                                                      GetByteLengthString(m_UpdateTotalZipLength),
                                                                      progressTotal,
                                                                      GetByteLengthString((int)GameEntry
                                                                                          .Download.CurrentSpeed));

            UpdateResourceForm.SetProgress(progressTotal, descriptionText);
        }
Пример #3
0
        private void OnWebRequestSuccess(object sender, GameEventArgs e)
        {
            WebRequestSuccessEventArgs ne = (WebRequestSuccessEventArgs)e;

            if (ne.UserData != this)
            {
                return;
            }

            // 解析版本信息
            byte[] versionInfoBytes = ne.GetWebResponseBytes();
            m_VersionInfo = Utility.Json.ToObject <VersionInfo>(Utility.Converter.GetString(versionInfoBytes));
            if (m_VersionInfo == null)
            {
                Log.Error("Parse VersionInfo failure.");
                return;
            }

            Log.Info("Latest game version is '{0} ({1})', local game version is '{2} ({3})'.",
                     m_VersionInfo.LatestGameVersion, m_VersionInfo.InternalGameVersion.ToString(), Version.GameVersion,
                     Version.InternalGameVersion.ToString());

            if (m_VersionInfo.ForceUpdateGame)
            {
                // 需要强制更新游戏应用
                UpdateResourceForm.ShowFoceUpdate(GotoUpdateApp, ExitGame);
                return;
            }

            // 设置资源更新下载地址
            GameEntry.Resource.UpdatePrefixUri = Utility.Path.GetRegularPath(m_VersionInfo.UpdatePrefixUri);

            m_CheckVersionComplete = true;
            m_NeedUpdateVersion    = GameEntry.Resource.CheckVersionList(m_VersionInfo.InternalResourceVersion) ==
                                     CheckVersionListResult.NeedUpdate;
        }
Пример #4
0
 protected override void OnEnter(ProcedureOwner procedureOwner)
 {
     base.OnEnter(procedureOwner);
     //更新检测界面
     UpdateResourceForm.Open();
 }