using UnityEngine; using System.Collections.Generic; public partial class ModelResConfig : IConfigPostProcess { private static readonly Dictionary suitDict = new Dictionary(); private static readonly Dictionary petDict = new Dictionary(); private static readonly Dictionary horseDict = new Dictionary(); private static readonly Dictionary> effectBoneDict = new Dictionary>(); private static readonly Dictionary> effectEffectDict = new Dictionary>(); 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) { 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(); var _effectList = new List(); 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 GetBoneList(string name) { if (effectBoneDict.ContainsKey(name)) { return effectBoneDict[name]; } return null; } public static List 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; } }