| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using cfg;
- using cfg.GfgCfg;
- using ET;
- namespace GFGGame
- {
- public class ItemCfgArray : SingletonBaseET<ItemCfgArray>
- {
- public bool CheckCfgExist(int itemId)
- {
- var itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemId);
- return itemCfg != null;
- }
- // 静态字典,全局共享
- public Dictionary<int, List<int>> SyntheticSuitDic = new Dictionary<int, List<int>>();
- // 初始化方法(应该在加载配置时调用)
- public void InitSyntheticSuitDic()
- {
- Instance.SyntheticSuitDic.Clear();
- foreach (var itemCfg in CommonDataManager.Tables.TblItemCfg.DataList)
- {
- foreach (var itemParam in itemCfg.SyntheticMateriars)
- {
- SyntheticSuitDic.TryGetValue(itemParam.ItemId, out var list);
- list ??= new List<int>();
- if (list.Any(a => a == itemCfg.Id))
- {
- continue;
- }
- list.Add(itemCfg.Id);
- SyntheticSuitDic[itemParam.ItemId] = list;
- }
- }
- }
- // /// <summary>
- // /// 临时用 服装异步加载
- // /// </summary>
- // /// <param name="itemType"></param>
- // /// <param name="subType"></param>
- // /// <returns></returns>
- // public async Task GetCfgsByitemTypeAndsubTypeAsync(int itemType, int subType)
- // {
- //
- //
- // var colNames = new string[] { nameof(itemType), nameof(subType) };
- // var colValues = new string[] { itemType.ToString(), subType.ToString() };
- // await DressUpConfigUtil.GetCfgsAsync<ItemCfg>("ItemCfgArray", colNames, colValues, _cfgsGroupDic1,
- // HandleCfg);
- // }
- }
- }
|