hch
2026-03-20 c8aea6cbef51b3dd41b4d911bc7e6bf89a6e2e2d
Main/System/OSActivity/OSActivityManager.cs
@@ -10,14 +10,23 @@
    Dictionary<int, int[]> rankOpenDays = new Dictionary<int, int[]>();  //排行榜类型:【开始开服天, 结束开服天】
    public Dictionary<int, int[][]> mainLevelRankAwards = new Dictionary<int, int[][]>();  //主线关卡名次:奖励
    public Dictionary<int, int[][]> heroCallRankAwards = new Dictionary<int, int[][]>();  //武将招募名次:奖励
    public Dictionary<int, int[][]> beautyMMRankAwards = new Dictionary<int, int[][]>();  //红颜冲榜名次:奖励
    public Dictionary<int, int[][]> heroTrainRankAwards = new Dictionary<int, int[][]>();  //武将冲榜名次:奖励
    public Dictionary<int, int[][]> minggeRankAwards = new Dictionary<int, int[][]>();  //命格冲榜:奖励
    public List<int> osHeroCallGiftSortList = new List<int>();    //开服招募礼包 充值ID + 100000000
    public List<int> osBeautyMMGiftSortList = new List<int>();    //红颜冲榜礼包 充值ID + 100000000
    public List<int> osHeroTrainGiftSortList = new List<int>();    //武将冲榜礼包 充值ID + 100000000
    public List<int> osMinggeGiftSortList = new List<int>();    //命格冲榜礼包 充值ID + 100000000
    //开服榜对应的功能ID
    Dictionary<int, int> rankTypeToFuncID = new Dictionary<int, int>()
    {
        {3, 45},
        {4, 46},
        {7, 59},
        {8, 60},
        {9, 61},
    };
@@ -51,6 +60,11 @@
        rankOpenDays = ConfigParse.ParseIntArrayDict(config.Numerical1);
        mainLevelRankAwards = ConfigParse.ParseIntArray2Dict(config.Numerical2);
        heroCallRankAwards = ConfigParse.ParseIntArray2Dict(config.Numerical3);
        beautyMMRankAwards = ConfigParse.ParseIntArray2Dict(config.Numerical4);
        config = FuncConfigConfig.Get("OSABillboardTrain");
        heroTrainRankAwards = ConfigParse.ParseIntArray2Dict(config.Numerical3);
        minggeRankAwards = ConfigParse.ParseIntArray2Dict(config.Numerical5);
        var list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSHeroCall];
        var _list = RechargeManager.Instance.GetCTGIDListByType(18);
@@ -65,13 +79,50 @@
            osHeroCallGiftSortList.Add(_list[i] + 100000000);
        }
        config = FuncConfigConfig.Get("OSACelebration");
        osGalaOpenDays = int.Parse(config.Numerical1);
        osGalaScoreAwards = ConfigParse.ParseIntArray2Dict(config.Numerical2);
        list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSBeautyMM];
        _list = RechargeManager.Instance.GetCTGIDListByType(22);
        for (int i = 0; i < list.Count; i++)
        {
            var item = list[i];
            osBeautyMMGiftSortList.Add(item.shopId);
        }
        for (int i = 0; i < _list.Count; i++)
        {
            osBeautyMMGiftSortList.Add(_list[i] + 100000000);
        }
        list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSHeroTrain];
        _list = RechargeManager.Instance.GetCTGIDListByType(23);
        for (int i = 0; i < list.Count; i++)
        {
            var item = list[i];
            osHeroTrainGiftSortList.Add(item.shopId);
        }
        for (int i = 0; i < _list.Count; i++)
        {
            osHeroTrainGiftSortList.Add(_list[i] + 100000000);
        }
        list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSMingge];
        _list = RechargeManager.Instance.GetCTGIDListByType(24);
        for (int i = 0; i < list.Count; i++)
        {
            var item = list[i];
            osMinggeGiftSortList.Add(item.shopId);
        }
        for (int i = 0; i < _list.Count; i++)
        {
            osMinggeGiftSortList.Add(_list[i] + 100000000);
        }
        ParseOSGalaConfig();
    }
    // 开服排行活动是否开启
    public bool IsOpened(int rankType)
    public bool IsOpened(int rankType, bool needLastDay = true)
    {
        if (!rankTypeToFuncID.ContainsKey(rankType))
        {
@@ -90,9 +141,19 @@
        }
        var openDays = rankOpenDays[rankType];
        if (TimeUtility.OpenDay > openDays[1])
        if (needLastDay)
        {
            return false;
            if (TimeUtility.OpenDay > openDays[1])
            {
                return false;
            }
        }
        else
        {
            if (TimeUtility.OpenDay >= openDays[1])
            {
                return false;
            }
        }
        return true;
@@ -147,9 +208,13 @@
        return a.CompareTo(b);
    }
    //开服招募榜礼包
    public void RefreshGiftSortList()
    {
        osHeroCallGiftSortList.Sort(CmpGift);
        osBeautyMMGiftSortList.Sort(CmpGift);
        osHeroTrainGiftSortList.Sort(CmpGift);
        osMinggeGiftSortList.Sort(CmpGift);
    }
    void RefreshStore()
@@ -160,15 +225,27 @@
    Redpoint osMainLevelRedpoint = new Redpoint(MainRedDot.RedPoint_OSMainLevel);
    Redpoint osHeroCallRedpoint = new Redpoint(MainRedDot.RedPoint_OSHeroCard);
    Redpoint osHeroTrainRedpoint = new Redpoint(MainRedDot.RedPoint_OSHeroTrain);
    Redpoint osBeautyMMRedpoint = new Redpoint(MainRedDot.RedPoint_OSBeautyMM);
    Redpoint osMinggeRedpoint = new Redpoint(MainRedDot.RedPoint_OSMingge);
    public void UpdateRedpoint()
    {
        osMainLevelRedpoint.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSMainLevel) ? RedPointState.Simple : RedPointState.None;
        osGalaRedpoint2.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSGalaChange) ? RedPointState.Simple : RedPointState.None;
        osHeroTrainRedpoint.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSMainLevel) ? RedPointState.Simple : RedPointState.None;
        osBeautyMMRedpoint.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSMainLevel) ? RedPointState.Simple : RedPointState.None;
        osMinggeRedpoint.state = !DayRemind.Instance.GetDayRemind(DayRemind.OSMainLevel) ? RedPointState.Simple : RedPointState.None;
        osHeroCallRedpoint.state = RedPointState.None;
        osGalaRedpoint3.state = RedPointState.None;
        osHeroTrainRedpoint.state = RedPointState.None;
        osBeautyMMRedpoint.state = RedPointState.None;
        osMinggeRedpoint.state = RedPointState.None;
        if (StoreModel.Instance.freeShopDict.Count == 0) return;
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSHeroCall))
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSHeroCall) && IsOpened(4, false))
        {
            var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSHeroCall];
@@ -183,6 +260,68 @@
                }
            }
        }
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSGalaGift) && IsOpenedOSGala(false))
        {
            var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSGalaGift];
            for (int i = 0; i < shopList.Count; i++)
            {
                var shopID = shopList[i];
                var config = StoreConfig.Get(shopID);
                if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
                {
                    osGalaRedpoint3.state = RedPointState.Simple;
                    break;
                }
            }
        }
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSHeroTrain) && IsOpened(7, false))
        {
            var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSHeroTrain];
            for (int i = 0; i < shopList.Count; i++)
            {
                var shopID = shopList[i];
                var config = StoreConfig.Get(shopID);
                if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
                {
                    osHeroTrainRedpoint.state = RedPointState.Simple;
                    break;
                }
            }
        }
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSBeautyMM) && IsOpened(8, false))
        {
            var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSBeautyMM];
            for (int i = 0; i < shopList.Count; i++)
            {
                var shopID = shopList[i];
                var config = StoreConfig.Get(shopID);
                if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
                {
                    osBeautyMMRedpoint.state = RedPointState.Simple;
                    break;
                }
            }
        }
        if (StoreModel.Instance.freeShopDict.ContainsKey((int)StoreFunc.OSMingge) && IsOpened(9, false))
        {
            var shopList = StoreModel.Instance.freeShopDict[(int)StoreFunc.OSMingge];
            for (int i = 0; i < shopList.Count; i++)
            {
                var shopID = shopList[i];
                var config = StoreConfig.Get(shopID);
                if (StoreModel.Instance.GetShopLimitBuyCount(shopID) < config.LimitCnt)
                {
                    osMinggeRedpoint.state = RedPointState.Simple;
                    break;
                }
            }
        }
    }
    private void FuncStateChange(int funcId)
@@ -191,6 +330,9 @@
        {
            case FuncOpenEnum.OSMainLevl:
            case FuncOpenEnum.OSHeroCall:
            case FuncOpenEnum.OSHeroTrain:
            case FuncOpenEnum.OSBeautyMM:
            case FuncOpenEnum.OSMingge:
                UpdateRedpoint();
                break;
        }
@@ -199,28 +341,125 @@
    #region 开服庆典
    //开服庆典
    public int osGalaOpenDays = 0; //持续天数
    public Dictionary<int, int[][]> osGalaScoreAwards = new Dictionary<int, int[][]>();  // 开服庆典积分奖励
    public Dictionary<int, int[][]> osGalaScoreAwards = new Dictionary<int, int[][]>();  // 开服庆典积分奖励 积分:奖励
    public Dictionary<int, int> typeToGuideID = new Dictionary<int, int>();
    public List<int> osGalaChangeSortList = new List<int>();    //兑换列表(商店5)
    public List<int> osGalaGiftSortList = new List<int>();    //开服庆典礼包 充值ID + 100000000
    public int osGalaScore = 0; //当前积分 累计的;消耗的是货币55
    public int osGalaAwardState = 0; //按位记录是否领取
    public event Action OnOSGalaDataChangeEvent;
    // 兑换商店
    Redpoint osGalaRedpoint2 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 2);
    // 礼包免费
    Redpoint osGalaRedpoint3 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 3);
    // 总奖励
    Redpoint osGalaRedpoint4 = new Redpoint(MainRedDot.RedPoint_OSGala, MainRedDot.RedPoint_OSGala * 10 + 4);
    public void UpdateOSGalaData(HAB05_tagSCOSACelebrationInfo netPack)
    {
        osGalaScore = (int)netPack.PointTotal;
        osGalaAwardState = (int)netPack.PointAward;
        OnOSGalaDataChangeEvent?.Invoke();
        UpdateGalaRedpoint();
    }
    public bool IsOpenedOSGala()
    public bool IsOpenedOSGala(bool needLastDay = true)
    {
        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.OSGala))
        {
            return false;
        }
        //结束后延迟一天关闭展示
        return TimeUtility.OpenDay <= osGalaOpenDays;
        if (needLastDay)
        {
            //结束后延迟一天关闭展示
            return TimeUtility.OpenDay <= osGalaOpenDays;
        }
        else
        {
            return TimeUtility.OpenDay < osGalaOpenDays;
        }
    }
    // 是否已领取奖励
    public bool IsGotAward(int index)
    {
        return (osGalaAwardState & (1 << index)) != 0;
    }
    // 是否可领取奖励
    public bool CanGetAward(int index, int score)
    {
        if (IsGotAward(index))
        {
            return false;
        }
        if (osGalaScore < score)
        {
            return false;
        }
        return true;
    }
    void ParseOSGalaConfig()
    {
        var config = FuncConfigConfig.Get("OSACelebration");
        osGalaOpenDays = int.Parse(config.Numerical1);
        osGalaScoreAwards = ConfigParse.ParseIntArray2Dict(config.Numerical2);
        config = FuncConfigConfig.Get("Achievement");
        typeToGuideID = ConfigParse.ParseIntDict(config.Numerical1);
        var list = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSGalaChange];
        for (int i = 0; i < list.Count; i++)
        {
            var item = list[i];
            osGalaChangeSortList.Add(item.shopId);
        }
        var _list1 = StoreModel.Instance.storeTypeDict[(int)StoreFunc.OSGalaGift];
        var _list2 = RechargeManager.Instance.GetCTGIDListByType(19);
        for (int i = 0; i < _list1.Count; i++)
        {
            var item = _list1[i];
            osGalaGiftSortList.Add(item.shopId);
        }
        for (int i = 0; i < _list2.Count; i++)
        {
            osGalaGiftSortList.Add(_list2[i] + 100000000);
        }
    }
    public void RefreshOSGalaGiftSortList()
    {
        osGalaGiftSortList.Sort(CmpGift);
    }
    public void RefreshOSGalaChangeSortList()
    {
        osGalaGiftSortList.Sort(CmpGift);
    }
    void UpdateGalaRedpoint()
    {
        osGalaRedpoint4.state = RedPointState.None;
        var keys = osGalaScoreAwards.Keys.ToList();
        keys.Sort();
        for (int i = 0; i < keys.Count; i++)
        {
            var score = keys[i];
            if (CanGetAward(i, score))
            {
                osGalaRedpoint4.state = RedPointState.Simple;
                return;
            }
        }
    }
    #endregion
}