hch
2026-01-09 2928991be15d7d8ce8290fab40b40fb5ae7711f9
266 【内政】古宝系统
4个文件已修改
84 ■■■■■ 已修改文件
Main/System/Gubao/GubaoListWin.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Gubao/GubaoManager.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Main/FightPowerManager.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Utility/CommonFunc.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Gubao/GubaoListWin.cs
@@ -31,7 +31,7 @@
        });
        seeAttrBtn.AddListener(() =>
        {
            AttributeManager.Instance.OpenTotalAttributeWin(BeautyMMManager.Instance.allMMTalentAttr);
            AttributeManager.Instance.OpenTotalAttributeWin(GubaoManager.Instance.gubaoAllAttrDict);
        });
    }
Main/System/Gubao/GubaoManager.cs
@@ -10,6 +10,8 @@
{
    //古宝ID:[星级,等级, 特殊层]
    Dictionary<int, GubaoInfo> gubaoDict = new Dictionary<int, GubaoInfo>();
    public  Dictionary<int, long> gubaoAllAttrDict = new Dictionary<int, long>();
    public event Action UpdateGubaoEvent;
    public int waitActiveGubao;
    public int selectGubao; //从藏宝阁选中
@@ -68,6 +70,7 @@
    {
        gubaoDict.Clear();
        waitActiveGubao = 0;
        gubaoCollectDict.Clear();
    }
    void OnPlayerLoginOK()
@@ -122,6 +125,7 @@
            waitActiveGubao = 0;
        }
        UpdateRedpoint();
        RefreshAllAttr();
    }
@@ -619,6 +623,65 @@
        return cnt;
    }
    void RefreshAllAttr()
    {
        gubaoAllAttrDict.Clear();
        if (gubaoDict.IsNullOrEmpty())
        {
            return;
        }
        //各个古宝相加
        foreach (var gubaoID in gubaoDict.Keys)
        {
            CommonFunc.AddDictEx(gubaoAllAttrDict, GetBaseAttrByGBID(gubaoID));
            CommonFunc.AddDictEx(gubaoAllAttrDict, GetSpecialAttrByGBID(gubaoID));
        }
        //加上套装
        var keys = GubaoResonanceConfig.GetKeys();
        foreach (var suitID in keys)
        {
            var curSuiteStar = GetSuiteStar(suitID);
            if (curSuiteStar == -1)
            {
                continue;
            }
            var attrCfg = GubaoResonanceAttrConfig.GetConfig(suitID, curSuiteStar);
            if (attrCfg == null)
            {
                continue;
            }
            if (gubaoAllAttrDict.ContainsKey(attrCfg.ResonanceAttrIDList[0]))
            {
                gubaoAllAttrDict[attrCfg.ResonanceAttrIDList[0]] += attrCfg.ResonanceAttrValueList[0];
            }
            else
            {
                gubaoAllAttrDict[attrCfg.ResonanceAttrIDList[0]] = attrCfg.ResonanceAttrValueList[0];
            }
        }
    }
    public long GetAttrValue(int attrID)
    {
        gubaoAllAttrDict.TryGetValue(attrID, out long value);
        return value;
    }
    public int GetAttrPer(int attrID)
    {
        if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrID))
        {
            var pertype = PlayerPropertyConfig.baseAttr2perDict[attrID];
            gubaoAllAttrDict.TryGetValue(pertype, out long value);
            return (int)(value);
        }
        return 0;
    }
    #endregion
    #region 鉴宝
Main/System/Main/FightPowerManager.cs
@@ -170,6 +170,7 @@
#if UNITY_EDITOR
        FightPowerDebug("战力:等级属性 " + JsonMapper.ToJson(lvAttrs));
        FightPowerDebug("战力:红颜属性 " + JsonMapper.ToJson(BeautyMMManager.Instance.allMMTalentAttr));
        FightPowerDebug("战力:古宝属性 " + JsonMapper.ToJson(GubaoManager.Instance.gubaoAllAttrDict));
#endif
    }
@@ -319,8 +320,8 @@
        propertyVariables[REALM_VALUE] = officialAttrs.ContainsKey(attrType) ? officialAttrs[attrType] : 0;
        propertyVariables[REALM_PER] = GetOfficialPer(attrType) / 10000.0f;
        // propertyVariables[BOOK_PER] = GetBookPer(attrType) / 10000.0f;
        propertyVariables[GUBAO_VALUE] = 0;
        propertyVariables[GUBAO_PER] = 0;
        propertyVariables[GUBAO_VALUE] = GubaoManager.Instance.GetAttrValue(attrType);
        propertyVariables[GUBAO_PER] = GubaoManager.Instance.GetAttrPer(attrType) / 10000.0f;
        propertyVariables[HJG_VALUE] = PhantasmPavilionManager.Instance.GetAttrValue(attrType);
        propertyVariables[HJG_PER] = PhantasmPavilionManager.Instance.GetAttrPer(attrType) / 10000.0f;
        propertyVariables[HORSE_VALUE] = HorseManager.Instance.GetAttrValue(attrType);
Main/Utility/CommonFunc.cs
@@ -19,7 +19,19 @@
        return resultDic;
    }
    //直接加到第一个里
    public static void AddDictEx(Dictionary<int, long> dic1, Dictionary<int, long> dic2)
    {
        foreach (var data in dic2)
        {
            if (dic1.ContainsKey(data.Key))
            {
                dic1[data.Key] = dic1[data.Key] + data.Value;
                continue;
            }
            dic1[data.Key] = data.Value;
        }
    }
    public static List<Item> ChangeToItemList(Dictionary<int, long> dict)
    {