yyl
2026-05-11 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections.Generic;
using System.IO;
using Cysharp.Threading.Tasks;
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().Forget();
 
        // TODO YYL
        // OperationLogCollect.Instance.RecordLauchEvent(2);
        // OperationLogCollect.Instance.RecordEvent(2);
 
        VersionConfig.GetAsync().ContinueWith(config =>
        {
            if (VersionUtility.Instance.NeedDownAsset())
            {
                done = false;
                progress = 0f;
                // 通过 YooAsset(ConfigManager)加载配置,不再走旧的 HTTP 下载
                LoadConfigsViaYooAsset().Forget();
            }
            else
            {
                done = true;
            }
        }).Forget();
    }
 
    private async UniTaskVoid LoadConfigsViaYooAsset()
    {
        try
        {
            // 并行加载 PriorBundle 和 OPConfig(通过 YooAsset / ConfigManager)
            var t1 = PriorBundleConfig.LazyInitAsync();
            var t2 = OPConfigConfig.LazyInitAsync();
            await UniTask.WhenAll(t1, t2);
            Debug.Log("[CheckAssetValidTask] PriorBundle 和 OPConfig 通过 YooAsset 加载完成");
 
            // YooAsset 已在 Launch 阶段完成资源版本检查和下载
            // 不再需要旧的 AssetsVersion.txt 下载 + 文件校验流程
            AssetVersionUtility.ForceCompleteCheck();
        }
        catch (Exception ex)
        {
            Debug.LogError($"[CheckAssetValidTask] YooAsset 加载配置失败: {ex}");
            AssetVersionUtility.ForceCompleteCheck();
        }
    }
 
    public override void End()
    {
        expectTime = timer;
        Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
 
        GameNotice.OpenGameNotice();
        OperationLogCollect.Instance.RecordLauchEvent(13);
    }
 
    public override void Update()
    {
        if (done)
        {
            return;
        }
 
        timer += Time.deltaTime;
        if (!AssetVersionUtility.checkAssetCompleted)
        {
            done = false;
            progress = timer / expectTime;
        }
        else
        {
            done = true;
        }
 
        ExceptionReport();
    }
}