yyl
2025-12-10 02c0f5ea45f87655389a5b392cf00268601e67bb
Main/System/Achievement/AchievementManager.cs
@@ -60,11 +60,14 @@
        UpdateRedpoint(types);
    }
    public int GetAchievementProgress(int type)
    public int GetAchievementProgress(int type, string condKey = "")
    {
        if (achivementDict.ContainsKey(type))
        {
            var condKey = SuccessConfig.GetConditionString(type);
            if (string.IsNullOrEmpty(condKey))
            {
                condKey = SuccessConfig.GetConditionString(type);
            }
            if (achivementDict[type].ContainsKey(condKey))
            {
                return achivementDict[type][condKey];
@@ -113,10 +116,10 @@
    }
    //获取成就状态  0: 未领取 1: 未达成 2: 已领取
    public int GetAchievementState(int id)
    public int GetAchievementState(int id, string condKey = "")
    {
        var config = SuccessConfig.Get(id);
        var process = GetAchievementProgress(config.Type);
        var process = GetAchievementProgress(config.Type, condKey);
        if (process < config.NeedCnt)
        {
            return 1;
@@ -131,10 +134,33 @@
    //主线章节
    Redpoint mainLevelRedpoint = new Redpoint(MainRedDot.RedPoint_DailyKey, MainRedDot.RedPoint_MainMissionKey);
    //庆典成就
    const int osGalaRepointSuccessID = MainRedDot.RedPoint_OSGala * 10 + 1;
    Redpoint osGalaRedpoint = new Redpoint(MainRedDot.RedPoint_OSGala, osGalaRepointSuccessID);
    //类型:红点id
    Dictionary<int, int> redpointDict = new Dictionary<int, int>()
    {
        {1, MainRedDot.RedPoint_MainMissionKey}
        {1, MainRedDot.RedPoint_MainMissionKey},
        {2, osGalaRepointSuccessID},
        {3, osGalaRepointSuccessID},
        {4, osGalaRepointSuccessID},
        {5, osGalaRepointSuccessID},
        {6, osGalaRepointSuccessID},
        {7, osGalaRepointSuccessID},
        {8, osGalaRepointSuccessID},
        {9, osGalaRepointSuccessID},
        {10, osGalaRepointSuccessID},
        {11, osGalaRepointSuccessID},
        {12, osGalaRepointSuccessID},
        {13, osGalaRepointSuccessID},
        {14, osGalaRepointSuccessID},
        {15, osGalaRepointSuccessID},
        {16, osGalaRepointSuccessID},
        {17, osGalaRepointSuccessID},
        {18, osGalaRepointSuccessID},
        {19, osGalaRepointSuccessID},
    };
    void UpdateRedpoint(List<int> _types)
@@ -144,9 +170,15 @@
            _types = redpointDict.Keys.ToList();
        }
        bool isGalaRed = false;
        foreach (var type in _types)
        {
            if (!redpointDict.ContainsKey(type))
            {
                continue;
            }
            if (isGalaRed && type >= 2 && type <= 19)
            {
                continue;
            }
@@ -162,11 +194,19 @@
            foreach (var id in allAchivement)
            {
                var config = SuccessConfig.Get(id);
                if (type == 6)
                {
                    process = GetAchievementProgress(type, config.Condition[0].ToString());
                }
                if (config.NeedCnt <= process)
                {
                    if (!IsAchievementAwarded(id))
                    {
                        redpoint.state = RedPointState.Simple;
                        if (type >= 2 && type <= 19)
                        {
                            isGalaRed = true;
                        }
                        break;
                    }
                }
@@ -185,6 +225,10 @@
                return true;
            }
        }
        else if (type >= 2 && type <= 19)
        {
            return OSActivityManager.Instance.IsOpenedOSGala();
        }
        return false;
    }
@@ -198,8 +242,14 @@
    int CmpIds(int a, int b)
    {
        var stateA = GetAchievementState(a);
        var stateB = GetAchievementState(b);
        var configA = SuccessConfig.Get(a);
        var configB = SuccessConfig.Get(b);
        var condA = configA.Condition.IsNullOrEmpty() ? "" : configA.Condition[0].ToString();
        var condB = configB.Condition.IsNullOrEmpty() ? "" : configB.Condition[0].ToString();
        var stateA = GetAchievementState(a, condA);
        var stateB = GetAchievementState(b, condB);
        if (stateA != stateB)
        {
@@ -209,6 +259,27 @@
        return a - b;
    }
    public List<int> GetAchievementIDsByTypes(int[] types)
    {
        List<int> allIds = new List<int>();
        foreach (var type in types)
        {
            var ids = SuccessConfig.GetTypeToIDDict(type);
            if (!ids.IsNullOrEmpty())
            {
                //合并
                allIds.AddRange(SuccessConfig.GetTypeToIDDict(type));
            }
            // else
            // {
            //     Debug.LogError($"{type}");
            // }
        }
        allIds.Sort(CmpIds);
        return allIds;
    }
    public void SendGetAward(int id)
    {
        var config = SuccessConfig.Get(id);