少年修仙传客户端代码仓库
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
using UnityEngine;
using System.Collections.Generic;
 
namespace TableConfig
{
    public partial class ModelResConfig : ConfigBase, IConfigPostProcess
    {
        private static readonly Dictionary<string, ModelResConfig> suitDict = new Dictionary<string, ModelResConfig>();
        private static readonly Dictionary<string, ModelResConfig> petDict = new Dictionary<string, ModelResConfig>();
        private static readonly Dictionary<string, ModelResConfig> horseDict = new Dictionary<string, ModelResConfig>();
        private static readonly Dictionary<string, List<string>> effectBoneDict = new Dictionary<string, List<string>>();
        private static readonly Dictionary<string, List<int>> effectEffectDict = new Dictionary<string, List<int>>();
 
        public void OnConfigParseCompleted()
        {
            if (Type == (int)E_ModelResType.Suit)
            {
                string _name = ResourcesName;
                int _index = _name.IndexOf('/');
                if (_index != -1)
                {
                    _name = _name.Substring(_index + 1);
                }
                suitDict[_name] = this;
            }
            else if (Type == (int)E_ModelResType.Horse)
            {
                horseDict[ResourcesName] = this;
            }
            else if (Type == (int)E_ModelResType.Pet)
            {
                petDict[ResourcesName] = this;
            }
 
            if (Type == (int)E_ModelResType.Horse
             || Type == (int)E_ModelResType.Pet)
            {
                if (!string.IsNullOrEmpty(boneNameList))
                {
                    var _bones = boneNameList.Split('|');
                    var _effects = EffFileName.Split('|');
 
                    if (_bones.Length != _effects.Length)
                    {
                        Debug.LogWarningFormat("{0} °ó¶¨¹Ç÷ÀµÄÊýÁ¿ºÍÌØÐ§µÄÊýÁ¿ÎÞ·¨¶ÔÓ¦ {1} != {2}", ID, _bones.Length, _effects.Length);
                    }
 
                    var _boneList = new List<string>();
                    var _effectList = new List<int>();
 
                    for (int i = 0; i < _effects.Length; ++i)
                    {
                        if (i < _bones.Length)
                        {
                            _boneList.Add(_bones[i]);
                        }
                        else
                        {
                            _boneList.Add("null");
                        }
                        _effectList.Add(int.Parse(_effects[i]));
 
                        // Debug.LogFormat("ÉèÖÃÌØÐ§ÅäÖÃ: {0} => {1}", _bones[i], _dict[_bones[i]]);
                    }
 
                    effectBoneDict[ResourcesName] = _boneList;
                    effectEffectDict[ResourcesName] = _effectList;
                }
            }
        }
 
        public static List<string> GetBoneList(string name)
        {
            if (effectBoneDict.ContainsKey(name))
            {
                return effectBoneDict[name];
            }
            return null;
        }
 
        public static List<int> GetEffectList(string name)
        {
            if (effectEffectDict.ContainsKey(name))
            {
                return effectEffectDict[name];
            }
            return null;
        }
 
        public static ModelResConfig GetClothesConfig(string name)
        {
            if (suitDict.ContainsKey(name))
            {
                return suitDict[name];
            }
            return null;
        }
 
        public static ModelResConfig GetHorseConfig(string name)
        {
            if (horseDict.ContainsKey(name))
            {
                return horseDict[name];
            }
            return null;
        }
 
        public static ModelResConfig GetPetConfig(string name)
        {
            if (petDict.ContainsKey(name))
            {
                return petDict[name];
            }
            return null;
        }
    }
}