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;
|
}
|
}
|