using System; using System.Collections; using System.Collections.Generic; using FJson; using FJson.Core; using Framework.Utils.SingletonTemplate; using Game.Data.BaseData; using UnityEngine; namespace Game.Manager { public class PackageManager : MgrBase { private Dictionary _weaponCardCache; private Dictionary _echoCardCache; private Dictionary _maskCardCache; private Dictionary _exchangeCardCache; private Dictionary _replenishCardCache; private Dictionary _secretCardCache; private Dictionary _cardQualityCache; protected override void OnCreateMge () { this._weaponCardCache = new Dictionary (); this._echoCardCache = new Dictionary (); this._maskCardCache = new Dictionary (); this._exchangeCardCache = new Dictionary (); this._replenishCardCache = new Dictionary (); this._secretCardCache = new Dictionary (); this._cardQualityCache = new Dictionary (); RofManagerConfig.Instance.WeaponCardTable.GetAllRow ().ForEach (row => { this._weaponCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); RofManagerConfig.Instance.EchoCardTable.GetAllRow ().ForEach (row => { this._echoCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); RofManagerConfig.Instance.MaskCardTable.GetAllRow ().ForEach (row => { this._maskCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); RofManagerConfig.Instance.ExchangeCardTable.GetAllRow ().ForEach (row => { this._exchangeCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); RofManagerConfig.Instance.ReplenishCardTable.GetAllRow ().ForEach (row => { this._replenishCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); RofManagerConfig.Instance.SecretCardTable.GetAllRow ().ForEach (row => { this._secretCardCache.Add (row.ID, row); this._cardQualityCache.Add (row.ID, (Quality)row.quality); }); } public Quality GetCardQuality (int cardId) { return this._cardQualityCache.GetValueOrDefault (cardId); } public Vector2 GetRangeEcho (int cardId) { if (this._echoCardCache.TryGetValue (cardId, out var rofEchoCardRow)) { var readActionParser = ActionParser.CreateAction (null , rofEchoCardRow.maskId); return new Vector2 ((int)readActionParser.ActionArgs[0] , (int)readActionParser.ActionArgs[1]); } return new Vector2 (-1, -1); } public RofEchoCardRow GetEchoRof (int node) { return this._echoCardCache.GetValueOrDefault (node); } } }