Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/AICardDataAssetSet.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

89 lines
2.0 KiB
C#

using System.Collections.Generic;
namespace Wizard;
public class AICardDataAssetSet
{
private class AICardDataAssetTemporaryRecord
{
public string[] Data { get; set; }
public int DiffFromLatestRotationPack { get; set; }
}
public List<AICardDataAsset> Set { get; private set; }
public AICardDataAssetSet()
{
Set = new List<AICardDataAsset>();
}
public void ConvertCsvTextToAsset(List<string[]> csv)
{
int latestRotationCardPack = GetRotationLatestCardPackNumber();
Dictionary<int, AICardDataAssetTemporaryRecord> latestCardCandidateDic = new Dictionary<int, AICardDataAssetTemporaryRecord>();
foreach (string[] item in csv)
{
if (IsRegister(item))
{
Set.Add(new AICardDataAsset(item));
}
}
foreach (AICardDataAssetTemporaryRecord value2 in latestCardCandidateDic.Values)
{
Set.Add(new AICardDataAsset(value2.Data));
}
bool IsRegister(string[] cardData)
{
string text = cardData[0];
int num;
int key;
if (text.Length > 9)
{
num = int.Parse(text.Substring(text.Length - 2));
key = int.Parse(text.Substring(0, text.Length - 2));
}
else
{
key = int.Parse(text);
num = 0;
}
if (num == 0)
{
return true;
}
if (num < latestRotationCardPack)
{
return false;
}
cardData[0] = key.ToString();
if (latestCardCandidateDic.TryGetValue(key, out var value))
{
int num2 = num - latestRotationCardPack;
if (num2 < value.DiffFromLatestRotationPack)
{
latestCardCandidateDic[key] = new AICardDataAssetTemporaryRecord
{
Data = cardData,
DiffFromLatestRotationPack = num2
};
}
}
else
{
latestCardCandidateDic.Add(key, new AICardDataAssetTemporaryRecord
{
Data = cardData,
DiffFromLatestRotationPack = num - latestRotationCardPack
});
}
return false;
}
}
private int GetRotationLatestCardPackNumber()
{
return Data.Load.data.RotationLatestCardPackId % 100;
}
}