feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
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.
This commit is contained in:
@@ -0,0 +1,188 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Cute;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public abstract class OperationRecorderBase
|
||||
{
|
||||
protected readonly string _filePath;
|
||||
|
||||
protected readonly List<JsonData> _operationJsonDataList = new List<JsonData>();
|
||||
|
||||
protected readonly List<string> _skillTargetList = new List<string>();
|
||||
|
||||
public static string RecordDirectoryName => "recovery";
|
||||
|
||||
public static string RecordDirectoryPath => Application.persistentDataPath + "/" + RecordDirectoryName + "/";
|
||||
|
||||
public OperationRecorderBase(string filePath)
|
||||
{
|
||||
_filePath = filePath;
|
||||
}
|
||||
|
||||
public abstract void RecordBattleType(DataMgr.BattleType battleType);
|
||||
|
||||
public abstract void RecordRandomSeed(int randomSeed);
|
||||
|
||||
public abstract void RecordBackGroundId(int backGroundId);
|
||||
|
||||
public abstract void RecordBgmId(string bgmId);
|
||||
|
||||
public abstract void RecordClass(string playerName, int clanType);
|
||||
|
||||
public abstract void RecordSubClass(string playerName, int clanType);
|
||||
|
||||
public abstract void RecordMyRotationId(string playerName, string myRotationId);
|
||||
|
||||
public abstract void RecordSleeve(string playerName, long sleeveId);
|
||||
|
||||
public abstract void RecordChara(string playerName, int charaId);
|
||||
|
||||
public abstract void RecordDeck(string playerName, char indexHeadChar, IEnumerable<int> cardIds);
|
||||
|
||||
public abstract void RecordEnemyAIDifficulty(int difficulty);
|
||||
|
||||
public abstract void RecordEnemyAILogicLevel(int level);
|
||||
|
||||
public abstract void RecordEnemyAIMaxLife(int life);
|
||||
|
||||
public abstract void RecordEnemyAIDeckId(int deckId);
|
||||
|
||||
public abstract void RecordEnemyAIStyleId(int styleId);
|
||||
|
||||
public abstract void RecordEnemyAIEmoteId(int emoteId);
|
||||
|
||||
public abstract void RecordEnemyAIUseInnerEmote(bool useInnerEmote);
|
||||
|
||||
public abstract void RecordStartTurnIsPlayer(bool startTurnIsPlayer);
|
||||
|
||||
public abstract void RecordPracticeDifficultyDegreeId(int degreeId);
|
||||
|
||||
public abstract void RecordIsPreBuildDeck(bool isPreBuildDeck);
|
||||
|
||||
public abstract void RecordIsTrialDeck(bool isTrialDeck);
|
||||
|
||||
public abstract void RecordIsDefaultDeck(bool isDefaultDeck);
|
||||
|
||||
public abstract void RecordQuestStageId(int id);
|
||||
|
||||
public abstract void RecordQuestEnemyAiId(int id);
|
||||
|
||||
public abstract void RecordQuestEnemyEmblemId(int id);
|
||||
|
||||
public abstract void RecordQuestEnemyDegreeId(int id);
|
||||
|
||||
public abstract void RecordQuestEnemyEmotionOverride(int id);
|
||||
|
||||
public abstract void RecordQuestPlayerEmotionOverride(int id);
|
||||
|
||||
public abstract void RecordQuestRecoveryPoint(int recoveryPoint);
|
||||
|
||||
public abstract void RecordQuestPlayerSkillList(List<BossRushSpecialSkill> skills);
|
||||
|
||||
public abstract void RecordQuestEnemySkill(BossRushSpecialSkill skill);
|
||||
|
||||
public abstract void RecordQuestMaxBattleCount(int maxBattleCount);
|
||||
|
||||
public abstract void RecordQuestCurrentWinCount(int currentWinCount);
|
||||
|
||||
public abstract void RecordQuestIsExtra(bool isExtra);
|
||||
|
||||
public abstract void RecordQuestIsMockBattle(bool isMockBattle);
|
||||
|
||||
public abstract void RecordQuestExtraDeckScheduleId(int id);
|
||||
|
||||
public abstract void RecordMissionNecessaryInformation(BattleManagerBase.MissionNecessaryInformation missionNecessaryInformation);
|
||||
|
||||
public virtual void RecordStoryData()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract void RecordPractice3DFieldId(int id);
|
||||
|
||||
public abstract void RecordMulliganStart();
|
||||
|
||||
public abstract void RecordPlayerMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards);
|
||||
|
||||
public abstract void RecordEnemyMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards);
|
||||
|
||||
public abstract void RecordPlay(BattleCardBase originalCard, BattleCardBase card, IEnumerable<BattleCardBase> selectedCard);
|
||||
|
||||
public abstract VfxBase RecordAttack(BattleCardBase attackCard, BattleCardBase targetCard, SkillProcessor skillProcessor);
|
||||
|
||||
public abstract void RecordEvolve(BattleCardBase originalCard, BattleCardBase card, IEnumerable<BattleCardBase> selectedCard);
|
||||
|
||||
public abstract void RecordTurnStart();
|
||||
|
||||
public abstract void RecordTurnEnd();
|
||||
|
||||
public abstract void RecordRetire();
|
||||
|
||||
public abstract void RecordSkillTargets(IEnumerable<BattleCardBase> targetCards);
|
||||
|
||||
public abstract void RecordStartFusion(BattleCardBase fusionCard, List<BattleCardBase> selectableCards);
|
||||
|
||||
public abstract void RecordSelectFusion(BattleCardBase card);
|
||||
|
||||
public abstract void RecordCompleteFusionSelect(BattleCardBase fusionCard, IEnumerable<BattleCardBase> ingredientCards);
|
||||
|
||||
public abstract void RecordCancelFusion(BattleCardBase card);
|
||||
|
||||
public abstract void RecordStartSelect(BattleCardBase card, bool isEvolve, List<BattleCardBase> selectableCard, bool isChoiceBrave);
|
||||
|
||||
public abstract void RecordSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isBurialRite, bool isChoiceBrave);
|
||||
|
||||
public abstract void RecordCompleteSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isChoiceBrave, bool isBurialRite);
|
||||
|
||||
public abstract void RecordStartChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> choiceCards, bool isChoiceBrave);
|
||||
|
||||
public abstract void RecordCompleteChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> chosenCardList, BattleCardBase actCard, List<int> chosenCardIndexList, bool hasSelectionSkill, bool isChoiceBrave);
|
||||
|
||||
public abstract void RecordCancelChoice(BattleCardBase card, bool isEvolve, bool isChoiceBrave);
|
||||
|
||||
public abstract void RecordCancelSelect(BattleCardBase actCard, bool isEvolve, bool isChoiceBrave);
|
||||
|
||||
protected abstract void WriteJsonData();
|
||||
|
||||
protected virtual void WriteJsonDataToFile(JsonData jsonData, string overrideFilePath = "")
|
||||
{
|
||||
string text = (string.IsNullOrEmpty(overrideFilePath) ? _filePath : overrideFilePath);
|
||||
try
|
||||
{
|
||||
using StreamWriter streamWriter = new StreamWriter(text);
|
||||
streamWriter.Write(CryptAES.encryptForNode(jsonData.ToJson()));
|
||||
}
|
||||
catch
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("File Unauthorized to Access:" + text);
|
||||
}
|
||||
}
|
||||
|
||||
protected string CardToIndexName(IBattleCardUniqueID card)
|
||||
{
|
||||
if (card == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return card.GetName();
|
||||
}
|
||||
|
||||
protected void WriteSkillTargetInfoToJson(IEnumerable<BattleCardBase> selectedCards, JsonData jsonData)
|
||||
{
|
||||
if (!selectedCards.IsNotNullOrEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase selectedCard in selectedCards)
|
||||
{
|
||||
jsonData2.Add(CardToIndexName(selectedCard));
|
||||
}
|
||||
jsonData["skill_target"] = jsonData2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
using Wizard.Story.ChapterSelection;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
{
|
||||
protected readonly RecoveryOperationInfo _operationInfo;
|
||||
|
||||
protected bool _needUpdate;
|
||||
|
||||
private readonly Queue<string> _skillTargetNameQueue;
|
||||
|
||||
protected Action StartRecoveryEvent;
|
||||
|
||||
protected Action EndDataRecoveryEvent;
|
||||
|
||||
protected Action EndRecoveryEvent;
|
||||
|
||||
protected RecoveryController _recoveryController;
|
||||
|
||||
public DataMgr.BattleType BattleType => _operationInfo.BattleType;
|
||||
|
||||
public bool? DidPlayerGoFirst => _operationInfo.SetupInfo.DidPlayerGoFirst;
|
||||
|
||||
public int RandomSeed => _operationInfo.SetupInfo.RandomSeed;
|
||||
|
||||
public bool HasMulliganInfo => _operationInfo.SetupInfo.HasMulliganInfo;
|
||||
|
||||
public int BackGroundId => _operationInfo.SetupInfo.BackGroundId;
|
||||
|
||||
public string BgmId => _operationInfo.SetupInfo.BgmId;
|
||||
|
||||
public long RecordTime => _operationInfo.RecordTime;
|
||||
|
||||
public int IdxChangeSeed => -1;
|
||||
|
||||
public static bool failedRecoveryFlag { get; private set; }
|
||||
|
||||
public event Action OnStartRecovery
|
||||
{
|
||||
add
|
||||
{
|
||||
StartRecoveryEvent = (Action)Delegate.Combine(StartRecoveryEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
StartRecoveryEvent = (Action)Delegate.Remove(StartRecoveryEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
public event Action OnEndDataRecovery
|
||||
{
|
||||
add
|
||||
{
|
||||
EndDataRecoveryEvent = (Action)Delegate.Combine(EndDataRecoveryEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
EndDataRecoveryEvent = (Action)Delegate.Remove(EndDataRecoveryEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
public event Action OnEndRecovery
|
||||
{
|
||||
add
|
||||
{
|
||||
EndRecoveryEvent = (Action)Delegate.Combine(EndRecoveryEvent, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
EndRecoveryEvent = (Action)Delegate.Remove(EndRecoveryEvent, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenRecoveryFailedDialog()
|
||||
{
|
||||
AbortSoloPlayRecoveryTask task = new AbortSoloPlayRecoveryTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("ErrorHeader_20001"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Error_20001"));
|
||||
dialogBase.AddButton(DialogBase.ButtonType.BackToTitle);
|
||||
dialogBase.SetPanelDepth(6000);
|
||||
dialogBase.SetFadeButtonEnabled(flag: false);
|
||||
dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate
|
||||
{
|
||||
failedRecoveryFlag = false;
|
||||
UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd());
|
||||
});
|
||||
failedRecoveryFlag = true;
|
||||
RecoveryRecordManagerBase.DeleteRecoveryFile();
|
||||
}));
|
||||
}
|
||||
|
||||
public RecoveryManagerBase(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
_operationInfo = new RecoveryOperationInfo(filePath);
|
||||
_skillTargetNameQueue = new Queue<string>(_operationInfo.SkillTargetCardNames);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OpenRecoveryFailedDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
try
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
dataMgr.m_BattleType = _operationInfo.BattleType;
|
||||
SetupConditionInfo setupInfo = _operationInfo.SetupInfo;
|
||||
BattleConditionPlayerInfo playerInfo = setupInfo.PlayerInfo;
|
||||
BattleConditionEnemyInfo enemyInfo = setupInfo.EnemyInfo;
|
||||
int enemyAiID = -1;
|
||||
List<int> currentDeckData = playerInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList();
|
||||
List<int> specialAbilityIdList = null;
|
||||
dataMgr.SetCurrentDeckData(currentDeckData);
|
||||
dataMgr.SetPlayerCharaId(playerInfo.CharaId);
|
||||
dataMgr.SetPlayerSubClassID(playerInfo.SubClassId);
|
||||
dataMgr.SetPlayerMyRotationInfo(playerInfo.MyRotationId);
|
||||
dataMgr.SetPlayerSleeveId(playerInfo.SleeveId);
|
||||
dataMgr.PracticeDifficultyDegreeId = setupInfo.PracticeDifficultyDegreeId;
|
||||
dataMgr.MissionNecessaryInformation = setupInfo.MissionNecessaryInformation;
|
||||
if (setupInfo.IsPrebuildDeck)
|
||||
{
|
||||
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.BuildDeck;
|
||||
}
|
||||
if (setupInfo.IsTrialDeck)
|
||||
{
|
||||
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.TrialDeck;
|
||||
}
|
||||
if (dataMgr.m_BattleType == DataMgr.BattleType.Quest)
|
||||
{
|
||||
dataMgr.SetSoroPlay3DFieldID(setupInfo.BackGroundId);
|
||||
dataMgr.SetQuestBattleData(new QuestBattleData(setupInfo));
|
||||
enemyAiID = setupInfo.QuestEnemyAiId;
|
||||
}
|
||||
if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest)
|
||||
{
|
||||
dataMgr.SetSoroPlay3DFieldID(setupInfo.BackGroundId);
|
||||
dataMgr.SetBossRushBattleData(new BossRushBattleData(setupInfo));
|
||||
specialAbilityIdList = dataMgr.BossRushBattleData.PlayerSkillList.Select((BossRushSpecialSkill s) => s.OriginalCardId).ToList();
|
||||
enemyAiID = setupInfo.QuestEnemyAiId;
|
||||
}
|
||||
else if (dataMgr.m_BattleType == DataMgr.BattleType.Practice)
|
||||
{
|
||||
dataMgr.SetSoroPlay3DFieldID(BackGroundId);
|
||||
}
|
||||
else if (dataMgr.m_BattleType == DataMgr.BattleType.Story)
|
||||
{
|
||||
UIManager.GetInstance().OverrideSceneParam(UIManager.ViewScene.ClassSelectionPage, ClassSelectionPageParam.CreateStorySelect());
|
||||
AreaSelectUI.SetRecoveryData(setupInfo);
|
||||
if (setupInfo.IsDefaultDeck)
|
||||
{
|
||||
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.DefaultDeck;
|
||||
}
|
||||
}
|
||||
dataMgr.SetEnemyCharaId(enemyInfo.CharaId);
|
||||
dataMgr.SetEnemySubClassID(enemyInfo.SubClassId);
|
||||
dataMgr.SetEnemyMyRotationInfo(enemyInfo.MyRotationId);
|
||||
dataMgr.SetEnemySleeveId(enemyInfo.SleeveId);
|
||||
dataMgr.SetSelectDeckFormat((Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER));
|
||||
Data.CurrentFormat = dataMgr.GetSelectDeckFormat();
|
||||
CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(dataMgr.GetSelectDeckFormat()).CardMasterId);
|
||||
if (enemyInfo.AIDeckId >= 0)
|
||||
{
|
||||
if (dataMgr.m_BattleType == DataMgr.BattleType.Story)
|
||||
{
|
||||
StoryChapterSelectionUtility.RegisterStoryBattleData(Data.SelectedStoryInfo.ChapterData.FindBattleSettingDataByPlayerCharaId(setupInfo.StoryRecoveryData.ChapterCharaId));
|
||||
}
|
||||
else
|
||||
{
|
||||
dataMgr.SetCurrentEnemyDeckDataFromAIDeck(enemyInfo.ClassId, enemyInfo.AIDifficulty.Value, enemyInfo.AILevel.Value, enemyInfo.AIMaxLife.Value, enemyInfo.AIDeckId.Value, enemyInfo.AIStyleId.Value, enemyInfo.AIEmoteId.Value, enemyInfo.AIUseInnerEmote.Value, enemyAiID, specialAbilityIdList);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> deck = enemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList();
|
||||
dataMgr.SetEnemyAIDeckFromCustomDeck(enemyInfo.ClassId, deck, enemyInfo.AIDifficulty.Value, enemyInfo.AILevel.Value, enemyInfo.AIMaxLife.Value, enemyInfo.AIStyleId.Value, enemyInfo.AIEmoteId.Value, enemyInfo.AIUseInnerEmote.Value);
|
||||
}
|
||||
dataMgr.Load();
|
||||
dataMgr.LoadEnemy();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OpenRecoveryFailedDialog();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract List<int> CreateEnemyDeckIDList(BattleConditionEnemyInfo enemyInfo);
|
||||
|
||||
public abstract VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func<IEnumerator, Coroutine> startCoroutine);
|
||||
|
||||
public abstract VfxBase UpdateRecovery();
|
||||
|
||||
public virtual void RecoveryBeforeMulligan()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual VfxBase RecoveryMulligan(BattlePlayer battlePlayer, BattleEnemy battleEnemy)
|
||||
{
|
||||
EndDataRecovery();
|
||||
return SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().StartCoroutine(FontChanger.FontChange(null));
|
||||
}), ParallelVfxPlayer.Create(battlePlayer.BattleView.RecoveryMulligan(), battleEnemy.BattleView.RecoveryMulligan()), InstantVfx.Create(delegate
|
||||
{
|
||||
EndRecoveryEvent.Call();
|
||||
}));
|
||||
}
|
||||
|
||||
public virtual string RecoveryPopSkillTargetCardName()
|
||||
{
|
||||
return _skillTargetNameQueue.Dequeue();
|
||||
}
|
||||
|
||||
protected void EndDataRecovery()
|
||||
{
|
||||
_needUpdate = false;
|
||||
EndDataRecoveryEvent.Call();
|
||||
}
|
||||
|
||||
protected void RecoveryTurnStartPanel()
|
||||
{
|
||||
BattleManagerBase.GetIns().ReinitializeTurnPanelControl();
|
||||
}
|
||||
|
||||
protected void Dump(BattlePlayer battlePlayer, BattleEnemy battleEnemy)
|
||||
{
|
||||
string text = "";
|
||||
text += "P Hand :";
|
||||
foreach (BattleCardBase handCard in battlePlayer.HandCardList)
|
||||
{
|
||||
text = text + " p" + handCard.Index;
|
||||
}
|
||||
text += "\nP Inplay :";
|
||||
foreach (BattleCardBase inPlayCard in battlePlayer.InPlayCards)
|
||||
{
|
||||
text = text + " p" + inPlayCard.Index;
|
||||
}
|
||||
text += "\nE Hand :";
|
||||
foreach (BattleCardBase handCard2 in battleEnemy.HandCardList)
|
||||
{
|
||||
text = text + " e" + handCard2.Index;
|
||||
}
|
||||
text += "\nE Inplay :";
|
||||
foreach (BattleCardBase inPlayCard2 in battleEnemy.InPlayCards)
|
||||
{
|
||||
text = text + " e" + inPlayCard2.Index;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ResetLeaderAnimation(BattlePlayer battlePlayer, BattleEnemy battleEnemy)
|
||||
{
|
||||
PlayerClassBattleCardView playerClassBattleCardView = battlePlayer.Class.BattleCardView as PlayerClassBattleCardView;
|
||||
playerClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION));
|
||||
if (battlePlayer.IsSkinEvolved)
|
||||
{
|
||||
playerClassBattleCardView.ClassCharacter.PlayMotion(ClassCharaPrm.MotionType.z_idle);
|
||||
}
|
||||
EnemyClassBattleCardView enemyClassBattleCardView = battleEnemy.Class.BattleCardView as EnemyClassBattleCardView;
|
||||
enemyClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION));
|
||||
if (battleEnemy.IsSkinEvolved)
|
||||
{
|
||||
enemyClassBattleCardView.ClassCharacter.PlayMotion(ClassCharaPrm.MotionType.z_idle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Cute;
|
||||
using LitJson;
|
||||
using Wizard.AutoTest;
|
||||
using Wizard.ErrorDialog;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public abstract class RecoveryRecordManagerBase : IRecoveryRecordManager
|
||||
{
|
||||
protected OperationRecorderBase _recorder;
|
||||
|
||||
protected GameMgr _gameMgr;
|
||||
|
||||
protected DataMgr.BattleType _battleType;
|
||||
|
||||
protected readonly string _recoveryFilePath;
|
||||
|
||||
public const string DEFAULT_RECOVERY_SINGLE_FILE_NAME = "recovery_single.json";
|
||||
|
||||
public const string DEFAULT_RECOVERY_NETWORK_FILE_NAME = "recovery_network.json";
|
||||
|
||||
public const string DEFAULT_RECOVERY_AI_NETWORK_FILE_NAME = "recovery_ai_network.json";
|
||||
|
||||
protected abstract string DefaultRecoveryFileName { get; }
|
||||
|
||||
public RecoveryRecordManagerBase()
|
||||
{
|
||||
_recoveryFilePath = OperationRecorderBase.RecordDirectoryPath + DefaultRecoveryFileName;
|
||||
}
|
||||
|
||||
public RecoveryRecordManagerBase(string recoveryFilePath)
|
||||
{
|
||||
_recoveryFilePath = OperationRecorderBase.RecordDirectoryPath + recoveryFilePath;
|
||||
}
|
||||
|
||||
public void RecordSkillTarget(IEnumerable<BattleCardBase> targetCards)
|
||||
{
|
||||
_recorder.RecordSkillTargets(targetCards);
|
||||
}
|
||||
|
||||
public virtual void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE")
|
||||
{
|
||||
Directory.CreateDirectory(OperationRecorderBase.RecordDirectoryPath);
|
||||
_gameMgr = GameMgr.GetIns();
|
||||
_battleType = battleType;
|
||||
_recorder = CreateOperationRecorder();
|
||||
SetupRecorderEvents(_recorder, battleMgr);
|
||||
}
|
||||
|
||||
public virtual void SetupMulliganStartTimeRecorderEvent(BattleManagerBase battleMgr)
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract OperationRecorderBase CreateOperationRecorder();
|
||||
|
||||
protected virtual void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr)
|
||||
{
|
||||
battleMgr.OnStartOpening += operationRecorder.RecordStartTurnIsPlayer;
|
||||
battleMgr.BattlePlayer.OnMulliganEnd += operationRecorder.RecordPlayerMulliganReplaceCards;
|
||||
battleMgr.BattleEnemy.OnMulliganEnd += operationRecorder.RecordEnemyMulliganReplaceCards;
|
||||
battleMgr.OperateMgr.OnSetCardSuccess += operationRecorder.RecordPlay;
|
||||
battleMgr.OperateMgr.OnBeforeAttack += operationRecorder.RecordAttack;
|
||||
battleMgr.OperateMgr.OnEvolveSuccess += operationRecorder.RecordEvolve;
|
||||
battleMgr.OperateMgr.OnStartSelect += operationRecorder.RecordStartSelect;
|
||||
battleMgr.OperateMgr.OnSelect += operationRecorder.RecordSelect;
|
||||
battleMgr.OperateMgr.OnCompleteSelect += operationRecorder.RecordCompleteSelect;
|
||||
battleMgr.OperateMgr.OnStartChoice += operationRecorder.RecordStartChoice;
|
||||
battleMgr.OperateMgr.OnCompleteChoice += operationRecorder.RecordCompleteChoice;
|
||||
battleMgr.OperateMgr.OnCancelSelect += operationRecorder.RecordCancelSelect;
|
||||
battleMgr.OperateMgr.OnCancelChoice += operationRecorder.RecordCancelChoice;
|
||||
battleMgr.OperateMgr.OnStartFusion += operationRecorder.RecordStartFusion;
|
||||
battleMgr.OperateMgr.OnSelectFusionForRecovery += operationRecorder.RecordSelectFusion;
|
||||
battleMgr.OperateMgr.OnCancelFusion += operationRecorder.RecordCancelFusion;
|
||||
battleMgr.OperateMgr.OnBeforeFusion += operationRecorder.RecordCompleteFusionSelect;
|
||||
if (battleMgr is SingleBattleMgr singleBattleMgr && _gameMgr.GetDataMgr().BossRushBattleData != null)
|
||||
{
|
||||
singleBattleMgr.OnBattleRetire += operationRecorder.RecordRetire;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsExistsNetworkRecoveryFile()
|
||||
{
|
||||
return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json");
|
||||
}
|
||||
|
||||
public static bool IsExistsAINetworkRecoveryFile()
|
||||
{
|
||||
return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json");
|
||||
}
|
||||
|
||||
public static bool IsExistsSingleRecoveryFile()
|
||||
{
|
||||
return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json");
|
||||
}
|
||||
|
||||
public static bool IsBossRushBattleRetired()
|
||||
{
|
||||
if (!IsExistsSingleRecoveryFile())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
JsonData jsonData;
|
||||
try
|
||||
{
|
||||
jsonData = RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AbortSoloPlayRecoveryTask task = new AbortSoloPlayRecoveryTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
Data.Load.data.InitRecoveryStatus();
|
||||
UIManager.GetInstance().isBattleRecovery = false;
|
||||
DeleteRecoveryFile();
|
||||
DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create(20001);
|
||||
dialogBase.SetButtonDelegate(delegate
|
||||
{
|
||||
SoftwareReset.exec();
|
||||
});
|
||||
dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS;
|
||||
}));
|
||||
throw ex;
|
||||
}
|
||||
if (!jsonData.Keys.Contains("operations"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int num = jsonData["operations"].Count - 1; num >= 0; num--)
|
||||
{
|
||||
JsonData jsonData2 = jsonData["operations"][num];
|
||||
if (jsonData2.Keys.Contains("ope") && jsonData2["ope"].ToString() == "retire")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void DeleteTempAINetworkRecoveryFile()
|
||||
{
|
||||
if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_ai_network.json"))
|
||||
{
|
||||
File.Delete(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_ai_network.json");
|
||||
}
|
||||
}
|
||||
|
||||
public static DataMgr.BattleType GetRecoveryBattleType()
|
||||
{
|
||||
if (IsExistsNetworkRecoveryFile() || IsExistsAINetworkRecoveryFile())
|
||||
{
|
||||
if (IsExistsAINetworkRecoveryFile())
|
||||
{
|
||||
GameMgr.GetIns().IsAINetwork = true;
|
||||
}
|
||||
return Data.BattleRecoveryInfo.BattleType;
|
||||
}
|
||||
if (IsExistsSingleRecoveryFile())
|
||||
{
|
||||
JsonData jsonData = RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json");
|
||||
return (DataMgr.BattleType)jsonData.ToIntOrDefault("battle_type", 100);
|
||||
}
|
||||
return DataMgr.BattleType.None;
|
||||
}
|
||||
|
||||
public static void DeleteRecoveryFile()
|
||||
{
|
||||
if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json"))
|
||||
{
|
||||
File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json");
|
||||
}
|
||||
if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json"))
|
||||
{
|
||||
File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json");
|
||||
}
|
||||
if (IsExistsSingleRecoveryFile())
|
||||
{
|
||||
File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user