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
|
|
|
|
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 宝石数据
|
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;
|
}
|
|
}
|
|