72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
//------------------------------------------------------------------------------
|
|
// <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 Bright.Serialization;
|
|
using System.Collections.Generic;
|
|
using SimpleJSON;
|
|
|
|
|
|
|
|
namespace cfg.CharacterCfg
|
|
{
|
|
|
|
public sealed partial class CharacterAttri
|
|
{
|
|
private readonly Dictionary<int, CharacterCfg.DataCharacterAttri> _dataMap;
|
|
private readonly List<CharacterCfg.DataCharacterAttri> _dataList;
|
|
|
|
public CharacterAttri(JSONNode _json)
|
|
{
|
|
_dataMap = new Dictionary<int, CharacterCfg.DataCharacterAttri>();
|
|
_dataList = new List<CharacterCfg.DataCharacterAttri>();
|
|
|
|
foreach(JSONNode _row in _json.Children)
|
|
{
|
|
var _v = CharacterCfg.DataCharacterAttri.DeserializeDataCharacterAttri(_row);
|
|
_dataList.Add(_v);
|
|
_dataMap.Add(_v.RoleID, _v);
|
|
}
|
|
PostInit();
|
|
}
|
|
|
|
public Dictionary<int, CharacterCfg.DataCharacterAttri> DataMap => _dataMap;
|
|
public List<CharacterCfg.DataCharacterAttri> DataList => _dataList;
|
|
|
|
public CharacterCfg.DataCharacterAttri GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
|
public CharacterCfg.DataCharacterAttri Get(int key) {
|
|
if (_dataMap.TryGetValue(key, out var v)) {
|
|
return v;
|
|
} else {
|
|
UnityEngine.Debug.LogError($"table CharacterAttri key not found: {key}");
|
|
return null;
|
|
}
|
|
}
|
|
public CharacterCfg.DataCharacterAttri this[int key] => _dataMap[key];
|
|
|
|
public void Resolve(Dictionary<string, object> _tables)
|
|
{
|
|
foreach(var v in _dataList)
|
|
{
|
|
v.Resolve(_tables);
|
|
}
|
|
PostResolve();
|
|
}
|
|
|
|
public void TranslateText(System.Func<string, string, string> translator)
|
|
{
|
|
foreach(var v in _dataList)
|
|
{
|
|
v.TranslateText(translator);
|
|
}
|
|
}
|
|
|
|
|
|
partial void PostInit();
|
|
partial void PostResolve();
|
|
}
|
|
|
|
} |