Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/SpotCardData.cs
gamer147 0d9d8acae0 feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
2026-06-05 16:57:20 -04:00

68 lines
1.5 KiB
C#

using System.Collections.Generic;
using LitJson;
namespace Wizard;
public class SpotCardData
{
private Dictionary<int, int> _spotCardDict = new Dictionary<int, int>();
public void SetSpotCardData(JsonData jsonData)
{
if (jsonData == null || jsonData.Count == 0)
{
return;
}
_spotCardDict = new Dictionary<int, int>(jsonData.Count);
foreach (string key in jsonData.Keys)
{
if (int.TryParse(key, out var result))
{
_spotCardDict[result] = jsonData[key].ToInt();
}
}
GameMgr.GetIns().GetDataMgr().SetDirtyPossessionCardDict();
}
public bool ExistsSpotCard()
{
return _spotCardDict.Count > 0;
}
public bool ExistsSpotCard(int cardId)
{
return _spotCardDict.ContainsKey(cardId);
}
public int GetSpotCardNum(int cardId)
{
int value = 0;
_spotCardDict.TryGetValue(cardId, out value);
return value;
}
public void SetSpotCardNum(int cardId, int num)
{
_spotCardDict[cardId] = num;
GameMgr.GetIns().GetDataMgr().SetDirtyPossessionCardDict();
}
public Dictionary<int, int> CreateDictionaryIncludingSpotCard(IDictionary<int, int> srcDict)
{
Dictionary<int, int> dictionary = new Dictionary<int, int>(srcDict);
foreach (KeyValuePair<int, int> item in _spotCardDict)
{
int value = 0;
if (dictionary.TryGetValue(item.Key, out value))
{
dictionary[item.Key] = value + item.Value;
}
else
{
dictionary.Add(item.Key, item.Value);
}
}
return dictionary;
}
}