yyl
2025-10-31 39001a600fcae2bcf27c225df8752d75fb92fef4
Main/Config/PartialConfigs/PlayerPropertyConfig.cs
@@ -5,29 +5,42 @@
public partial class PlayerPropertyConfig : ConfigBase<int, PlayerPropertyConfig>
{
    private static Dictionary<int, List<PlayerPropertyConfig>> m_PropCfgs = new Dictionary<int, List<PlayerPropertyConfig>>();
    private static Dictionary<int, List<int>> outputDict = new Dictionary<int, List<int>>();
    public const int baseType = 1;  //基础属性
    public const int fightType = 2; //战斗属性
    public const int fightAntiType = 3; //战斗抗性
    public const int specialType = 4; //特殊属性
    public static int[] baseAttrs = { 6, 7, 8 };    //攻防血
    protected override void OnConfigParseCompleted()
    // 按显示类型分
    private static Dictionary<int, List<int>> m_PlayerPropertyDict = new Dictionary<int, List<int>>();
    public static Dictionary<int, List<int>> playerPropertyDict
    {
        List<PlayerPropertyConfig> list = null;
        m_PropCfgs.TryGetValue(type, out list);
        if (list != null)
        get
        {
            list.Add(this);
        }
        else
        {
            list = new List<PlayerPropertyConfig>();
            list.Add(this);
            m_PropCfgs.Add(type, list);
            if (m_PlayerPropertyDict.IsNullOrEmpty())
                RefreshShowDict();
            return m_PlayerPropertyDict;
        }
    }
    public static Dictionary<int, List<int>> GetShowDict()
    public static int[] inheritAttrs = new int[] { 13, 14, 15 };
    //不同的功能表调用对应自己的功能含义和使用方式,如阵容光环配置就用在对应计算层
    public static int[] basePerAttrs = new int[] { 16, 17, 18 };
    public static int[] baseAttrs = new int[] { 6, 7, 8 };
    // 映射对应的百分比属性,方便使用,如计算属性需要找对应的百分比加成
    public static Dictionary<int, int> baseAttr2perDict = new Dictionary<int, int>()
    {
        if (outputDict.IsNullOrEmpty())
        { 6,16 },
        { 7,17 },
        { 8,18 }
    };
    private static Dictionary<int, List<int>> RefreshShowDict()
    {
        if (m_PlayerPropertyDict.IsNullOrEmpty())
        {
            var keys = GetKeys();
            for (int i = 0; i < keys.Count; i++)
@@ -36,23 +49,21 @@
                int showType = Get(id).showType;
                if (showType == 0)  //为0时不显示
                    continue;
                if (!outputDict.ContainsKey(showType))
                if (!m_PlayerPropertyDict.ContainsKey(showType))
                {
                    outputDict[showType] = new List<int> { id };
                    m_PlayerPropertyDict[showType] = new List<int> { id };
                }
                else
                {
                    outputDict[showType].Add(id);
                    m_PlayerPropertyDict[showType].Add(id);
                }
            }
            var outputList = outputDict.Keys.ToList();
            for (int i = 0; i < outputList.Count; i++)
            foreach (var showType in m_PlayerPropertyDict.Keys)
            {
                int showType = outputList[i];
                outputDict[showType].Sort(cmp);
                m_PlayerPropertyDict[showType].Sort(cmp);
            }
        }
        return outputDict;
        return m_PlayerPropertyDict;
    }
    static int cmp(int id1, int id2)
@@ -63,12 +74,6 @@
        return config1.showSequence.CompareTo(config2.showSequence);
    }
    public static List<PlayerPropertyConfig> GetPropByType(int type)
    {
        List<PlayerPropertyConfig> list = null;
        m_PropCfgs.TryGetValue(type, out list);
        return list;
    }
    public static string GetFullDescription(Int2 property)
@@ -76,7 +81,7 @@
        return GetFullDescription(property.x, property.y);
    }
    public static string GetFullDescription(int id, long value)
    public static string GetFullDescription(int id, long value, string format="{0}+{1}")
    {
        var config = Get(id);
        if (config == null)
@@ -84,26 +89,26 @@
            return string.Empty;
        }
        if (config.Name.Contains("%s"))
        if (config.ShowName.Contains("%s"))
        {
            if (id == 52)
            // if (id == 52)
            // {
            //     return Regex.Replace(config.ShowName, "%s", (value * 0.0001f).ToString("f2"));
            // }
            // else
            {
                return Regex.Replace(config.Name, "%s", (value * 0.0001f).ToString("f2"));
            }
            else
            {
                return Regex.Replace(config.Name, "%s", value.ToString());
                return Regex.Replace(config.ShowName, "%s", value.ToString());
            }
        }
        else
        {
            return string.Format("{0} +{1}", config.Name, GetValueDescription(id, value));
            return string.Format(format, config.ShowName, GetValueDescription(id, value));
        }
    }
    public static string GetValueDescription(int id, long value)
    {
        return GetValueDescription(id, value, false);
        return GetValueDescription(id, value, true);
    }
    public static string GetValueDescription(int id, long value, bool largeValue)