//------------------------------------------------------------------------------ // // 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 { public sealed partial class TbFishingEvent { /// /// type map /// private readonly Dictionary> _typeDataMap = new Dictionary>(); private readonly Dictionary> _typeAndSubDataMap = new Dictionary>(); public List GetAllDataByType(int type) { if (_typeDataMap.ContainsKey(type)) return _typeDataMap[type]; var list = new List(); foreach (var v in DataList) { if (v.Type == type) list.Add(v); } _typeDataMap.Add(type, list); return list; } public List GetAllDataByType(int type, int subType) { int key = RedirectType(type, subType); if (_typeAndSubDataMap.ContainsKey(key)) return _typeAndSubDataMap[key]; var list = new List(); foreach (var v in DataList) { if (v.Type == type && v.SubType == subType) list.Add(v); } _typeAndSubDataMap.Add(key, list); return list; } int RedirectType(int type, int subType) { return type * 1000 + subType; } partial void PostInit() { var dataList = new List(_dataList); _dataMap.Clear(); _dataList.Clear(); foreach (FishingEvent _v in dataList) { if (_v.Channel.Count == 0 || _v.Channel.Contains(ChannelManager.CurrentChannel.ToString())) { _dataList.Add(_v); _dataMap.Add(_v.ID, _v); } } } } }