yyl
2025-05-22 8ad0800aa926e02e05f63aa5cbf030251850a293
Main/Core/GameEngine/Launch/DownLoadAssetTask.cs
@@ -70,208 +70,5 @@
}
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.allFromEditor)
        {
            AssetBundleUtility.Instance.Initialize();
            done = false;
            progress = 0f;
        }
        else
        {
            done = true;
        }
    }
    public override void End()
    {
        expectTime = timer;
        //  TODO YYL
        // 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();
    }
}
public class ConfigInitTask : LaunchTask
{
    public override float expectTime
    {
        get { return LocalSave.GetFloat("ConfigInitTask_ExpectTime", 10f); }
        protected set { LocalSave.SetFloat("ConfigInitTask_ExpectTime", value); }
    }
    float threshold = 1f;
    public override void Begin()
    {
        LaunchInHot.m_CurrentStage = LaunchStage.ConfigInit;
        duration = Mathf.Max(0.5f, expectTime);
        threshold = Application.platform == RuntimePlatform.WindowsEditor ? 1f : 0.9f;
        // LaunchPostProcess.Instance.Begin();
        // InitialFunctionConfig.Init(true);   //有更新再初始化一次
    }
    public override void End()
    {
        expectTime = timer;
        Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
        // TODO YYL
        // OperationLogCollect.Instance.RecordLauchEvent(3);
        // OperationLogCollect.Instance.RecordEvent(3);
    }
    public override void Update()
    {
        if (done)
        {
            return;
        }
        timer += Time.deltaTime;
        // if (!ConfigInitiator.IsLoginConfigInited)\
        // TODO YYL
        // if (!ConfigInitiator.done)
        // {
        //     done = false;
        //     progress = timer / duration;
        // }
        // else
        {
            done = true;
        }
        ExceptionReport();
    }
}
public class LaunchFadeOutTask : LaunchTask
{
    public override float expectTime
    {
        get { return LocalSave.GetFloat("LaunchFadeOutTask_ExpectTime", 1f); }
        protected set { LocalSave.SetFloat("LaunchFadeOutTask_ExpectTime", value); }
    }
    public override void Begin()
    {
        LaunchInHot.m_CurrentStage = LaunchStage.Complete;
        duration = 0.5f;
        ShaderUtility.WarmUpAll();
        //SpeechTranslate.Instance.RequestGetToken();
        //  TODO CYL
        // WindowCenter.Instance.Open<LaunchBackGroundWin>(true);
        // var launchWin = WindowCenter.Instance.Get<LaunchWin>();
        // if (launchWin != null)
        // {
        //     launchWin.FadeOut();
        // }
        // try
        // {
        //     LogicLauncher.LaunchStart();
        // }
        // catch (Exception e)
        // {
        //     UnityEngine.Debug.LogError(e);
        // }
    }
    public override void End()
    {
        expectTime = timer;
        Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
    }
    public override void Update()
    {
        if (done)
        {
            return;
        }
        timer += Time.deltaTime;
        if (timer >= 0.5f)//&& ILLauncherProxy.Instance.started)
        {
            done = true;
        }
        else
        {
            done = false;
            progress = Mathf.Clamp01(timer / expectTime);
        }
        ExceptionReport();
    }
}
public class WaitTask : LaunchTask
{
    public WaitTask(float seconds)
    {
        expectTime = Mathf.Max(0.1f, seconds);
    }
    public override void Begin()
    {
    }
    public override void End()
    {
    }
    public override void Update()
    {
        timer += Time.deltaTime;
        if (timer >= expectTime)
        {
            done = true;
        }
        else
        {
            done = false;
            progress = Mathf.Clamp01(timer / expectTime);
        }
    }
}