using System; using System.Collections.Generic; using System.IO; using UnityEngine; public class AssetBundleInitTask : LaunchTask { public override float expectTime { get { return LocalSave.GetFloat("AssetBundleInitTask_ExpectTime", 1f); } protected set { LocalSave.SetFloat("AssetBundleInitTask_ExpectTime", value); } } public override void Begin() { LaunchInHot.m_CurrentStage = LaunchStage.AssetBundleInit; duration = Mathf.Max(0.5f, expectTime); if (AssetSource.isUseAssetBundle) { AssetBundleUtility.Instance.Initialize(); done = false; progress = 0f; } else { done = true; } } public override void End() { expectTime = timer; // UILoader.LoadWindowAsync("LaunchBackGroundWin", null); Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer); } public override void Update() { if (done) { return; } if (AssetBundleUtility.Instance.initialized && AssetBundleUtility.Instance.initializedUIAssetBundle) { done = true; } else { done = false; progress = timer / duration; } ExceptionReport(); } }