You've already forked taptap2024_GJ_chidouren
83 lines
3.5 KiB
C#
83 lines
3.5 KiB
C#
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<PackageManager>
|
|
{
|
|
private Dictionary<int, RofWeaponCardRow> _weaponCardCache;
|
|
private Dictionary<int , RofEchoCardRow> _echoCardCache;
|
|
private Dictionary<int , RofMaskCardRow> _maskCardCache;
|
|
private Dictionary<int , RofExchangeCardRow> _exchangeCardCache;
|
|
private Dictionary<int , RofReplenishCardRow> _replenishCardCache;
|
|
private Dictionary<int, RofSecretCardRow> _secretCardCache;
|
|
private Dictionary<int, Quality> _cardQualityCache;
|
|
|
|
protected override void OnCreateMge ()
|
|
{
|
|
this._weaponCardCache = new Dictionary<int, RofWeaponCardRow> ();
|
|
this._echoCardCache = new Dictionary<int, RofEchoCardRow> ();
|
|
this._maskCardCache = new Dictionary<int, RofMaskCardRow> ();
|
|
this._exchangeCardCache = new Dictionary<int, RofExchangeCardRow> ();
|
|
this._replenishCardCache = new Dictionary<int, RofReplenishCardRow> ();
|
|
this._secretCardCache = new Dictionary<int, RofSecretCardRow> ();
|
|
this._cardQualityCache = new Dictionary<int, Quality> ();
|
|
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);
|
|
}
|
|
}
|
|
} |