//------------------------------------------------------------------------------ // // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ using Bright.Serialization; using System.Collections.Generic; using SimpleJSON; namespace cfg.MonsterCfg { public sealed partial class MonsterClass { private readonly Dictionary _dataMap; private readonly List _dataList; public MonsterClass(JSONNode _json) { _dataMap = new Dictionary(); _dataList = new List(); foreach(JSONNode _row in _json.Children) { var _v = MonsterCfg.DataMonsterClass.DeserializeDataMonsterClass(_row); _dataList.Add(_v); _dataMap.Add(_v.MonsterClassID, _v); } PostInit(); } public Dictionary DataMap => _dataMap; public List DataList => _dataList; public MonsterCfg.DataMonsterClass GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null; public MonsterCfg.DataMonsterClass Get(int key) { if (_dataMap.TryGetValue(key, out var v)) { return v; } else { UnityEngine.Debug.LogError($"table MonsterClass key not found: {key}"); return null; } } public MonsterCfg.DataMonsterClass this[int key] => _dataMap[key]; public void Resolve(Dictionary _tables) { foreach(var v in _dataList) { v.Resolve(_tables); } PostResolve(); } public void TranslateText(System.Func translator) { foreach(var v in _dataList) { v.TranslateText(translator); } } partial void PostInit(); partial void PostResolve(); } }