少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-14 7a606044e748707b10da259a84009cf38d93275b
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
using System.Collections.Generic;
using System.Text;
 
public partial class SkillConfig : IConfigPostProcess
{
    /// <summary>
    /// 根据职业以及技能类型存储技能
    /// </summary>
    private static Dictionary<int, Dictionary<int, Dictionary<int, List<SkillConfig>>>> m_Skills = new Dictionary<int, Dictionary<int, Dictionary<int, List<SkillConfig>>>>();
 
    public void OnConfigParseCompleted()
    {
        #region 根据职业以及技能类型以及技能等级
        Dictionary<int, Dictionary<int, List<SkillConfig>>> funcDic = null;
        Dictionary<int, List<SkillConfig>> typeDic = null;
        List<SkillConfig> lvlist = null;
        m_Skills.TryGetValue(UseType, out funcDic);
        if (funcDic != null)
        {
            funcDic.TryGetValue(FuncType, out typeDic);
            if (typeDic != null)
            {
                typeDic.TryGetValue(SkillTypeID, out lvlist);
                if (lvlist != null)
                {
                    lvlist.Add(this);
                }
                else
                {
                    lvlist = new List<SkillConfig>();
                    lvlist.Add(this);
                    typeDic.Add(SkillTypeID, lvlist);
                }
            }
            else
            {
                typeDic = new Dictionary<int, List<SkillConfig>>();
                lvlist = new List<SkillConfig>();
                lvlist.Add(this);
                typeDic.Add(SkillTypeID, lvlist);
                funcDic.Add(FuncType, typeDic);
            }
        }
        else
        {
            funcDic = new Dictionary<int, Dictionary<int, List<SkillConfig>>>();
            typeDic = new Dictionary<int, List<SkillConfig>>();
            lvlist = new List<SkillConfig>();
            lvlist.Add(this);
            typeDic.Add(SkillTypeID, lvlist);
            funcDic.Add(FuncType, typeDic);
            m_Skills.Add(UseType, funcDic);
        }
        #endregion
        #region 坐骑技能获取
        _textBuilder.Length = 0;
        if (FuncType == 5)
        {
            _textBuilder.Append(SkillTypeID);
            _textBuilder.Append(SkillLV);
            T_HorseSkill.Add(_textBuilder.ToString(), this);
        }
 
        #endregion
    }
 
    //--坐骑技能获取
    private static StringBuilder _textBuilder = new StringBuilder();
    public static Dictionary<string, SkillConfig> T_HorseSkill = new Dictionary<string, SkillConfig>();
 
    /// <summary>
    /// 根据职业类型以及技能类型获取技能
    /// </summary>
    /// <param name="occupy"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    public static Dictionary<int, List<SkillConfig>> GetSkillWithOccpyAndType(int occupy, int type)
    {
        Dictionary<int, Dictionary<int, List<SkillConfig>>> dic = null;
        Dictionary<int, List<SkillConfig>> typeDic = null;
        m_Skills.TryGetValue(occupy, out dic);
        if (dic != null)
        {
            dic.TryGetValue(type, out typeDic);
        }
        return typeDic;
    }
 
    public static List<SkillConfig> GetSkillActConfigs(int occupy, int type, int _typeId)
    {
        List<SkillConfig> _list = null;
        Dictionary<int, List<SkillConfig>> _dict = GetSkillWithOccpyAndType(occupy, type);
        if (_dict != null)
        {
            _dict.TryGetValue(_typeId, out _list);
        }
        return _list;
    }
 
    public static Dictionary<int, Dictionary<int, List<SkillConfig>>> GetSkillActive(int occupy)
    {
        Dictionary<int, Dictionary<int, List<SkillConfig>>> dic = null;
        m_Skills.TryGetValue(occupy, out dic);
        return dic;
    }
 
    //------坐骑技能获取
    public static SkillConfig GetSkillTypeIDAndSkillLV(int _SkillTypeID, int SkillLV)
    {
        _textBuilder.Length = 0;
        _textBuilder.Append(_SkillTypeID.ToString() + SkillLV.ToString());
        SkillConfig _tagChinSkillModel = null;
        T_HorseSkill.TryGetValue(_textBuilder.ToString(), out _tagChinSkillModel);
        return _tagChinSkillModel;
    }
 
    public static int FindSkillByJob(int[] skillIds, int job)
    {
        foreach (var skill in skillIds)
        {
            var config = SkillConfig.Get(skill);
            if (config != null && (config.UseType == 0 || config.UseType == 1 << job))
            {
                return skill;
            }
        }
 
        return 0;
    }
 
}