NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/GenCode/Luban/DataTable/SystemCfg.cs

61 lines
1.9 KiB
C#
Raw Normal View History

2023-12-21 20:00:58 +08:00
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
using SimpleJSON;
2023-12-21 20:00:58 +08:00
2023-12-21 20:00:58 +08:00
namespace cfg
{
public partial class SystemCfg
{
private readonly System.Collections.Generic.Dictionary<ESystemType, DataSystemCfg> _dataMap;
private readonly System.Collections.Generic.List<DataSystemCfg> _dataList;
2023-12-21 20:00:58 +08:00
public SystemCfg(JSONNode _buf)
2023-12-21 20:00:58 +08:00
{
_dataMap = new System.Collections.Generic.Dictionary<ESystemType, DataSystemCfg>();
_dataList = new System.Collections.Generic.List<DataSystemCfg>();
2023-12-21 20:00:58 +08:00
foreach(JSONNode _ele in _buf.Children)
2023-12-21 20:00:58 +08:00
{
DataSystemCfg _v;
{ if(!_ele.IsObject) { throw new SerializationException(); } _v = global::cfg.DataSystemCfg.DeserializeDataSystemCfg(_ele); }
2023-12-21 20:00:58 +08:00
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
}
public System.Collections.Generic.Dictionary<ESystemType, DataSystemCfg> DataMap => _dataMap;
public System.Collections.Generic.List<DataSystemCfg> DataList => _dataList;
2023-12-21 20:00:58 +08:00
public DataSystemCfg GetOrDefault(ESystemType key) => _dataMap.TryGetValue(key, out var v) ? v : null;
2025-03-31 19:09:43 +08:00
public DataSystemCfg Get(ESystemType key) {
if (_dataMap.TryGetValue(key, out var v)) {
return v;
} else {
UnityEngine.Debug.LogError($"table key not found: {key}");
return null;
}
}
2023-12-21 20:00:58 +08:00
public DataSystemCfg this[ESystemType key] => _dataMap[key];
public void ResolveRef(Tables tables)
2023-12-21 20:00:58 +08:00
{
foreach(var _v in _dataList)
2023-12-21 20:00:58 +08:00
{
_v.ResolveRef(tables);
2023-12-21 20:00:58 +08:00
}
}
}
}