| | |
| | | public override void Initialize()
|
| | | {
|
| | | base.Initialize();
|
| | | checkClientTimer = Time.time + 60f;
|
| | | checkAssetVersionTimer = Time.time + 70f;
|
| | |
|
| | | WindowCenter.Instance.Open<LaunchBackGroundWin>(true);
|
| | |
|
| | | var backGroundWin = WindowCenter.Instance.Get<LaunchBackGroundWin>();
|
| | |
| | | }
|
| | |
|
| | | MapTransferUtility.Instance.Clear();
|
| | |
|
| | | PreFightMission.Instance.Destroy();
|
| | | }
|
| | |
|
| | | public override void UnInitialize()
|
| | | {
|
| | | StopAllCoroutines();
|
| | | base.UnInitialize();
|
| | | }
|
| | |
|
| | | protected override void OnLateUpdate()
|
| | | {
|
| | | base.OnLateUpdate();
|
| | |
|
| | | CheckClientVersion();
|
| | | CheckClientAssets();
|
| | | }
|
| | |
|
| | | float checkClientTimer = 0f;
|
| | | private void CheckClientVersion()
|
| | | {
|
| | | if (Time.time > checkClientTimer)
|
| | | {
|
| | | checkClientTimer = Time.time + 60f;
|
| | | StopCoroutine("Co_RequestGetVersionInfo");
|
| | | StartCoroutine("Co_RequestGetVersionInfo");
|
| | | }
|
| | | }
|
| | |
|
| | | private IEnumerator Co_RequestGetVersionInfo()
|
| | | {
|
| | | VersionUtility.Instance.RequestVersionCheck();
|
| | |
|
| | | while (!VersionUtility.Instance.completed)
|
| | | {
|
| | | yield return null;
|
| | | }
|
| | |
|
| | | if (VersionUtility.Instance.versionInfo != null
|
| | | && VersionUtility.Instance.versionInfo.VersionCount > 0)
|
| | | {
|
| | | checkClientTimer = Time.time + 60000f;
|
| | | ConfirmCancel.ShowPopConfirm(
|
| | | Language.Get("Mail101"),
|
| | | Language.GetFromLocal(35),
|
| | | () =>
|
| | | {
|
| | | switch (Application.platform)
|
| | | {
|
| | | case RuntimePlatform.IPhonePlayer:
|
| | | Application.Quit();
|
| | | break;
|
| | | case RuntimePlatform.Android:
|
| | | SDKUtility.Instance.RestartApp();
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | checkClientTimer = Time.time + 60f;
|
| | | }
|
| | | }
|
| | |
|
| | | float checkAssetVersionTimer = 0f;
|
| | | private void CheckClientAssets()
|
| | | {
|
| | | if (Time.time > checkAssetVersionTimer)
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 5f;
|
| | | if (VersionUtility.Instance.NeedDownAsset())
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 10f;
|
| | | var assetVersionUrl = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), "/", "AssetsVersion.txt");
|
| | | HttpRequest.Instance.RequestHttpGet(assetVersionUrl, HttpRequest.defaultHttpContentType, 3, OnGetAssetVersionFile);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnGetAssetVersionFile(bool ok, string result)
|
| | | {
|
| | | if (ok)
|
| | | {
|
| | | var md5 = FileExtersion.GetStringMD5Hash(result);
|
| | | if (AssetVersionUtility.assetVersionsLocalMd5 != md5)
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 36000f;
|
| | | ConfirmCancel.ShowPopConfirm(
|
| | | Language.Get("Mail101"),
|
| | | Language.GetFromLocal(35),
|
| | | () =>
|
| | | {
|
| | | switch (Application.platform)
|
| | | {
|
| | | case RuntimePlatform.IPhonePlayer:
|
| | | Application.Quit();
|
| | | break;
|
| | | case RuntimePlatform.Android:
|
| | | SDKUtility.Instance.RestartApp();
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | | );
|
| | | }
|
| | | else
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 60f;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | checkAssetVersionTimer += Time.time + 60f;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|