Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
104 lines
2.6 KiB
C#
104 lines
2.6 KiB
C#
using System.Collections.Generic;
|
|
using LitJson;
|
|
using UnityEngine;
|
|
using Wizard.Battle;
|
|
using Wizard.Battle.Operation;
|
|
|
|
namespace Wizard.AutoTest;
|
|
|
|
public static class AutoTestBattleMgr
|
|
{
|
|
public class CardInfo : IBattleCardUniqueID
|
|
{
|
|
public string Name { get; private set; }
|
|
|
|
public bool IsPlayer { get; private set; }
|
|
|
|
public int Index { get; private set; }
|
|
|
|
public int CardId { get; private set; }
|
|
|
|
public int Cost { get; private set; }
|
|
|
|
public int AddAtk { get; set; }
|
|
|
|
public int AddLife { get; set; }
|
|
|
|
public int ChangeClan { get; set; }
|
|
|
|
public CardInfo(string cardName, int cardId = 0, int cost = -1, int addAtk = 0, int addLife = 0, int clan = 0)
|
|
{
|
|
Name = cardName;
|
|
IsPlayer = cardName[0] == 'p';
|
|
Index = int.Parse(cardName.Substring(1));
|
|
CardId = cardId;
|
|
Cost = cost;
|
|
AddAtk = addAtk;
|
|
AddLife = addLife;
|
|
ChangeClan = clan;
|
|
}
|
|
|
|
public CardInfo(IReadOnlyBattleCardInfo cardInfo)
|
|
{
|
|
IsPlayer = cardInfo.IsPlayer;
|
|
Index = cardInfo.Index;
|
|
Name = cardInfo.GetName();
|
|
CardId = cardInfo.CardId;
|
|
Cost = cardInfo.Cost;
|
|
}
|
|
}
|
|
|
|
public static IEnumerable<IOperationCommand> CreateOperationCommands(IEnumerable<JsonData> actionJsonDatas, bool startTurnIsPlayer)
|
|
{
|
|
bool currentTurnIsPlayer = startTurnIsPlayer;
|
|
foreach (JsonData actionJsonData in actionJsonDatas)
|
|
{
|
|
string text = actionJsonData["ope"].ToString();
|
|
switch (text)
|
|
{
|
|
case "play":
|
|
yield return new PlayOperationCommand(actionJsonData);
|
|
break;
|
|
case "attack":
|
|
yield return new AttackOperationCommand(actionJsonData);
|
|
break;
|
|
case "evolve":
|
|
yield return new EvolveOperationCommand(actionJsonData);
|
|
break;
|
|
case "turn_end":
|
|
yield return new TurnEndOperationCommand(currentTurnIsPlayer);
|
|
currentTurnIsPlayer = !currentTurnIsPlayer;
|
|
break;
|
|
case "change_ai":
|
|
yield return new ChangeAIOperationCommand(actionJsonData);
|
|
break;
|
|
case "comp_fusion":
|
|
yield return new FusionOperationCommand(actionJsonData);
|
|
break;
|
|
default:
|
|
Debug.LogError("Auto test \"" + text + "\" is not supported.");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static JsonData LoadJsonData(string filePath)
|
|
{
|
|
return JsonMapper.ToObject(Resources.Load<TextAsset>(filePath).text);
|
|
}
|
|
|
|
private static IEnumerable<int> CreateDeckIds(JsonData playerJsonData)
|
|
{
|
|
JsonData deckJsonData = playerJsonData["deck"];
|
|
if (deckJsonData.IsArray)
|
|
{
|
|
int deckCardCount = deckJsonData.Count;
|
|
for (int i = 0; i < deckCardCount; i++)
|
|
{
|
|
JsonData jsonData = deckJsonData[i];
|
|
yield return jsonData["id"].ToInt();
|
|
}
|
|
}
|
|
}
|
|
}
|