51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using Bright.Serialization;
|
|
using Config;
|
|
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// 鲁班配置表管理器
|
|
/// </summary>
|
|
public class ConfigManager:SingletonManager<ConfigManager>
|
|
{
|
|
/// <summary>
|
|
/// 表数据
|
|
/// </summary>
|
|
private Tables tables;
|
|
|
|
public Tables Tables
|
|
{
|
|
get
|
|
{
|
|
if(tables==null)
|
|
{
|
|
Init();
|
|
}
|
|
return tables;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载配置
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
var tablesCtor = typeof(Tables).GetConstructors()[0];
|
|
|
|
System.Delegate loader = new System.Func<string, ByteBuf>((file) =>
|
|
{
|
|
TextAsset text = Resources.Load<TextAsset>(file);
|
|
byte[] ret = text.bytes;
|
|
return new ByteBuf(ret);
|
|
});
|
|
tables = (Tables)tablesCtor.Invoke(new object[] { loader });
|
|
}
|
|
|
|
/// <summary>
|
|
/// 得到车大小类型
|
|
/// </summary>
|
|
public E_CarSizeType GetE_CarSizeType(string carID)
|
|
{
|
|
return (E_CarSizeType)System.Enum.Parse(typeof(E_CarSizeType), tables.TbSkinCarConfig.Get(carID).SizeType);
|
|
}
|
|
}
|