| | |
| | | public class VersionUpdateWin : Window
|
| | | {
|
| | | [SerializeField] RectTransform m_ContainerHint;
|
| | | [SerializeField] RichText m_Content;
|
| | | [SerializeField] RichText m_HintDescription;
|
| | | [SerializeField] RectTransform m_UpdateContentContainer;
|
| | | [SerializeField] RichText m_UpdateCotent;
|
| | | [SerializeField] Button m_Confirm;
|
| | |
|
| | | [SerializeField] Transform m_ContainerProgress;
|
| | |
| | | private void DisplayHintContent()
|
| | | {
|
| | | var step = VersionUtility.Instance.step;
|
| | |
|
| | | switch (step)
|
| | | {
|
| | | case VersionUtility.Step.None:
|
| | | m_Content.text = Language.GetFromLocal(4);
|
| | | m_HintDescription.text = Language.GetFromLocal(4);
|
| | | break;
|
| | | case VersionUtility.Step.ApkExist:
|
| | | m_Content.text = Language.GetFromLocal(5);
|
| | | m_HintDescription.text = Language.GetFromLocal(5);
|
| | | break;
|
| | | case VersionUtility.Step.DownLoadPrepared:
|
| | | if (Application.platform == RuntimePlatform.Android)
|
| | |
| | | switch (Application.internetReachability)
|
| | | {
|
| | | case NetworkReachability.NotReachable:
|
| | | m_Content.text = Language.GetFromLocal(6, sizeDescription);
|
| | | m_HintDescription.text = Language.GetFromLocal(6, sizeDescription);
|
| | | break;
|
| | | case NetworkReachability.ReachableViaCarrierDataNetwork:
|
| | | m_Content.text = Language.GetFromLocal(7, sizeDescription);
|
| | | m_HintDescription.text = Language.GetFromLocal(7, sizeDescription);
|
| | | break;
|
| | | case NetworkReachability.ReachableViaLocalAreaNetwork:
|
| | | m_Content.text = Language.GetFromLocal(8, sizeDescription);
|
| | | m_HintDescription.text = Language.GetFromLocal(8, sizeDescription);
|
| | | break;
|
| | | }
|
| | | }
|
| | | else if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | m_Content.text = Language.GetFromLocal(9);
|
| | | m_HintDescription.text = Language.GetFromLocal(9);
|
| | | }
|
| | | break;
|
| | | case VersionUtility.Step.DownLoad:
|
| | | m_Content.text = Language.GetFromLocal(3);
|
| | | m_HintDescription.text = Language.GetFromLocal(3);
|
| | | break;
|
| | | case VersionUtility.Step.DownLoadFailed:
|
| | | m_Content.text = Language.GetFromLocal(10);
|
| | | m_HintDescription.text = Language.GetFromLocal(10);
|
| | | break;
|
| | | }
|
| | |
|
| | | switch (step)
|
| | | {
|
| | | case VersionUtility.Step.ApkExist:
|
| | | case VersionUtility.Step.DownLoadPrepared:
|
| | | var updateContent = VersionUtility.Instance.GetUpdateContent();
|
| | | if (string.IsNullOrEmpty(updateContent))
|
| | | {
|
| | | m_UpdateContentContainer.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_UpdateContentContainer.gameObject.SetActive(true);
|
| | | m_UpdateCotent.text = updateContent;
|
| | | }
|
| | | break;
|
| | | default:
|
| | | m_UpdateContentContainer.gameObject.SetActive(false);
|
| | | break;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void Confirm()
|
| | |
| | | VersionUtility.Instance.RequestVersionCheck();
|
| | | break;
|
| | | case VersionUtility.Step.ApkExist:
|
| | | var version = VersionUtility.Instance.versionInfo.GetLatestVersion();
|
| | | var remoteURL = version.download_url;
|
| | | var fileName = Path.GetFileName(remoteURL);
|
| | | var apkLocalURL = StringUtility.Contact(VersionUtility.Instance.androidRoot, "/", fileName);
|
| | | SDKUtility.Instance.InstallAPK(apkLocalURL);
|
| | | SDKUtility.Instance.InstallAPK(VersionUtility.Instance.GetApkLocalUrl());
|
| | | break;
|
| | | case VersionUtility.Step.DownLoadPrepared:
|
| | | if (Application.platform == RuntimePlatform.Android)
|
| | |
| | | }
|
| | | else if (Application.platform == RuntimePlatform.IPhonePlayer)
|
| | | {
|
| | | Application.OpenURL(VersionUtility.Instance.versionInfo.GetLatestVersion().download_url);
|
| | | Application.OpenURL(VersionUtility.Instance.GetApkRemoteUrl());
|
| | | //打开应用商店链接
|
| | | }
|
| | | break;
|