hch
2025-12-04 7ceccc591077b348613dcd1880408b82e2a183d4
Main/System/AssetVersion/InGameDownLoad.cs
@@ -3,6 +3,7 @@
using UnityEngine;
using System;
using System.Text.RegularExpressions;
using LitJson;
public class InGameDownLoad : SingletonMonobehaviour<InGameDownLoad>
@@ -79,7 +80,7 @@
        }
    }
    public List<Reward> rewards = new List<Reward>();
    public int[][] rewards;
    public bool hasReward { get; private set; }//是否有奖励
    public string completeDownLoadAccount
    {
@@ -87,7 +88,7 @@
        set { LocalSave.SetString("InGameDownLoadCompleteAccount", value); }
    }
    public Redpoint downLoadRedpoint = new Redpoint(116);
    public Redpoint downLoadRedpoint = new Redpoint(MainRedDot.RedPoint_Download);
    private void Awake()
    {
@@ -151,16 +152,7 @@
        {
            var assetVersion = this.assets[i];
            totalSize += assetVersion.size;//统计资源总大小
            //统计地图专属的资源 TODO YYL
            // var mapId = PriorBundleConfig.GetAssetBelongToMap(assetVersion.GetAssetCategory(), AssetVersionUtility.DecodeFileName(assetVersion.fileName));
            // if (mapId != 0)
            // {
            //     if (!mapTasks.ContainsKey(mapId))
            //     {
            //         mapTasks[mapId] = new List<AssetVersion>();
            //     }
            //     mapTasks[mapId].Add(assetVersion);
            // }
            //添加下载任务
            var remoteURL = StringUtility.Contact(VersionUtility.Instance.versionInfo.GetResourcesURL(VersionConfig.Get().branch), Language.fixPath, "/", assetVersion.relativePath);
            var localURL = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, assetVersion.relativePath);
@@ -179,15 +171,14 @@
        var categoryA = lhs.GetAssetCategory();
        var categoryB = rhs.GetAssetCategory();
        // TODO YYL
        // var priorA = PriorBundleConfig.GetAssetPrior(categoryA, AssetVersionUtility.DecodeFileName(lhs.fileName));
        // var priorB = PriorBundleConfig.GetAssetPrior(categoryB, AssetVersionUtility.DecodeFileName(rhs.fileName));
        var priorA = PriorBundleConfig.GetAssetPrior(categoryA, AssetVersionUtility.DecodeFileName(lhs.fileName));
        var priorB = PriorBundleConfig.GetAssetPrior(categoryB, AssetVersionUtility.DecodeFileName(rhs.fileName));
        // if (priorA != priorB)
        // {
        //     return priorA < priorB ? -1 : 1;
        // }
        // else
        if (priorA != priorB)
        {
            return priorA < priorB ? -1 : 1;
        }
        else
        {
            var isManifestA = lhs.extersion == ".manifest";
            var isManifestB = rhs.extersion == ".manifest";
@@ -265,7 +256,7 @@
                    state = State.Prepared;
                }
                dominantState = Dominant.Whole;
                // UIManager.Instance.OpenWindow<InGameDownLoadWin>();
                UIManager.Instance.OpenWindow<InGameDownLoadWin>();
                break;
        }
    }
@@ -314,7 +305,7 @@
        {
            if (dominantState == Dominant.None)
            {
                RequestDownLoadReward(false);
                // RequestDownLoadReward(false);
                state = State.Completed;
            }
            else
@@ -340,11 +331,9 @@
    public void ParseRewardConfig()
    {
        var rewardString = FuncConfigConfig.Get("DownReward").Numerical1;
        var matches = Regex.Matches(rewardString, "(\\d+,\\d+,\\d+)");
        for (int i = 0; i < matches.Count; i++)
        if (rewards.IsNullOrEmpty())
        {
            rewards.Add(new Reward(matches[i].Value));
            rewards = JsonMapper.ToObject<int[][]>(FuncConfigConfig.Get("DownReward").Numerical1);
        }
    }
@@ -360,11 +349,11 @@
        downLoadRedpoint.state = state == State.Award ? RedPointState.Simple : RedPointState.None;
    }
    public void RequestDownLoadReward(bool _manual)
    public void RequestDownLoadReward()
    {
        var send = new CA504_tagCMPlayerGetReward();
        send.RewardType = 15;
        send.DataEx = (byte)(_manual ? 0 : 1);
        // send.DataEx = (byte)(_manual ? 0 : 1);
        GameNetSystem.Instance.SendInfo(send);
    }
@@ -667,26 +656,5 @@
        Whole = 2,
    }
    #region 登录下载界面 DownLoadWin
    // 增加下载奖励 根据标识决定多次发放;注意不要与游戏内的完整下载混淆
    // 后续改成appversion_new增加扩展信息返回下载标识,用于控制当前是否显示奖励,此处首包还未包含图片资源
    public int downloadMark = 0;
    public bool IsShowDownloadAward()
    {
        int downloadMark = 0;
        int.TryParse(VersionUtility.Instance.versionInfo.ResourceAward, out downloadMark);
        var mark = LocalSave.GetInt("downloadMark");
        return downloadMark > mark;
    }
    //下载完毕成功登录游戏即可设置
    public void SetDownloadMark()
    {
        LocalSave.SetInt("downloadMark", int.Parse(FuncConfigConfig.Get("DownReward").Numerical4));
    }
    #endregion
}