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