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

61 lines
1.8 KiB
C#
Raw Normal View History

2023-08-22 19:08:45 +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-08-22 19:08:45 +08:00
2023-11-01 15:03:24 +08:00
namespace cfg
2023-08-22 19:08:45 +08:00
{
public partial class ConditionConfig
{
private readonly System.Collections.Generic.Dictionary<int, DataCondition> _dataMap;
private readonly System.Collections.Generic.List<DataCondition> _dataList;
2023-08-22 19:08:45 +08:00
public ConditionConfig(JSONNode _buf)
2023-08-22 19:08:45 +08:00
{
_dataMap = new System.Collections.Generic.Dictionary<int, DataCondition>();
_dataList = new System.Collections.Generic.List<DataCondition>();
2023-08-22 19:08:45 +08:00
foreach(JSONNode _ele in _buf.Children)
2023-08-22 19:08:45 +08:00
{
DataCondition _v;
{ if(!_ele.IsObject) { throw new SerializationException(); } _v = global::cfg.DataCondition.DeserializeDataCondition(_ele); }
2023-08-22 19:08:45 +08:00
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
}
public System.Collections.Generic.Dictionary<int, DataCondition> DataMap => _dataMap;
public System.Collections.Generic.List<DataCondition> DataList => _dataList;
2023-08-22 19:08:45 +08:00
2023-11-01 15:03:24 +08:00
public DataCondition GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
2025-03-31 19:09:43 +08:00
public DataCondition Get(int key) {
if (_dataMap.TryGetValue(key, out var v)) {
return v;
} else {
UnityEngine.Debug.LogError($"table key not found: {key}");
return null;
}
}
2023-11-01 15:03:24 +08:00
public DataCondition this[int key] => _dataMap[key];
2023-08-22 19:08:45 +08:00
public void ResolveRef(Tables tables)
2023-08-22 19:08:45 +08:00
{
foreach(var _v in _dataList)
2023-08-22 19:08:45 +08:00
{
_v.ResolveRef(tables);
2023-08-22 19:08:45 +08:00
}
}
}
}