(client) feat:实现身体贴图加载
This commit is contained in:
@ -14,9 +14,11 @@ namespace Managers
|
||||
public class DefineManager : Singleton<DefineManager>
|
||||
{
|
||||
private static readonly string[] dataSetFilePath = { "Data", "Mods" };
|
||||
|
||||
//类别,定义名,定义
|
||||
public Dictionary<string, Dictionary<string, Define>> defines = new();
|
||||
//包id,包
|
||||
public Dictionary<string, DefinePack> packs = new();
|
||||
//类别,定义
|
||||
public Dictionary<string, List<Define>> anonymousDefines = new();
|
||||
/// <summary>
|
||||
/// 初始化定义管理器,加载所有定义包并构建定义字典。
|
||||
@ -46,12 +48,14 @@ namespace Managers
|
||||
Dictionary<Type, FieldInfo[]> fieldCache = new();
|
||||
// 需要链接的定义、需要链接的字段、链接信息
|
||||
List<Tuple<Define, FieldInfo, Define>> defineCache = new();
|
||||
|
||||
string currentPackID = string.Empty;
|
||||
|
||||
void ProcessDefine(Define def)
|
||||
{
|
||||
if (def == null || def.isReferene)
|
||||
return;
|
||||
|
||||
def.packID = currentPackID;
|
||||
// 如果字段信息已经缓存,则直接使用缓存
|
||||
if (!fieldCache.TryGetValue(def.GetType(), out var defineFields))
|
||||
{
|
||||
@ -89,11 +93,12 @@ namespace Managers
|
||||
|
||||
foreach (var pack in packs)
|
||||
{
|
||||
currentPackID = pack.Value.packID;
|
||||
foreach (var (typeName, defList) in pack.Value.defines)
|
||||
{
|
||||
if (!defines.ContainsKey(typeName))
|
||||
defines[typeName] = new Dictionary<string, Define>();
|
||||
|
||||
|
||||
foreach (var def in defList)
|
||||
{
|
||||
defines[typeName][def.defName] = def;
|
||||
|
Reference in New Issue
Block a user