using System; using System.Collections.Generic; using System.IO; using UnityEngine; public class CheckAssetValidTask : LaunchTask { public override float expectTime { get { return LocalSave.GetFloat("CheckAssetValidTask_ExpectTime", 3f); } protected set { LocalSave.SetFloat("CheckAssetValidTask_ExpectTime", value); } } public override void Begin() { LaunchInHot.m_CurrentStage = LaunchStage.CheckAsset; duration = Mathf.Max(0.5f, expectTime); ServerListCenter.Instance.RequestJumpUrl(); // TODO YYL // OperationLogCollect.Instance.RecordLauchEvent(2); // OperationLogCollect.Instance.RecordEvent(2); if (VersionUtility.Instance.NeedDownAsset()) { var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/config/PriorBundle.txt"); var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, "config/PriorBundle.txt"); var downloadTask = new DownloadTask(remoteURL, localURL); downloadTask.BeginDownload(AssetVersionUtility.OnDownLoadPriorBundle); //AssetVersionUtility.GetAssetVersionFile(); done = false; progress = 0f; } else { //if (Application.isEditor) // PatchLoader.InitLocalPatchAsset(); done = true; } } public override void End() { expectTime = timer; Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer); GameNotice.OpenGameNotice(); } public override void Update() { if (done) { return; } timer += Time.deltaTime; if (!AssetVersionUtility.checkAssetCompleted) { done = false; progress = timer / expectTime; } else { done = true; } ExceptionReport(); } }