少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
using UnityEngine;
using System.Collections.Generic;
 
 
public partial class ModelResConfig : 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
         || Type == (int)E_ModelResType.Weapon
         || Type == (int)E_ModelResType.Secondary
         || Type == (int)E_ModelResType.Suit
         || Type == (int)E_ModelResType.Spirit)
        {
            if (!string.IsNullOrEmpty(EffFileName))
            {
                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 && !string.IsNullOrEmpty(_bones[i]))
                    {
                        _boneList.Add(_bones[i]);
                    }
                    else
                    {
                        _boneList.Add("null");
                    }
                    _effectList.Add(int.Parse(_effects[i]));
 
                    // if (Type == (int)E_ModelResType.Weapon)
                    // {
                    //     Debug.LogFormat("设置了啊   : {0} => {1}", _bones[i], _effects[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;
    }
 
    public static int GetHandByClothesID(int id)
    {
        if (id <= 0)
        {
            id = 4100;// Ĭ��ֵ
        }
 
        var _config = ModelResConfig.Get(id);
        if (_config == null)
        {
            return 7000;// Ĭ��ֵ
        }
 
        return _config.RelatedPartID;
    }
}