yyl
2026-03-26 f4a702e212d1853735f8dae399da69d23bfa510e
Main/System/HappyXB/HappyXBModel.cs
@@ -19,11 +19,11 @@
    {
        get
        {
            #if UNITY_EDITOR
#if UNITY_EDITOR
            if (Time.time - xbLastTime > 1)
            #else
#else
            if (Time.time - xbLastTime > 10)
            #endif
#endif
            {
                m_IsWaitServerXB = false;
                return m_IsWaitServerXB;
@@ -37,7 +37,7 @@
            m_IsWaitServerXB = value;
            xbLastTime = Time.time;
        }
    }
    }
    private Dictionary<int, XBTypeInfo> xbTypeInfoDict = new Dictionary<int, XBTypeInfo>(); //抽奖状态相关的 服务器记录
    public int lhQuality;
@@ -134,6 +134,8 @@
    public int addXBScore { get; private set; }
    public int addXBScoreType { get; private set; } //寻宝积分货币类型
    public int addXBLuckValue { get; private set; }
    public int addXBAddItemID { get; private set; } // 本次寻宝额外赠送的物品ID
    public long addXBItemCount { get; private set; }   // 本次寻宝额外赠送的物品ID个数
    public Dictionary<int, XBGetItem> xbResultDict { get; private set; } = new Dictionary<int, XBGetItem>(); //奖品顺序:奖品
    public void GetServerXBResult(HA350_tagMCTreasureResult result)
    {
@@ -142,6 +144,8 @@
        addXBScore = result.AddMoneyValue;
        addXBScoreType = result.AddMoneyType;
        addXBLuckValue = result.AddTreasureLuck;
        addXBAddItemID = (int)result.AddItemID;
        addXBItemCount = result.AddItemCount;
        JsonData resultData = JsonMapper.ToObject(result.TreasureResult);
        if (resultData.IsArray)
        {
@@ -180,11 +184,19 @@
                UIManager.Instance.OpenWindowAsync<HeroCallResultWin>().Forget();
            }
        }
        if (ActHeroAppearConfig.GetActTreasureTypeList().Contains(type))
        {
            if (!UIManager.Instance.IsOpened<HeroDebutCallResultWin>())
            {
                UIManager.Instance.OpenWindow<HeroDebutCallResultWin>();
            }
        }
    }
    public int GetCountInResult(int itemID)
    {
    {
        int count = 0;
        if (xbResultDict != null && xbResultDict.Count > 0)
        {
@@ -205,7 +217,7 @@
        xbResultDict.Clear();
    }
    public void GetServerXBInfo(HA351_tagMCTreasureInfo info)
    {
        for (int i = 0; i < info.InfoCount; i++)
@@ -218,6 +230,7 @@
                typeInfo.freeCountToday = info.TreasuerInfoList[i].FreeCountToday;
                typeInfo.treasureCount = (int)info.TreasuerInfoList[i].TreasureCount;
                typeInfo.treasureCountToday = (int)info.TreasuerInfoList[i].TreasureCountToday;
                typeInfo.treasureCountTodayGold = (int)info.TreasuerInfoList[i].TreasureCountTodayGold;
                typeInfo.treasureCntAward = (int)info.TreasuerInfoList[i].TreasureCntAward;
                if (typeInfo.gridLimitCntDict == null)
                    typeInfo.gridLimitCntDict = new Dictionary<int, int>();
@@ -256,6 +269,7 @@
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].freeCountToday = info.TreasuerInfoList[i].FreeCountToday;
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCount = (int)info.TreasuerInfoList[i].TreasureCount;
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCountToday = (int)info.TreasuerInfoList[i].TreasureCountToday;
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCountTodayGold = (int)info.TreasuerInfoList[i].TreasureCountTodayGold;
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].treasureCntAward = (int)info.TreasuerInfoList[i].TreasureCntAward;
                if (xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict == null)
                    xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict = new Dictionary<int, int>();
@@ -265,7 +279,7 @@
                    int cnt = info.TreasuerInfoList[i].GridLimitCntList[j].GridCnt;
                    xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].gridLimitCntDict[num] = cnt;
                }
                xbTypeInfoDict[info.TreasuerInfoList[i].TreasureType].wishCntDict.Clear();
                for (int j = 0; j < info.TreasuerInfoList[i].WishLibCnt; j++)
                {
@@ -313,7 +327,7 @@
    public void SendXBQuest(int type, int index, int costType)
    {
        if (isXBCoolTime) return;
        isXBCoolTime = true;
        CA568_tagCMRequestTreasure treasure = new CA568_tagCMRequestTreasure();
        treasure.TreasureType = (byte)type;
@@ -326,7 +340,19 @@
        }
    }
    public bool CheckIsEmptyGrid(int[] checkPackList, int needGrid = 1)
    {
        if (checkPackList.IsNullOrEmpty())
            return true;
        for (int i = 0; i < checkPackList.Length; i++)
        {
            if (!CheckIsEmptyGrid((PackType)checkPackList[i], needGrid))
            {
                return false;
            }
        }
        return true;
    }
    public bool CheckIsEmptyGrid(PackType type, int needGrid = 1)
    {
@@ -369,7 +395,7 @@
        }
        var funcSet = TreasureSetConfig.Get(xbType);
        if (CheckIsEmptyGrid((PackType)config.PackType))
        if (CheckIsEmptyGrid(config.CheckPackList))
        {
            //道具寻宝
            if (funcSet.CostItemID != 0 && IsHaveOneXBTool(xbType))
@@ -424,7 +450,7 @@
        }
        var funcSet = TreasureSetConfig.Get(xbType);
        if (CheckIsEmptyGrid((PackType)config.PackType, 10))
        if (CheckIsEmptyGrid(config.CheckPackList, 10))
        {
            int toolCnt = 0;
            int needToolCnt = 0;
@@ -494,7 +520,7 @@
        {
            return typeInfo.freeCountToday;
        }
        return 0;
    }
@@ -508,7 +534,7 @@
    {
        qualityList = new List<int>();
        //无配置写死
        //无配置写死品质
        if (type == (int)HappXBTitle.Gubao)
        {
            qualityList.Add(3);
@@ -525,10 +551,15 @@
        var xbConfig = GetXBItemConfigByType(type);
        var luckList = xbConfig.LuckyItemRateInfo.Keys.ToList();
        luckList.Sort();
        //按阶梯显示
        for (int i = 0; i < luckList.Count; i++)
        {
            if (typeInfo.luckValue < luckList[i])
            //开特权卡之后才有幸运奖励
            var luckyValue = typeInfo.luckValue;
            if (type == (int)HappXBTitle.HeroCallAdvanced && !InvestModel.Instance.IsInvested(InvestModel.foreverCardType))
            {
                luckyValue = 0;
            }
            if (luckyValue < luckList[i])
            {
                if (type == (int)HappXBTitle.HeroCallAdvanced)
                {
@@ -536,7 +567,7 @@
                    qualityList = xbConfig.LuckyItemRateInfo[luckList[i]].Select(x => x[1]).ToList();
                    qualityList.Sort();
                }
                return luckList[i] - typeInfo.luckValue;
                return luckList[i] - luckyValue;
            }
        }
        return 0;
@@ -596,12 +627,12 @@
                needMoney = funcSet.CostMoneyList[0] * (needToolCnt - toolCnt);
            }
            else
            {
            {
                //全部不足的按多次价格算 可能配置了折扣
                needMoney = funcSet.CostMoneyList[1];
            }
        }
        return false;
    }
@@ -613,7 +644,7 @@
    }
    public int GetCostItemID(int type)
    {
    {
        var funcSet = TreasureSetConfig.Get(type);
        if (funcSet == null) return 0;
        return funcSet.CostItemID;
@@ -632,7 +663,7 @@
    public Redpoint bestXB10Red = new Redpoint(HappyXB_RedKey, XBHeroCall10_RedKey);
    public Redpoint bestXBScoreRed = new Redpoint(HappyXB_RedKey, XBHeroCallScore_RedKey);
    private void UpdateFuncState(int funcId)
    {
@@ -656,7 +687,7 @@
            return;
        }
    }
    void OnDayEvent()
@@ -683,12 +714,12 @@
        if (IsHaveFreeXB((int)HappXBTitle.HeroCallAdvanced))
        {
            bestXBFreeRed.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ?RedPointState.GetReward : RedPointState.Simple;
            bestXBFreeRed.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ? RedPointState.GetReward : RedPointState.Simple;
        }
        if (IsHaveManyXBToolEx((int)HappXBTitle.HeroCallAdvanced, out int xbtoolCnt, out int needtoolCnt, out int needMoney))
        {
            bestXB10Red.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ?RedPointState.GetReward : RedPointState.Simple;
            bestXB10Red.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ? RedPointState.GetReward : RedPointState.Simple;
            return;
        }
@@ -696,8 +727,8 @@
        if ((InvestModel.Instance.IsInvested(InvestModel.monthCardType)
        || GetXBInfoByType((int)HappXBTitle.HeroCallScore)?.treasureCount == 0)
        && UIHelper.GetMoneyCnt(51) >= TreasureSetConfig.Get((int)HappXBTitle.HeroCallScore).CostMoneyList[0])
        {
            bestXBScoreRed.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ?RedPointState.GetReward : RedPointState.Simple;
        {
            bestXBScoreRed.state = PlayerDatas.Instance.baseData.realmLevel >= 1 ? RedPointState.GetReward : RedPointState.Simple;
        }
    }
@@ -713,7 +744,7 @@
        return itemIDListTemp.Distinct().ToList();
    }
    #endregion
}
@@ -724,6 +755,7 @@
    public int freeCountToday;      //今日已免费寻宝次数
    public int treasureCount;        //已寻宝总次数
    public int treasureCountToday;        //今日已寻宝总次数
    public int treasureCountTodayGold;  //今日消耗货币已寻宝总次数
    public int treasureCntAward;        //累计寻宝次数对应奖励领奖状态,按奖励记录索引二进制记录是否已领取
    public Dictionary<int, int> gridLimitCntDict;        //<有限制抽取次数的格子编号,已抽到次数> 有限制抽取次数的格子次数信息
    public Dictionary<int, XBWishInfo> wishCntDict;        //心愿抽取情况 <LIBID:已抽到次数,是否勾选自动,当前心愿ID>