少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
 
 
public partial class FuncConfigConfig : IConfigPostProcess
{
    #region 宝石数据
    private const string GEM_TYPE1 = "GemType1";
    private const string GEM_TYPE2 = "GemType2";
    private static Dictionary<int, FuncConfigConfig> m_GemCfgs = new Dictionary<int, FuncConfigConfig>();
    #endregion
 
    #region 符印数据
    private static Regex RuneAttrRegex = new Regex(@"RuneAttr([0-9]+)", RegexOptions.Singleline);
    public static Dictionary<int, FuncConfigConfig> m_RuneAttrCfgs = new Dictionary<int, FuncConfigConfig>();
    #endregion
 
    #region 快捷回复
    private static Regex FastReplayRegex = new Regex(@"QuickReply([0-9]+)", RegexOptions.Singleline);
    private static List<FuncConfigConfig> fastReplay = new List<FuncConfigConfig>();
    #endregion
 
    #region 装备名称
    private static Dictionary<int, string> _equipAreaDict = new Dictionary<int, string>();
    #endregion
 
 
    #region 装备弹框名称
    private static Dictionary<int, string> _equipTipsAreaDict = new Dictionary<int, string>();
    #endregion
 
    public void OnConfigParseCompleted()
    {
        #region 宝石数据、符印数据、聊天快捷回复
        if (KEY == GEM_TYPE1 || KEY == GEM_TYPE2)
        {
            string[] strs = Numerical1.Split('|');
            for (int i = 0; i < strs.Length; i++)
            {
                int pos = int.Parse(strs[i]);
                if (!m_GemCfgs.ContainsKey(pos))
                {
                    m_GemCfgs.Add(pos, this);
                }
                else
                {
                    DebugEx.LogError("重复的装备位置ID:" + pos);
                }
            }
        }
        else if (RuneAttrRegex.IsMatch(KEY))
        {
            Match match = RuneAttrRegex.Match(KEY);
            int attrType = int.Parse(match.Groups[1].Value);
            m_RuneAttrCfgs.Add(attrType, this);
        }
        else if (FastReplayRegex.IsMatch(KEY))
        {
            fastReplay.Add(this);
        }
        #endregion
 
        #region 得到装备位和对应名称
        if (KEY == "EquipArea")
        {
            int[] arealist = ConfigParse.GetMultipleStr<int>(Numerical1);
            string[] namelist = ConfigParse.GetMultipleStr(Numerical2);
            for (int i = 0; i < arealist.Length; i++)
            {
                _equipAreaDict.Add(arealist[i], namelist[i]);
            }
        }
 
        #endregion
 
        #region 得到装备位和对应装备弹框名称
        if (KEY== "EquipWinArea")
        {
            int[] arealist = ConfigParse.GetMultipleStr<int>(Numerical1);
            string[] namelist = ConfigParse.GetMultipleStr(Numerical2);
            for (int i = 0; i < arealist.Length; i++)
            {
                _equipTipsAreaDict.Add(arealist[i], namelist[i]);
            }
        }
 
        #endregion
    }
 
    #region 宝石数据
    public static int GetGemTypeByEquipPos(int pos, out FuncConfigConfig cfg)
    {
        m_GemCfgs.TryGetValue(pos, out cfg);
        if (cfg != null)
        {
            string typeStr = System.Text.RegularExpressions.Regex.Replace(cfg.KEY, @"[^\d.\d]", "");
            int type = -1;
            if (int.TryParse(typeStr, out type))
            {
                return type;
            }
        }
        return -1;
    }
 
    public static int GetGemTypeByEquipPos(int pos)
    {
        FuncConfigConfig cfg = null;
        m_GemCfgs.TryGetValue(pos, out cfg);
        if (cfg != null)
        {
            string typeStr = System.Text.RegularExpressions.Regex.Replace(cfg.KEY, @"[^\d.\d]", "");
            int type = -1;
            if (int.TryParse(typeStr, out type))
            {
                return type;
            }
        }
        DebugEx.LogError("未找到的装备位置:" + pos);
        return -1;
    }
    #endregion
 
    public static FuncConfigConfig GetRuneAttrFormula(int attrType)
    {
        FuncConfigConfig cfg = null;
        m_RuneAttrCfgs.TryGetValue(attrType, out cfg);
        return cfg;
    }
 
    public static FuncConfigConfig GetRuneNeedExpFormula()
    {
        return FuncConfigConfig.Get("RuneExp");
    }
 
    public static List<FuncConfigConfig> GetFastReplay()
    {
        return fastReplay;
    }
 
    public static string GetEquipAreaName(int equipArea)
    {
        if (_equipAreaDict.ContainsKey(equipArea))
        {
            return _equipAreaDict[equipArea];
        }
        else
        {
            return "";
        }
    }
 
    public static string GetEquipTipsAreaName(int equipArea)
    {
        if (_equipTipsAreaDict.ContainsKey(equipArea))
        {
            return _equipTipsAreaDict[equipArea];
        }
        else
        {
            return "";
        }
    }
}