engine cleanup passes 4-7 + multi-instancing ambient rip
Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,580 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LitJson;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class AINetworkBattleOperationRecorder : OperationRecorderBase
|
||||
{
|
||||
protected DataMgr.BattleType _battleType;
|
||||
|
||||
protected long _turnStartTime;
|
||||
|
||||
protected JsonData _setupJsonData = new JsonData();
|
||||
|
||||
public AINetworkBattleOperationRecorder(string filePath)
|
||||
: base(filePath)
|
||||
{
|
||||
if (RecoveryRecordManagerBase.IsExistsAINetworkRecoveryFile())
|
||||
{
|
||||
JsonData jsonData = RecoveryOperationInfo.ReadRecoveryFile(filePath);
|
||||
_setupJsonData = jsonData["setup"];
|
||||
_battleType = (DataMgr.BattleType)jsonData["battle_type"].ToInt();
|
||||
if (jsonData.Keys.Any((string a) => a == "operations"))
|
||||
{
|
||||
foreach (object item in (IEnumerable)jsonData["operations"])
|
||||
{
|
||||
_operationJsonDataList.Add((JsonData)item);
|
||||
}
|
||||
}
|
||||
if (jsonData.Keys.Any((string a) => a == "skill_targets"))
|
||||
{
|
||||
foreach (object item2 in (IEnumerable)jsonData["skill_targets"])
|
||||
{
|
||||
_skillTargetList.Add((string)item2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_setupJsonData["player"] = new JsonData();
|
||||
_setupJsonData["player"].SetJsonType(JsonType.Object);
|
||||
_setupJsonData["enemy"] = new JsonData();
|
||||
_setupJsonData["enemy"].SetJsonType(JsonType.Object);
|
||||
}
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordMulliganStart()
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateTime.Now.Ticks, new TimeSpan(0, 0, 0));
|
||||
_setupJsonData["start_mulligan_time"] = dateTimeOffset.ToUnixTimeSeconds();
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordPractice3DFieldId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordBattleType(DataMgr.BattleType battleType)
|
||||
{
|
||||
_battleType = battleType;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordRandomSeed(int randomSeed)
|
||||
{
|
||||
_setupJsonData["random_seed"] = randomSeed;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordBackGroundId(int backGroundId)
|
||||
{
|
||||
_setupJsonData["background_id"] = backGroundId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordBgmId(string bgmId)
|
||||
{
|
||||
_setupJsonData["bgm_id"] = bgmId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordClass(string playerName, int clanType)
|
||||
{
|
||||
_setupJsonData[playerName]["clan_type"] = clanType;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordSubClass(string playerName, int clanType)
|
||||
{
|
||||
_setupJsonData[playerName]["sub_class_type"] = clanType;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordMyRotationId(string playerName, string myRotationId)
|
||||
{
|
||||
_setupJsonData[playerName]["my_rotation_id"] = myRotationId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordSleeve(string playerName, long sleeveId)
|
||||
{
|
||||
_setupJsonData[playerName]["sleeve_id"] = sleeveId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordChara(string playerName, int charaId)
|
||||
{
|
||||
_setupJsonData[playerName]["chara_id"] = charaId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordDeck(string playerName, char indexHeadChar, IEnumerable<int> cardIds)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
_setupJsonData[playerName]["deck"] = jsonData;
|
||||
jsonData.SetJsonType(JsonType.Array);
|
||||
int num = 1;
|
||||
foreach (int cardId in cardIds)
|
||||
{
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Object);
|
||||
jsonData2["index"] = indexHeadChar.ToString() + num;
|
||||
jsonData2["id"] = cardId;
|
||||
jsonData2["name"] = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId).CardName;
|
||||
jsonData.Add(jsonData2);
|
||||
num++;
|
||||
}
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIDifficulty(int level)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_difficulty"] = level;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAILogicLevel(int level)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_logic_level"] = level;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIMaxLife(int life)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_max_life"] = life;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIDeckId(int deckId)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_deck_id"] = deckId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIStyleId(int styleId)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_style_id"] = styleId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIEmoteId(int emoteId)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_emote_id"] = emoteId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIUseInnerEmote(bool useInnerEmote)
|
||||
{
|
||||
_setupJsonData["enemy"]["ai_use_inner_emote"] = useInnerEmote;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordStartTurnIsPlayer(bool startTurnIsPlayer)
|
||||
{
|
||||
_setupJsonData["player_start_turn"] = startTurnIsPlayer;
|
||||
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateTime.Now.Ticks, new TimeSpan(0, 0, 0));
|
||||
_setupJsonData["opening_start_time"] = dateTimeOffset.ToUnixTimeSeconds();
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordPracticeDifficultyDegreeId(int degreeId)
|
||||
{
|
||||
_setupJsonData["practice_difficulty_degree_id"] = degreeId;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordIsPreBuildDeck(bool isPreBuildDeck)
|
||||
{
|
||||
_setupJsonData["is_prebuild_deck"] = isPreBuildDeck;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordIsTrialDeck(bool isTrialDeck)
|
||||
{
|
||||
_setupJsonData["is_trial_deck"] = isTrialDeck;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordIsDefaultDeck(bool isDefaultDeck)
|
||||
{
|
||||
_setupJsonData["is_default_deck"] = isDefaultDeck;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestStageId(int id)
|
||||
{
|
||||
_setupJsonData["quest_stage_id"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyAiId(int id)
|
||||
{
|
||||
_setupJsonData["quest_enemy_ai_id"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyEmblemId(int id)
|
||||
{
|
||||
_setupJsonData["quest_enemy_emblem_id"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyDegreeId(int id)
|
||||
{
|
||||
_setupJsonData["quest_enemy_degree_id"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyEmotionOverride(int id)
|
||||
{
|
||||
_setupJsonData["quest_enemy_emotion_override"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestPlayerEmotionOverride(int id)
|
||||
{
|
||||
_setupJsonData["quest_player_emotion_override"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestRecoveryPoint(int recoveryPoint)
|
||||
{
|
||||
_setupJsonData["recovery_point"] = recoveryPoint;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestPlayerSkillList(List<BossRushSpecialSkill> skills)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
_setupJsonData["quest_player_skill_list"] = jsonData;
|
||||
jsonData.SetJsonType(JsonType.Array);
|
||||
foreach (BossRushSpecialSkill skill in skills)
|
||||
{
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Object);
|
||||
jsonData2["original_card_id"] = skill.OriginalCardId;
|
||||
jsonData2["name"] = skill.Name;
|
||||
jsonData2["skill_text"] = skill.SkillText;
|
||||
jsonData2["skill_desc_text"] = skill.SkillDescText;
|
||||
jsonData2["is_foil"] = skill.IsFoil;
|
||||
jsonData.Add(jsonData2);
|
||||
}
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemySkill(BossRushSpecialSkill skill)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData.SetJsonType(JsonType.Object);
|
||||
jsonData["original_card_id"] = skill.OriginalCardId;
|
||||
jsonData["name"] = skill.Name;
|
||||
jsonData["skill_text"] = skill.SkillText;
|
||||
jsonData["skill_desc_text"] = skill.SkillDescText;
|
||||
jsonData["is_foil"] = skill.IsFoil;
|
||||
_setupJsonData["quest_enemy_skill"] = jsonData;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestMaxBattleCount(int maxBattleCount)
|
||||
{
|
||||
_setupJsonData["quest_max_battle_count"] = maxBattleCount;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestCurrentWinCount(int currentWinCount)
|
||||
{
|
||||
_setupJsonData["quest_current_win_count"] = currentWinCount;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestIsExtra(bool isExtra)
|
||||
{
|
||||
_setupJsonData["quest_is_extra"] = isExtra;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestIsMockBattle(bool isMockBattle)
|
||||
{
|
||||
_setupJsonData["quest_is_mock_battle"] = isMockBattle;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordQuestExtraDeckScheduleId(int id)
|
||||
{
|
||||
_setupJsonData["quest_extra_deck_schedule_id"] = id;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordMissionNecessaryInformation(BattleManagerBase.MissionNecessaryInformation missionNecessaryInformation)
|
||||
{
|
||||
_setupJsonData["mission_necessary_information"] = new JsonData();
|
||||
_setupJsonData["mission_necessary_information"].SetJsonType(JsonType.Object);
|
||||
foreach (KeyValuePair<string, string> item in missionNecessaryInformation.GetOriginalTargetDictionary())
|
||||
{
|
||||
_setupJsonData["mission_necessary_information"][item.Key] = item.Value;
|
||||
}
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordPlayerMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase replaceCard in replaceCards)
|
||||
{
|
||||
jsonData.Add(replaceCard.GetName());
|
||||
}
|
||||
_setupJsonData["player_mulligan_abandon"] = jsonData;
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
foreach (int completeCard in completeCards)
|
||||
{
|
||||
jsonData2.Add("p" + completeCard);
|
||||
}
|
||||
_setupJsonData["player_mulligan_complete"] = jsonData2;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase replaceCard in replaceCards)
|
||||
{
|
||||
jsonData.Add(replaceCard.GetName());
|
||||
}
|
||||
_setupJsonData["enemy_mulligan_abandon"] = jsonData;
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
foreach (int completeCard in completeCards)
|
||||
{
|
||||
jsonData2.Add("e" + completeCard);
|
||||
}
|
||||
_setupJsonData["enemy_mulligan_complete"] = jsonData2;
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordPlay(BattleCardBase card, BattleCardBase originalCard, IEnumerable<BattleCardBase> selectedCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "play";
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["id"] = card.CardId;
|
||||
jsonData["name"] = card.BaseParameter.CardName;
|
||||
jsonData["cost"] = card.Cost;
|
||||
jsonData["is_choice_brave"] = (originalCard.IsChoiceBraveSkillCard ? 1 : 0);
|
||||
WriteSkillTargetInfoToJson(selectedCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override VfxBase RecordAttack(BattleCardBase attackCard, BattleCardBase targetCard, SkillProcessor skillProcessor)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "attack";
|
||||
jsonData["index"] = CardToIndexName(attackCard);
|
||||
jsonData["id"] = attackCard.CardId;
|
||||
jsonData["name"] = attackCard.BaseParameter.CardName;
|
||||
jsonData["target"] = CardToIndexName(targetCard);
|
||||
jsonData["target_id"] = targetCard.CardId;
|
||||
jsonData["target_name"] = targetCard.BaseParameter.CardName;
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override void RecordEvolve(BattleCardBase originalCard, BattleCardBase card, IEnumerable<BattleCardBase> selectedCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "evolve";
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["id"] = card.CardId;
|
||||
jsonData["name"] = card.BaseParameter.CardName;
|
||||
WriteSkillTargetInfoToJson(selectedCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordStartSelect(BattleCardBase card, bool isEvolve, List<BattleCardBase> selectableCards, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isBurialRite, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordCompleteSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isChoiceBrave, bool isBurialRite)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordStartChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> choiceCards, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordStartFusion(BattleCardBase card, List<BattleCardBase> selectableCards)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordSelectFusion(BattleCardBase card)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordCompleteChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> chosenCardList, BattleCardBase actCard, List<int> chosenCardIndexList, bool hasSelectionSkill, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordCancelChoice(BattleCardBase card, bool isEvolve, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordCancelFusion(BattleCardBase card)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordCancelSelect(BattleCardBase actCard, bool isEvolve, bool isChoiceBrave)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordTurnStart()
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = new DateTimeOffset(DateTime.Now.Ticks, new TimeSpan(0, 0, 0));
|
||||
_turnStartTime = dateTimeOffset.ToUnixTimeSeconds();
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordTurnEnd()
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "turn_end";
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordRetire()
|
||||
{
|
||||
}
|
||||
|
||||
public void RecordChangeAI(string logicName, int operationQueueCount)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "change_ai";
|
||||
jsonData["logic"] = logicName;
|
||||
jsonData["queue_count"] = operationQueueCount;
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordSkillTargets(IEnumerable<BattleCardBase> targetCards)
|
||||
{
|
||||
foreach (BattleCardBase targetCard in targetCards)
|
||||
{
|
||||
_skillTargetList.Add(targetCard.GetName());
|
||||
}
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public void RecordSpecialBattleSetting(DataMgr.SpecialBattleSetting setting)
|
||||
{
|
||||
if (setting != null)
|
||||
{
|
||||
_setupJsonData["story_special_battle_player_attach_skill"] = setting.PlayerAttachSkillText;
|
||||
_setupJsonData["story_special_battle_enemy_attach_skill"] = setting.EnemyAttachSkillText;
|
||||
_setupJsonData["story_special_battle_player_start_pp"] = setting.PlayerStartPp;
|
||||
_setupJsonData["story_special_battle_enemy_start_pp"] = setting.EnemyStartPp;
|
||||
_setupJsonData["story_special_battle_player_start_life"] = setting.PlayerStartMaxLife;
|
||||
_setupJsonData["story_special_battle_enemy_start_life"] = setting.EnemyStartMaxLife;
|
||||
_setupJsonData["story_special_battle_banish_effect_override"] = setting.IdOverrideInBattleLogText;
|
||||
_setupJsonData["story_special_battle_token_draw_effect_override"] = setting.TokenDrawEffectOverrideText;
|
||||
_setupJsonData["story_special_battle_id_override_in_battle_log"] = setting.IdOverrideInBattleLogText;
|
||||
WriteJsonData();
|
||||
}
|
||||
}
|
||||
|
||||
public override void RecordCompleteFusionSelect(BattleCardBase fusionCard, IEnumerable<BattleCardBase> ingredientCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["ope"] = "comp_fusion";
|
||||
jsonData["index"] = CardToIndexName(fusionCard);
|
||||
jsonData["id"] = fusionCard.CardId;
|
||||
jsonData["name"] = fusionCard.BaseParameter.CardName;
|
||||
WriteSkillTargetInfoToJson(ingredientCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
protected override void WriteJsonData()
|
||||
{
|
||||
if (RecoveryManagerBase.failedRecoveryFlag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["version"] = 0;
|
||||
jsonData["battle_type"] = (int)_battleType;
|
||||
jsonData["record_time"] = DateTime.Now.Ticks;
|
||||
jsonData["turn_start_time"] = _turnStartTime;
|
||||
jsonData["setup"] = _setupJsonData;
|
||||
jsonData["operations"] = new JsonData();
|
||||
jsonData["operations"].SetJsonType(JsonType.Array);
|
||||
foreach (JsonData operationJsonData in _operationJsonDataList)
|
||||
{
|
||||
jsonData["operations"].Add(operationJsonData);
|
||||
}
|
||||
jsonData["check"] = new JsonData();
|
||||
jsonData["check"]["player"] = new JsonData();
|
||||
jsonData["check"]["player"].SetJsonType(JsonType.Object);
|
||||
jsonData["check"]["enemy"] = new JsonData();
|
||||
jsonData["check"]["enemy"].SetJsonType(JsonType.Object);
|
||||
BattlePlayer battlePlayer = BattleManagerBase.GetIns().BattlePlayer;
|
||||
BattleEnemy battleEnemy = BattleManagerBase.GetIns().BattleEnemy;
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData3 = new JsonData();
|
||||
jsonData3.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData4 = new JsonData();
|
||||
jsonData4.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData5 = new JsonData();
|
||||
jsonData5.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase handCard in battlePlayer.HandCardList)
|
||||
{
|
||||
jsonData2.Add(handCard.GetName());
|
||||
}
|
||||
foreach (BattleCardBase inPlayCard in battlePlayer.InPlayCards)
|
||||
{
|
||||
jsonData3.Add(inPlayCard.GetName());
|
||||
}
|
||||
foreach (BattleCardBase handCard2 in battleEnemy.HandCardList)
|
||||
{
|
||||
jsonData4.Add(handCard2.GetName());
|
||||
}
|
||||
foreach (BattleCardBase inPlayCard2 in battleEnemy.InPlayCards)
|
||||
{
|
||||
jsonData5.Add(inPlayCard2.GetName());
|
||||
}
|
||||
jsonData["check"]["player"]["hand"] = jsonData2;
|
||||
jsonData["check"]["player"]["inplay"] = jsonData3;
|
||||
jsonData["check"]["enemy"]["hand"] = jsonData4;
|
||||
jsonData["check"]["enemy"]["inplay"] = jsonData5;
|
||||
JsonData jsonData6 = new JsonData();
|
||||
jsonData6.SetJsonType(JsonType.Array);
|
||||
foreach (string skillTarget in _skillTargetList)
|
||||
{
|
||||
jsonData6.Add(skillTarget);
|
||||
}
|
||||
if (jsonData6.Count > 0)
|
||||
{
|
||||
jsonData["skill_targets"] = jsonData6;
|
||||
}
|
||||
WriteJsonDataToFile(jsonData);
|
||||
}
|
||||
|
||||
protected override void WriteJsonDataToFile(JsonData jsonData, string overrideFilePath = "")
|
||||
{
|
||||
base.WriteJsonDataToFile(jsonData, string.Empty);
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
using System;
|
||||
using Wizard.Battle.Mulligan;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class AINetworkBattleRecoveryRecordManager : RecoveryRecordManagerBase
|
||||
{
|
||||
protected override string DefaultRecoveryFileName => "recovery_ai_network.json";
|
||||
|
||||
public AINetworkBattleRecoveryRecordManager()
|
||||
{
|
||||
}
|
||||
|
||||
public AINetworkBattleRecoveryRecordManager(string filePath)
|
||||
: base(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE")
|
||||
{
|
||||
base.SetupRecording(battleMgr, battleType, randomSeed, backGroundId, bgmId);
|
||||
RecordAINetworkBattleSettings(_recorder, battleType, randomSeed, backGroundId, bgmId);
|
||||
}
|
||||
|
||||
protected override OperationRecorderBase CreateOperationRecorder()
|
||||
{
|
||||
return new AINetworkBattleOperationRecorder(_recoveryFilePath);
|
||||
}
|
||||
|
||||
protected override void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr)
|
||||
{
|
||||
base.SetupRecorderEvents(operationRecorder, battleMgr);
|
||||
BattlePlayer battlePlayer = battleMgr.BattlePlayer;
|
||||
battlePlayer.OnTurnStartComplete = (Action)Delegate.Combine(battlePlayer.OnTurnStartComplete, new Action(operationRecorder.RecordTurnStart));
|
||||
BattleEnemy battleEnemy = battleMgr.BattleEnemy;
|
||||
battleEnemy.OnTurnStartComplete = (Action)Delegate.Combine(battleEnemy.OnTurnStartComplete, new Action(operationRecorder.RecordTurnStart));
|
||||
battleMgr.OperateMgr.OnTurnEnd += operationRecorder.RecordTurnEnd;
|
||||
}
|
||||
|
||||
public override void SetupMulliganStartTimeRecorderEvent(BattleManagerBase battleMgr)
|
||||
{
|
||||
PlayerMulliganCtrl playerMlgCtrl = battleMgr.MulliganMgr.PlayerMlgCtrl;
|
||||
playerMlgCtrl.OnMulliganLaunchComplete = (Action)Delegate.Combine(playerMlgCtrl.OnMulliganLaunchComplete, new Action(_recorder.RecordMulliganStart));
|
||||
}
|
||||
|
||||
protected void RecordAINetworkBattleSettings(OperationRecorderBase operationRecorder, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId)
|
||||
{
|
||||
DataMgr dataMgr = _gameMgr.GetDataMgr();
|
||||
operationRecorder.RecordBattleType(battleType);
|
||||
operationRecorder.RecordRandomSeed(randomSeed);
|
||||
operationRecorder.RecordBackGroundId(backGroundId);
|
||||
operationRecorder.RecordBgmId(bgmId);
|
||||
operationRecorder.RecordClass("player", dataMgr.GetPlayerClassId());
|
||||
operationRecorder.RecordSubClass("player", dataMgr.GetPlayerSubClassId());
|
||||
if (dataMgr.TryGetPlayerMyRotationInfo(out var myRotationInfo))
|
||||
{
|
||||
operationRecorder.RecordMyRotationId("player", myRotationInfo.Id);
|
||||
}
|
||||
operationRecorder.RecordClass("enemy", dataMgr.GetEnemyClassId());
|
||||
operationRecorder.RecordSubClass("enemy", dataMgr.GetEnemySubClassId());
|
||||
if (dataMgr.TryGetEnemyMyRotationInfo(out var myRotationInfo2))
|
||||
{
|
||||
operationRecorder.RecordMyRotationId("enemy", myRotationInfo2.Id);
|
||||
}
|
||||
operationRecorder.RecordChara("player", dataMgr.GetPlayerCharaId());
|
||||
operationRecorder.RecordChara("enemy", dataMgr.GetEnemyCharaId());
|
||||
operationRecorder.RecordSleeve("player", dataMgr.GetPlayerSleeveId());
|
||||
operationRecorder.RecordSleeve("enemy", dataMgr.GetEnemySleeveId());
|
||||
operationRecorder.RecordDeck("player", 'p', dataMgr.GetCurrentDeckData());
|
||||
operationRecorder.RecordDeck("enemy", 'e', dataMgr.GetCurrentEnemyDeckData());
|
||||
operationRecorder.RecordEnemyAIDifficulty(dataMgr.m_EnemyAIDifficulty);
|
||||
operationRecorder.RecordEnemyAILogicLevel(dataMgr.m_EnemyAILogicLevel);
|
||||
operationRecorder.RecordEnemyAIMaxLife(dataMgr.m_EnemyAIMaxLife);
|
||||
operationRecorder.RecordEnemyAIDeckId(dataMgr.m_EnemyAIDeckId);
|
||||
operationRecorder.RecordEnemyAIStyleId(dataMgr.m_EnemyAIStyleId);
|
||||
operationRecorder.RecordEnemyAIEmoteId(dataMgr.m_EnemyAIEmoteId);
|
||||
operationRecorder.RecordEnemyAIUseInnerEmote(dataMgr.m_EnemyAIUseInnerEmote);
|
||||
operationRecorder.RecordPracticeDifficultyDegreeId(dataMgr.PracticeDifficultyDegreeId);
|
||||
operationRecorder.RecordIsPreBuildDeck(dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck));
|
||||
operationRecorder.RecordIsTrialDeck(dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.TrialDeck));
|
||||
}
|
||||
|
||||
public void RecordChangeAI(string logicName, int operationQueueCount)
|
||||
{
|
||||
if (_recorder is SingleBattleOperationRecorder singleBattleOperationRecorder)
|
||||
{
|
||||
singleBattleOperationRecorder.RecordChangeAI(logicName, operationQueueCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,421 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using LitJson;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class NetworkBattleOperationRecorder : OperationRecorderBase
|
||||
{
|
||||
public NetworkBattleOperationRecorder(string filePath)
|
||||
: base(filePath)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
JsonData operationDataList = RecoveryOperationInfo.ReadRecoveryFile(filePath);
|
||||
SetOperationDataList(operationDataList);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteJsonData();
|
||||
}
|
||||
}
|
||||
|
||||
public override void RecordBattleType(DataMgr.BattleType battleType)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordRandomSeed(int randomSeed)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordBackGroundId(int backGroundId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordBgmId(string bgmId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordClass(string playerName, int clanType)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordSubClass(string playerName, int clanType)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordMyRotationId(string playerName, string myRotationId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordSleeve(string playerName, long sleeveId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordChara(string playerName, int charaId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordDeck(string playerName, char indexHeadChar, IEnumerable<int> cardIds)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIDifficulty(int difficulty)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAILogicLevel(int level)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIMaxLife(int life)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIDeckId(int deckId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIStyleId(int styleId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIEmoteId(int emoteId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordEnemyAIUseInnerEmote(bool useInnerEmote)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordStartTurnIsPlayer(bool startTurnIsPlayer)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordPracticeDifficultyDegreeId(int degreeId)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordIsPreBuildDeck(bool isPreBuildDeck)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordIsTrialDeck(bool isTrialDeck)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordIsDefaultDeck(bool isDefaultDeck)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestStageId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyAiId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyEmblemId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyDegreeId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemyEmotionOverride(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestPlayerEmotionOverride(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestRecoveryPoint(int recoveryPoint)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestPlayerSkillList(List<BossRushSpecialSkill> skills)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestEnemySkill(BossRushSpecialSkill skill)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestMaxBattleCount(int maxBattleCount)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestCurrentWinCount(int currentWinCount)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestIsExtra(bool isExtra)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestIsMockBattle(bool isMockBattle)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordQuestExtraDeckScheduleId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordMissionNecessaryInformation(BattleManagerBase.MissionNecessaryInformation missionNecessaryInformation)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordMulliganStart()
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordPractice3DFieldId(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordPlayerMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase replaceCard in replaceCards)
|
||||
{
|
||||
jsonData2.Add(replaceCard.GetName());
|
||||
}
|
||||
jsonData["operation"] = "mulligan";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["abandoned_cards"] = jsonData2;
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordEnemyMulliganReplaceCards(IEnumerable<BattleCardBase> replaceCards, IEnumerable<int> completeCards)
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordPlay(BattleCardBase card, BattleCardBase originalCard, IEnumerable<BattleCardBase> selectedCards)
|
||||
{
|
||||
if (card.IsPlayer)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "play";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["is_choice_brave"] = (originalCard.IsChoiceBraveSkillCard ? 1 : 0);
|
||||
WriteSkillTargetInfoToJson(selectedCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
}
|
||||
|
||||
public override VfxBase RecordAttack(BattleCardBase attackCard, BattleCardBase targetCard, SkillProcessor skillProcessor)
|
||||
{
|
||||
if (!attackCard.IsPlayer)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "attack";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(attackCard);
|
||||
jsonData["target"] = CardToIndexName(targetCard);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override void RecordEvolve(BattleCardBase originalCard, BattleCardBase card, IEnumerable<BattleCardBase> selectedCards)
|
||||
{
|
||||
if (card.IsPlayer)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "evolve";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
WriteSkillTargetInfoToJson(selectedCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
}
|
||||
|
||||
public override void RecordCompleteFusionSelect(BattleCardBase fusionCard, IEnumerable<BattleCardBase> ingredientCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "comp_fusion";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(fusionCard);
|
||||
WriteSkillTargetInfoToJson(ingredientCards, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordStartFusion(BattleCardBase fusionCard, List<BattleCardBase> selectableCards)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "start_fusion";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(fusionCard);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordSelectFusion(BattleCardBase card)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "select_fusion";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordCancelFusion(BattleCardBase card)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "cancel_fusion";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordStartSelect(BattleCardBase card, bool isEvolve, List<BattleCardBase> selectableCards, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "start_select";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isBurialRite, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "select";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
jsonData["is_burial_rite"] = (isBurialRite ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordCompleteSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isChoiceBrave, bool isBurialRite)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "comp_select";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
jsonData["is_burial_rite"] = (isBurialRite ? 1 : 0);
|
||||
jsonData["is_choice_brave"] = (isChoiceBrave ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordCancelSelect(BattleCardBase actCard, bool isEvolve, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "cancel_select";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordStartChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> choiceCards, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "start_choice";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordCompleteChoice(BattleCardBase card, bool isEvolve, List<BattleCardBase> chosenCardList, BattleCardBase actCard, List<int> chosenCardIndexList, bool hasSelectionSkill, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "comp_choice";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["index"] = CardToIndexName(card);
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
WriteSkillTargetInfoToJson(chosenCardList, jsonData);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordCancelChoice(BattleCardBase card, bool isEvolve, bool isChoiceBrave)
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "cancel_choice";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
jsonData["bool"] = (isEvolve ? 1 : 0);
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordTurnStart()
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordTurnEnd()
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operation"] = "turn_end";
|
||||
jsonData["seq"] = GetCurrentSequenceNumber();
|
||||
_operationJsonDataList.Add(jsonData);
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public override void RecordRetire()
|
||||
{
|
||||
}
|
||||
|
||||
public override void RecordSkillTargets(IEnumerable<BattleCardBase> targetCards)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void WriteJsonData()
|
||||
{
|
||||
JsonData jsonData = new JsonData();
|
||||
jsonData["operations"] = new JsonData();
|
||||
jsonData["operations"].SetJsonType(JsonType.Array);
|
||||
foreach (JsonData operationJsonData in _operationJsonDataList)
|
||||
{
|
||||
jsonData["operations"].Add(operationJsonData);
|
||||
}
|
||||
WriteJsonDataToFile(jsonData);
|
||||
}
|
||||
|
||||
private void SetOperationDataList(JsonData recoveryLogData)
|
||||
{
|
||||
if (recoveryLogData.Keys.Contains("operations"))
|
||||
{
|
||||
JsonData jsonData = recoveryLogData["operations"];
|
||||
for (int i = 0; i < jsonData.Count; i++)
|
||||
{
|
||||
_operationJsonDataList.Add(jsonData[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("operations key is not found in recovery file");
|
||||
}
|
||||
}
|
||||
|
||||
private int GetCurrentSequenceNumber()
|
||||
{
|
||||
if (ToolboxGame.RealTimeNetworkAgent != null)
|
||||
{
|
||||
return ToolboxGame.RealTimeNetworkAgent.GetCurrentSequenceNumber() + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class NetworkBattleRecoveryManager : RecoveryNetworkManagerBase
|
||||
{
|
||||
public override VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func<IEnumerator, Coroutine> startCoroutine)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase UpdateRecovery()
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class NetworkBattleRecoveryRecordManager : RecoveryRecordManagerBase
|
||||
{
|
||||
protected override string DefaultRecoveryFileName => "recovery_network.json";
|
||||
|
||||
protected override OperationRecorderBase CreateOperationRecorder()
|
||||
{
|
||||
return new NetworkBattleOperationRecorder(_recoveryFilePath);
|
||||
}
|
||||
|
||||
protected override void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr)
|
||||
{
|
||||
base.SetupRecorderEvents(operationRecorder, battleMgr);
|
||||
battleMgr.OperateMgr.OnBeforePlayerTurnEnd += operationRecorder.RecordTurnEnd;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,10 @@ using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
// TODO(engine-cleanup-pass2): 18 of 20 methods unrun in baseline
|
||||
// Type: Wizard.Battle.Recovery.NullRecoveryManager
|
||||
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
||||
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
|
||||
@@ -1,392 +1,20 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.RoomMatch;
|
||||
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class RecoveryController
|
||||
{
|
||||
private NetworkBattleManagerBase _networkBattleMgr;
|
||||
|
||||
private List<Coroutine> _recoveryCoroutineList = new List<Coroutine>();
|
||||
|
||||
private Matching _matchingInstance;
|
||||
|
||||
public RecoveryDataHandler RecoveryDataHandlerInstance { get; private set; }
|
||||
|
||||
public bool IsMariganFinished => Data.BattleRecoveryInfo.IsMulliganEnd;
|
||||
|
||||
public RecoveryOperationInfo AIBattleRecoveryData { get; private set; }
|
||||
|
||||
public event Action OnFinishRecoveringData;
|
||||
|
||||
public event Action OnFinishRecoveryLogSync;
|
||||
|
||||
public RecoveryController(RecoveryOperationInfo aiBattleRecoveryData = null)
|
||||
{
|
||||
AIBattleRecoveryData = aiBattleRecoveryData;
|
||||
Format format = Data.CurrentFormat;
|
||||
if (format == Format.Max && GameMgr.GetIns().GetDataMgr().IsDipslayHighRankFormat())
|
||||
{
|
||||
format = PlayerStaticData.HighRankFormat();
|
||||
}
|
||||
PlayerStaticData.LoadUserRankTexture(format);
|
||||
switch (GameMgr.GetIns().GetDataMgr().m_BattleType)
|
||||
{
|
||||
case DataMgr.BattleType.FreeBattle:
|
||||
_matchingInstance = new Matching_Free();
|
||||
break;
|
||||
case DataMgr.BattleType.RankBattle:
|
||||
_matchingInstance = new Matching_RankMatch();
|
||||
break;
|
||||
case DataMgr.BattleType.ColosseumNormal:
|
||||
case DataMgr.BattleType.ColosseumTwoPick:
|
||||
case DataMgr.BattleType.ColosseumHof:
|
||||
case DataMgr.BattleType.ColosseumWindFall:
|
||||
_matchingInstance = new Matching_Colosseum();
|
||||
break;
|
||||
case DataMgr.BattleType.CompetitionNormal:
|
||||
case DataMgr.BattleType.CompetitionTwoPick:
|
||||
_matchingInstance = new Matching_Competition();
|
||||
break;
|
||||
case DataMgr.BattleType.RoomBattle:
|
||||
ResetRoomInfo(NetworkDefine.ServerBattleType.OpenRoom, Data.BattleRecoveryInfo, RoomConnectController.BattleRule.Bo1, Format.Max, TwoPickFormat.None, isOpenDeckRule: false);
|
||||
break;
|
||||
case DataMgr.BattleType.RoomTwoPick:
|
||||
ResetRoomInfo(NetworkDefine.ServerBattleType.RoomTwoPick, Data.BattleRecoveryInfo, Data.BattleRecoveryInfo.BattleParameterInstance.Rule, Format.Max, Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat, isOpenDeckRule: false);
|
||||
break;
|
||||
case DataMgr.BattleType.TwoPickBackdraft:
|
||||
ResetRoomInfo(NetworkDefine.ServerBattleType.RoomTwoPick, Data.BattleRecoveryInfo, RoomConnectController.BattleRule.Bo1, Format.Max, Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat, isOpenDeckRule: false);
|
||||
break;
|
||||
case DataMgr.BattleType.TwoPick:
|
||||
_matchingInstance = new Matching_TwoPick();
|
||||
break;
|
||||
case DataMgr.BattleType.Sealed:
|
||||
_matchingInstance = new Matching_Sealed();
|
||||
break;
|
||||
}
|
||||
ConnectNode();
|
||||
UIManager.GetInstance().StartCoroutine(WaitRealtimeObjectCreateToSetupRecoveryData());
|
||||
}
|
||||
|
||||
private void ResetRoomInfo(NetworkDefine.ServerBattleType battleType, BattleRecoveryInfo battleRecoveryInfo, RoomConnectController.BattleRule roomRule, Format format, TwoPickFormat deckFormatType, bool isOpenDeckRule)
|
||||
{
|
||||
_matchingInstance = new Matching_Room(battleRecoveryInfo._isConventionRoom, battleRecoveryInfo.IsGatheringRoom);
|
||||
(_matchingInstance as Matching_Room).SetBattleParameter(new BattleParameter(battleType, format, deckFormatType, roomRule, isOpenDeckRule));
|
||||
RoomBase.SettingOpponentDispData(!Data.BattleRecoveryInfo.is_owner, Data.BattleRecoveryInfo.opponent_name, Data.BattleRecoveryInfo.opponent_emblem_id, Data.BattleRecoveryInfo.opponent_degree_id, Data.BattleRecoveryInfo.opponent_country_code, Data.BattleRecoveryInfo.opponent_rank, Data.BattleRecoveryInfo.IsOpponentOfficialUser, Data.BattleRecoveryInfo.OpponentHighFormatRank);
|
||||
}
|
||||
|
||||
private IEnumerator WaitRealtimeObjectCreateToSetupRecoveryData()
|
||||
{
|
||||
while (ToolboxGame.RealTimeNetworkAgent == null)
|
||||
{
|
||||
_matchingInstance.UpdateOffLineMatching();
|
||||
yield return null;
|
||||
}
|
||||
ToolboxGame.RealTimeNetworkAgent.IsNotPlayReceivingData = true;
|
||||
SetupRecoveryData();
|
||||
}
|
||||
|
||||
private void SetupRecoveryData()
|
||||
{
|
||||
ParseRecoveryData();
|
||||
OnRecoveryReady();
|
||||
ToolboxGame.RealTimeNetworkAgent.StartRecovery(Data.BattleRecoveryInfo.battle_id.ToString(), Data.BattleRecoveryInfo.Play_seq, Data.BattleRecoveryInfo.Pub_seq);
|
||||
if (!GameMgr.GetIns().IsAINetwork)
|
||||
{
|
||||
_recoveryCoroutineList.Add(UIManager.GetInstance().StartCoroutine(RealtimeOpenToRecoveryStart()));
|
||||
}
|
||||
_recoveryCoroutineList.Add(UIManager.GetInstance().StartCoroutine(WaitTillBattleCreate()));
|
||||
}
|
||||
|
||||
private IEnumerator RealtimeOpenToRecoveryStart()
|
||||
{
|
||||
while (!ToolboxGame.RealTimeNetworkAgent.IsOpen())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
ToolboxGame.RealTimeNetworkAgent.EmitMsgPack(NetworkBattleDefine.NetworkBattleURI.RecoveryStart);
|
||||
}
|
||||
|
||||
private IEnumerator WaitTillBattleCreate()
|
||||
{
|
||||
while (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().SBattleLoad == null || !BattleManagerBase.GetIns().SBattleLoad.isLoadEnd || !ToolboxGame.RealTimeNetworkAgent.IsOpen())
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
RecoveryEndToChangeBattleScene();
|
||||
}
|
||||
|
||||
private void RecoveryEndToChangeBattleScene()
|
||||
{
|
||||
_networkBattleMgr = BattleManagerBase.GetIns() as NetworkBattleManagerBase;
|
||||
ToolboxGame.RealTimeNetworkAgent.SetNetworkBattleMgr(_networkBattleMgr);
|
||||
BattleManagerBase.GetIns().OnStartOpening += delegate
|
||||
{
|
||||
_networkBattleMgr._recoveryController = this;
|
||||
RecoveryDataHandlerInstance = new RecoveryDataHandler(_networkBattleMgr, this.OnFinishRecoveringData, this.OnFinishRecoveryLogSync, AIBattleRecoveryData);
|
||||
RecoveryDataHandlerInstance.OnBattleReceived();
|
||||
};
|
||||
_matchingInstance.GotoBattle();
|
||||
BattleManagerBase.GetIns().SBattleLoad.StartBattleScene();
|
||||
}
|
||||
|
||||
private void RecoveryReturnScene()
|
||||
{
|
||||
if (!_matchingInstance.GetMatchingDataReady())
|
||||
{
|
||||
UIManager.GetInstance().OffViewAll();
|
||||
}
|
||||
ToolboxGame.DestroyNetworkAgent();
|
||||
if (_matchingInstance is Matching_Room)
|
||||
{
|
||||
RoomBase.ResetOpponentData();
|
||||
}
|
||||
if (_matchingInstance.GetMatchingDataReady() && GameMgr.GetIns().GetBattleCtrl() != null)
|
||||
{
|
||||
UIManager.GetInstance().StartCoroutine(BattleEndCoroutin(ChangeScene));
|
||||
return;
|
||||
}
|
||||
UIManager.GetInstance().CloseInSceneLoadingMatching();
|
||||
ChangeScene();
|
||||
}
|
||||
|
||||
private void ChangeScene()
|
||||
{
|
||||
UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam();
|
||||
changeViewSceneParam.OnFinishChangeView = delegate
|
||||
{
|
||||
UIManager.GetInstance().CloseInSceneLoadingMatching();
|
||||
UIManager.GetInstance().CloseInSceneLoadingBattle();
|
||||
};
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam);
|
||||
}
|
||||
|
||||
private IEnumerator BattleEndCoroutin(Action callback)
|
||||
{
|
||||
while (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
SBattleLoad battleLoad = BattleManagerBase.GetIns().SBattleLoad;
|
||||
while (!battleLoad.isLoadEnd)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield return GameMgr.GetIns().GetBattleCtrl().BattleEnd();
|
||||
callback();
|
||||
}
|
||||
|
||||
private void ConnectNode()
|
||||
{
|
||||
MatchingNetworkConnectChecker matchingNetworkConnectCheker = _matchingInstance._matchingNetworkConnectCheker;
|
||||
matchingNetworkConnectCheker.Start();
|
||||
matchingNetworkConnectCheker.OnConnectError = ReturnTitle;
|
||||
string battleId = Data.BattleRecoveryInfo.battle_id.ToString();
|
||||
if (GameMgr.GetIns().GetDataMgr().IsRoomBattleType())
|
||||
{
|
||||
battleId = Data.BattleRecoveryInfo.roomId.ToString();
|
||||
}
|
||||
matchingNetworkConnectCheker.SetBattleId(battleId);
|
||||
matchingNetworkConnectCheker.SetConnectOnly();
|
||||
}
|
||||
|
||||
private void ReturnTitle()
|
||||
{
|
||||
for (int i = 0; i < _recoveryCoroutineList.Count; i++)
|
||||
{
|
||||
Coroutine routine = _recoveryCoroutineList[i];
|
||||
UIManager.GetInstance().StopCoroutine(routine);
|
||||
routine = null;
|
||||
}
|
||||
_recoveryCoroutineList.Clear();
|
||||
SystemText systemText = Data.SystemText;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0012"));
|
||||
dialogBase.SetText(systemText.Get("Error_0012"));
|
||||
dialogBase.AddButton(DialogBase.ButtonType.BackToTitle);
|
||||
dialogBase.SetPanelDepth(6000);
|
||||
dialogBase.SetFadeButtonEnabled(flag: false);
|
||||
dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate
|
||||
{
|
||||
if (_matchingInstance.GetMatchingDataReady() && GameMgr.GetIns().GetBattleCtrl() != null)
|
||||
{
|
||||
UIManager.GetInstance().StartCoroutine(BattleEndCoroutin(SoftwareReset));
|
||||
}
|
||||
else
|
||||
{
|
||||
SoftwareReset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SoftwareReset()
|
||||
{
|
||||
Wizard.SoftwareReset.exec();
|
||||
}
|
||||
|
||||
private void OnRecoveryReady()
|
||||
{
|
||||
UIManager.GetInstance().createInSceneLoadingMatching(notBlack: true);
|
||||
UIManager.GetInstance().closeInSceneLoading();
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
List<int> list = null;
|
||||
list = ((!GameMgr.GetIns().IsAINetwork) ? (from i in GameMgr.GetIns().GetNetworkUserInfoData().GetSelfDeck()
|
||||
select i.CardId).ToList() : AIBattleRecoveryData.SetupInfo.PlayerInfo.DeckCardInfos.Select((DeckCardInfo i) => i?.CardId.Value ?? 100011010).ToList());
|
||||
dataMgr.SetCurrentDeckData(list);
|
||||
dataMgr.SetPlayerCharaId(Data.BattleRecoveryInfo.chara_id);
|
||||
dataMgr.SetPlayerSubClassID(Data.BattleRecoveryInfo.SubClassId);
|
||||
dataMgr.SetPlayerMyRotationInfo(Data.BattleRecoveryInfo.MyRotationId);
|
||||
dataMgr.SetPlayerSleeveId(Data.BattleRecoveryInfo.sleeve_id);
|
||||
dataMgr.SetSelectDeckFormat(Data.BattleRecoveryInfo.deck_format);
|
||||
if (GameMgr.GetIns().IsAINetwork)
|
||||
{
|
||||
List<int> currentEnemyDeckData = AIBattleRecoveryData.SetupInfo.EnemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i?.CardId.Value ?? 100011010).ToList();
|
||||
dataMgr.SetCurrentEnemyDeckData(currentEnemyDeckData);
|
||||
dataMgr.SetEnemyCharaId(AIBattleRecoveryData.SetupInfo.EnemyInfo.CharaId);
|
||||
dataMgr.SetEnemySleeveId(AIBattleRecoveryData.SetupInfo.EnemyInfo.SleeveId);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> currentEnemyDeckData2 = (from i in GameMgr.GetIns().GetNetworkUserInfoData().GetOpponentDeck()
|
||||
select i.CardId).ToList();
|
||||
dataMgr.SetCurrentEnemyDeckData(currentEnemyDeckData2);
|
||||
dataMgr.SetEnemyCharaId(Data.BattleRecoveryInfo.chara_id);
|
||||
dataMgr.SetEnemySubClassID(Data.BattleRecoveryInfo.OpponentSubClassId);
|
||||
dataMgr.SetEnemyMyRotationInfo(Data.BattleRecoveryInfo.OpponentMyRotationId);
|
||||
dataMgr.SetEnemySleeveId(Data.BattleRecoveryInfo.sleeve_id);
|
||||
}
|
||||
int playerClassId = dataMgr.GetPlayerClassId();
|
||||
int selectDeckId = dataMgr.GetSelectDeckId();
|
||||
bool num = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK);
|
||||
_matchingInstance.FirstSetting(playerClassId, selectDeckId, isRecovery: true);
|
||||
if (num && (Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat != TwoPickFormat.Chaos || Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat != TwoPickFormat.BackdraftChaos))
|
||||
{
|
||||
DeckData deckData = new DeckData(Format.Max, DeckAttributeType.TrialDeck);
|
||||
deckData.SetDeckID(selectDeckId);
|
||||
deckData.SetDeckClassID(playerClassId);
|
||||
deckData.SetCardIdList(list);
|
||||
deckData.SetDeckName(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_NAME_TRIALDECK));
|
||||
dataMgr.SetSelectDeckId(deckData.GetDeckID());
|
||||
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.TrialDeck;
|
||||
dataMgr.SetPlayerCharaIdBySkinId(deckData.GetSkinId());
|
||||
}
|
||||
else if (dataMgr.IsTwoPickBattleType())
|
||||
{
|
||||
DeckData deckData2 = new DeckData();
|
||||
deckData2.SetDeckID(0);
|
||||
deckData2.SetDeckClassID(playerClassId);
|
||||
deckData2.SetDeckSleeveID(3000011L);
|
||||
deckData2.SetDeckName(GameMgr.GetIns().GetDataMgr().GetClanNameByKey(playerClassId));
|
||||
deckData2.SetCardIdList(list);
|
||||
dataMgr.SetSelectDeckId(deckData2.GetDeckID());
|
||||
dataMgr.LastSelectDeckAttributeType = DeckAttributeType.Invalid;
|
||||
dataMgr.SetPlayerCharaIdBySkinId(Data.BattleRecoveryInfo.chara_id);
|
||||
dataMgr._roomTwoPickDeckData = deckData2;
|
||||
if (dataMgr.m_BattleType == DataMgr.BattleType.TwoPickBackdraft)
|
||||
{
|
||||
Data.RoomTwoPickInfo.deckData.classId = dataMgr.GetEnemyClassId();
|
||||
dataMgr._roomTwoPickDeckData.SetDeckClassID(dataMgr.GetEnemyClassId());
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.RoomTwoPickInfo.deckData.classId = playerClassId;
|
||||
}
|
||||
Data.RoomTwoPickInfo.deckData.entryId = 0;
|
||||
Data.RoomTwoPickInfo.deckData.isSelectCompleted = true;
|
||||
Data.RoomTwoPickInfo.deckData.cardIds = deckData2.GetCardIdList().ToArray();
|
||||
Data.RoomTwoPickBeforeBattleInfo.SetSelfClassIdTwoPickDraftData(playerClassId);
|
||||
if (Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat == TwoPickFormat.Chaos || Data.BattleRecoveryInfo.BattleParameterInstance.TwoPickFormat == TwoPickFormat.BackdraftChaos)
|
||||
{
|
||||
CandidateChaos candidateChaos = Data.RoomTwoPickInfo.CandidateChaos;
|
||||
candidateChaos.SelectedChaosId = Data.BattleRecoveryInfo.ChaosId;
|
||||
candidateChaos.SelectedCharaId = Data.BattleRecoveryInfo.chara_id;
|
||||
candidateChaos.SelectedClassId = Data.BattleRecoveryInfo.class_id;
|
||||
}
|
||||
}
|
||||
if ((bool)ToolboxGame.RealTimeNetworkAgent)
|
||||
{
|
||||
CustomPreference.SetNodeServerURL(Data.BattleRecoveryInfo.node_server_url);
|
||||
}
|
||||
}
|
||||
|
||||
private int DecideFirstUser(int id)
|
||||
{
|
||||
if (id == PlayerStaticData.UserViewerID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private bool IsPlayer(int id)
|
||||
{
|
||||
if (id == PlayerStaticData.UserViewerID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ParseRecoveryData()
|
||||
{
|
||||
int first_turn = Data.BattleRecoveryInfo.first_turn;
|
||||
GameMgr.GetIns().GetNetworkUserInfoData().TurnState = DecideFirstUser(first_turn);
|
||||
Dictionary<string, object> info = ParseData(isPlayer: true);
|
||||
Dictionary<string, object> info2 = ParseData(isPlayer: false);
|
||||
GameMgr.GetIns().SettingSelfInfo(info, isWatchReplayRecovery: true);
|
||||
GameMgr.GetIns().SettingOpponentInfo(info2, isWatchReplayRecovery: true);
|
||||
GameMgr.GetIns().GetNetworkUserInfoData().SetSelfDeck(Data.BattleRecoveryInfo.deck);
|
||||
}
|
||||
|
||||
private Dictionary<string, object> ParseData(bool isPlayer)
|
||||
{
|
||||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||
dictionary.Add("fieldId", Data.BattleRecoveryInfo.field_id);
|
||||
dictionary.Add("seed", Data.BattleRecoveryInfo.seed);
|
||||
if (isPlayer)
|
||||
{
|
||||
dictionary.Add("viewerId", Data.BattleRecoveryInfo.viewer_id);
|
||||
dictionary.Add("oppoId", Data.BattleRecoveryInfo.opponent_viewer_id);
|
||||
dictionary.Add("charaId", Data.BattleRecoveryInfo.chara_id);
|
||||
dictionary.Add("classId", Data.BattleRecoveryInfo.class_id);
|
||||
dictionary.Add("sleeveId", Data.BattleRecoveryInfo.sleeve_id);
|
||||
dictionary.Add("rank", Data.BattleRecoveryInfo.rank);
|
||||
dictionary.Add("degreeId", Data.BattleRecoveryInfo.degree_id);
|
||||
dictionary.Add("emblemId", Data.BattleRecoveryInfo.emblem_id);
|
||||
dictionary.Add("country_code", Data.BattleRecoveryInfo.country_code);
|
||||
dictionary.Add("userName", Data.BattleRecoveryInfo.name);
|
||||
dictionary.Add("isOfficial", Data.BattleRecoveryInfo.IsOfficialUser);
|
||||
dictionary.Add("chaosId", Data.BattleRecoveryInfo.ChaosId);
|
||||
dictionary.Add("subclassId", Data.BattleRecoveryInfo.SubClassId);
|
||||
dictionary.Add("rotationId", Data.BattleRecoveryInfo.MyRotationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionary.Add("viewerId", Data.BattleRecoveryInfo.viewer_id);
|
||||
dictionary.Add("charaId", Data.BattleRecoveryInfo.opponent_chara_id);
|
||||
dictionary.Add("classId", Data.BattleRecoveryInfo.opponent_class_id);
|
||||
dictionary.Add("sleeveId", Data.BattleRecoveryInfo.opponent_sleeve_id);
|
||||
dictionary.Add("rank", Data.BattleRecoveryInfo.opponent_rank);
|
||||
dictionary.Add("degreeId", Data.BattleRecoveryInfo.opponent_degree_id);
|
||||
dictionary.Add("emblemId", Data.BattleRecoveryInfo.opponent_emblem_id);
|
||||
dictionary.Add("country_code", Data.BattleRecoveryInfo.opponent_country_code);
|
||||
dictionary.Add("userName", Data.BattleRecoveryInfo.opponent_name);
|
||||
dictionary.Add("battlePoint", Data.BattleRecoveryInfo.opponent_battle_point);
|
||||
dictionary.Add("isMasterRank", Data.BattleRecoveryInfo.is_opponent_master_rank);
|
||||
dictionary.Add("masterPoint", Data.BattleRecoveryInfo.opponent_master_point);
|
||||
dictionary.Add("isOfficial", Data.BattleRecoveryInfo.IsOpponentOfficialUser);
|
||||
dictionary.Add("chaosId", Data.BattleRecoveryInfo.OpponentChaosId);
|
||||
dictionary.Add("subclassId", Data.BattleRecoveryInfo.OpponentSubClassId);
|
||||
dictionary.Add("rotationId", Data.BattleRecoveryInfo.OpponentMyRotationId);
|
||||
}
|
||||
dictionary.Add("isChaosSkinOverride", Data.BattleRecoveryInfo.IsChaosSkinOverride);
|
||||
return dictionary;
|
||||
}
|
||||
}
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
// PASS-5 STUB: full body dropped. RecoveryController is client-side coroutine machinery
|
||||
// (Matching_*, RoomConnectController.BattleRule, RoomBase.SettingOpponentDispData etc.)
|
||||
// that never runs in the headless node — nothing constructs it (RecoveryNetworkBattleMgr-
|
||||
// ContentsCreator was deleted in this pass). The type must still exist as a compile-time
|
||||
// reference because:
|
||||
// 1. NetworkBattleManagerBase.cs:96 declares `public RecoveryController _recoveryController;`
|
||||
// as a field that is always null in the node context.
|
||||
// 2. RecoveryOperationCollection.cs:42 dereferences that field via
|
||||
// `_recoveryController.RecoveryDataHandlerInstance.OnCompleteRecovery` on the
|
||||
// IsRecovery=true headless path — the resulting NRE is the pinned failure that
|
||||
// Spellboost_play_resolution_under_random_draw_plus_spin and Capture_replay_reproduces_
|
||||
// post_mulligan_divergence rely on as their expected divergence signal.
|
||||
// 3. RecoveryDataHandler.cs (also stubbed this pass) touches _recoveryController.IsMariganFinished.
|
||||
// The two surface members below are the entire external contract.
|
||||
public class RecoveryController
|
||||
{
|
||||
public RecoveryDataHandler RecoveryDataHandlerInstance => null;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,6 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
|
||||
protected Action EndRecoveryEvent;
|
||||
|
||||
protected RecoveryController _recoveryController;
|
||||
|
||||
public DataMgr.BattleType BattleType => _operationInfo.BattleType;
|
||||
|
||||
public bool? DidPlayerGoFirst => _operationInfo.SetupInfo.DidPlayerGoFirst;
|
||||
@@ -95,7 +93,7 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate
|
||||
{
|
||||
failedRecoveryFlag = false;
|
||||
UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd());
|
||||
/* Pre-Phase-5b: BattleCtrl.BattleEnd stubbed */
|
||||
});
|
||||
failedRecoveryFlag = true;
|
||||
RecoveryRecordManagerBase.DeleteRecoveryFile();
|
||||
@@ -119,7 +117,7 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
{
|
||||
try
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
DataMgr dataMgr = null; // Pre-Phase-5b: DataMgr not reachable headless
|
||||
dataMgr.m_BattleType = _operationInfo.BattleType;
|
||||
SetupConditionInfo setupInfo = _operationInfo.SetupInfo;
|
||||
BattleConditionPlayerInfo playerInfo = setupInfo.PlayerInfo;
|
||||
@@ -200,8 +198,6 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract List<int> CreateEnemyDeckIDList(BattleConditionEnemyInfo enemyInfo);
|
||||
|
||||
public abstract VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func<IEnumerator, Coroutine> startCoroutine);
|
||||
|
||||
public abstract VfxBase UpdateRecovery();
|
||||
@@ -215,7 +211,7 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
EndDataRecovery();
|
||||
return SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().StartCoroutine(FontChanger.FontChange(null));
|
||||
/* Pre-Phase-5b: FontChanger UI-only */
|
||||
}), ParallelVfxPlayer.Create(battlePlayer.BattleView.RecoveryMulligan(), battleEnemy.BattleView.RecoveryMulligan()), InstantVfx.Create(delegate
|
||||
{
|
||||
EndRecoveryEvent.Call();
|
||||
@@ -232,50 +228,4 @@ public abstract class RecoveryManagerBase : IRecoveryManager
|
||||
_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public abstract class RecoveryNetworkManagerBase : IRecoveryManager
|
||||
{
|
||||
protected readonly RecoveryOperationInfo _operationInfo;
|
||||
|
||||
protected bool _needUpdate;
|
||||
|
||||
private readonly Queue<string> _skillTargetNameQueue;
|
||||
|
||||
protected Action StartRecoveryEvent;
|
||||
|
||||
protected Action EndDataRecoveryEvent;
|
||||
|
||||
protected Action EndRecoveryEvent;
|
||||
|
||||
public DataMgr.BattleType BattleType => _operationInfo.BattleType;
|
||||
|
||||
public bool? DidPlayerGoFirst => Data.BattleRecoveryInfo.first_turn == PlayerStaticData.UserViewerID;
|
||||
|
||||
public int RandomSeed => Data.BattleRecoveryInfo.seed;
|
||||
|
||||
public bool HasMulliganInfo => false;
|
||||
|
||||
public int BackGroundId => Data.BattleRecoveryInfo.field_id;
|
||||
|
||||
public string BgmId => "NONE";
|
||||
|
||||
public long RecordTime => long.Parse(DateTime.Now.ToLongTimeString());
|
||||
|
||||
public int IdxChangeSeed => Data.BattleRecoveryInfo.IdxChangeSeed;
|
||||
|
||||
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 RecoveryNetworkManagerBase()
|
||||
{
|
||||
}
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
dataMgr.SetPlayerCharaId(Data.BattleRecoveryInfo.chara_id);
|
||||
dataMgr.SetEnemyCharaId(Data.BattleRecoveryInfo.opponent_chara_id);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public virtual string RecoveryPopSkillTargetCardName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,6 @@ public abstract class RecoveryRecordManagerBase : IRecoveryRecordManager
|
||||
|
||||
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()
|
||||
@@ -44,7 +38,7 @@ public abstract class RecoveryRecordManagerBase : IRecoveryRecordManager
|
||||
public virtual void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE")
|
||||
{
|
||||
Directory.CreateDirectory(OperationRecorderBase.RecordDirectoryPath);
|
||||
_gameMgr = GameMgr.GetIns();
|
||||
_gameMgr = null; // Pre-Phase-5b: GameMgr not reachable in ctor headless
|
||||
_battleType = battleType;
|
||||
_recorder = CreateOperationRecorder();
|
||||
SetupRecorderEvents(_recorder, battleMgr);
|
||||
@@ -81,90 +75,11 @@ public abstract class RecoveryRecordManagerBase : IRecoveryRecordManager
|
||||
}
|
||||
}
|
||||
|
||||
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"))
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SetupConditionInfo : BattleConditionInfo
|
||||
QuestExtraDeckScheduleId = jsonData.ToIntOrDefault("quest_extra_deck_schedule_id", 0);
|
||||
if ((battleType == DataMgr.BattleType.Story || DataMgr.IsQuestBattleType(battleType)) && jsonData.HasKey("story_special_battle_player_attach_skill"))
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().SetSpecialBattleSetting(DidPlayerGoFirst, jsonData.ToStringOrDefault("story_special_battle_player_attach_skill", string.Empty), jsonData.ToStringOrDefault("story_special_battle_enemy_attach_skill", string.Empty), jsonData.ToIntOrDefault("story_special_battle_player_start_pp", 0), jsonData.ToIntOrDefault("story_special_battle_enemy_start_pp", 0), jsonData.ToIntOrDefault("story_special_battle_player_current_life", 0), jsonData.ToIntOrDefault("story_special_battle_player_start_life", 0), jsonData.ToIntOrDefault("story_special_battle_enemy_start_life", 0), jsonData.ToStringOrDefault("story_special_battle_id_override_in_battle_log", string.Empty), jsonData.ToStringOrDefault("story_special_battle_id", string.Empty), jsonData.ToStringOrDefault("story_special_battle_banish_effect_override", string.Empty), jsonData.ToStringOrDefault("story_special_battle_token_draw_effect_override", string.Empty), jsonData.ToStringOrDefault("story_special_battle_special_token_draw_effect_override", string.Empty), jsonData.ToIntOrDefault("story_special_battle_skip_result", 0));
|
||||
/* Pre-Phase-5b: SetSpecialBattleSetting is Story/Quest-only; headless is PvP-only */
|
||||
}
|
||||
if (battleType == DataMgr.BattleType.BossRushQuest)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public class SetupConditionInfo : BattleConditionInfo
|
||||
switch (battleType)
|
||||
{
|
||||
case DataMgr.BattleType.Practice:
|
||||
GameMgr.GetIns().GetDataMgr().Practice3DfieldId = jsonData.ToIntOrDefault("practice_3d_field_id", 0);
|
||||
/* Pre-Phase-5b: Practice3DfieldId is Practice-only; headless is PvP-only */
|
||||
break;
|
||||
case DataMgr.BattleType.Story:
|
||||
StoryRecoveryData = new StoryRecoveryData(jsonData);
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SingleBattleOperationRecorder : OperationRecorderBase
|
||||
_setupJsonData["player"].SetJsonType(JsonType.Object);
|
||||
_setupJsonData["enemy"] = new JsonData();
|
||||
_setupJsonData["enemy"].SetJsonType(JsonType.Object);
|
||||
DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo;
|
||||
DataMgr.SpecialBattleSetting specialBattleSettingInfo = null; // Pre-Phase-5b: SpecialBattleSettingInfo headless-null
|
||||
if (specialBattleSettingInfo != null)
|
||||
{
|
||||
RecordSpecialBattleSetting(specialBattleSettingInfo);
|
||||
@@ -30,11 +30,6 @@ public class SingleBattleOperationRecorder : OperationRecorderBase
|
||||
WriteJsonData();
|
||||
}
|
||||
|
||||
public void ClearTempRecoveryFilePath()
|
||||
{
|
||||
_tempRecoveryFilePath = string.Empty;
|
||||
}
|
||||
|
||||
public override void RecordBattleType(DataMgr.BattleType battleType)
|
||||
{
|
||||
_battleType = battleType;
|
||||
@@ -491,7 +486,7 @@ public class SingleBattleOperationRecorder : OperationRecorderBase
|
||||
_setupJsonData["story_special_battle_banish_effect_override"] = setting.BanishEffectOverRideText;
|
||||
_setupJsonData["story_special_battle_token_draw_effect_override"] = setting.TokenDrawEffectOverrideText;
|
||||
_setupJsonData["story_special_battle_special_token_draw_effect_override"] = setting.SpecialTokenDrawEffectOverrideText;
|
||||
_setupJsonData["story_special_battle_skip_result"] = (int)GameMgr.GetIns().GetDataMgr().SkipStorySpecialBattleResult;
|
||||
_setupJsonData["story_special_battle_skip_result"] = 0; // Pre-Phase-5b: SkipStorySpecialBattleResult headless-0
|
||||
WriteJsonData();
|
||||
}
|
||||
}
|
||||
@@ -530,32 +525,11 @@ public class SingleBattleOperationRecorder : OperationRecorderBase
|
||||
jsonData["check"]["player"].SetJsonType(JsonType.Object);
|
||||
jsonData["check"]["enemy"] = new JsonData();
|
||||
jsonData["check"]["enemy"].SetJsonType(JsonType.Object);
|
||||
BattlePlayer battlePlayer = BattleManagerBase.GetIns().BattlePlayer;
|
||||
BattleEnemy battleEnemy = BattleManagerBase.GetIns().BattleEnemy;
|
||||
JsonData jsonData2 = new JsonData();
|
||||
jsonData2.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData3 = new JsonData();
|
||||
jsonData3.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData4 = new JsonData();
|
||||
jsonData4.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData5 = new JsonData();
|
||||
jsonData5.SetJsonType(JsonType.Array);
|
||||
foreach (BattleCardBase handCard in battlePlayer.HandCardList)
|
||||
{
|
||||
jsonData2.Add(handCard.GetName());
|
||||
}
|
||||
foreach (BattleCardBase inPlayCard in battlePlayer.InPlayCards)
|
||||
{
|
||||
jsonData3.Add(inPlayCard.GetName());
|
||||
}
|
||||
foreach (BattleCardBase handCard2 in battleEnemy.HandCardList)
|
||||
{
|
||||
jsonData4.Add(handCard2.GetName());
|
||||
}
|
||||
foreach (BattleCardBase inPlayCard2 in battleEnemy.InPlayCards)
|
||||
{
|
||||
jsonData5.Add(inPlayCard2.GetName());
|
||||
}
|
||||
// Pre-Phase-5b: check-block state snapshot dropped headless (no mgr in scope in WriteJsonData)
|
||||
JsonData jsonData2 = new JsonData(); jsonData2.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData3 = new JsonData(); jsonData3.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData4 = new JsonData(); jsonData4.SetJsonType(JsonType.Array);
|
||||
JsonData jsonData5 = new JsonData(); jsonData5.SetJsonType(JsonType.Array);
|
||||
jsonData["check"]["player"]["hand"] = jsonData2;
|
||||
jsonData["check"]["player"]["inplay"] = jsonData3;
|
||||
jsonData["check"]["enemy"]["hand"] = jsonData4;
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Mulligan;
|
||||
using Wizard.Battle.Operation;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class SingleBattleRecoveryManager : RecoveryManagerBase
|
||||
{
|
||||
protected BattlePlayer _battlePlayer;
|
||||
|
||||
protected BattleEnemy _battleEnemy;
|
||||
|
||||
protected IEnumerable<IOperationCommand> _commands;
|
||||
|
||||
protected bool _isBeforeFramePlayerTurn = true;
|
||||
|
||||
private EnemyAI ai;
|
||||
|
||||
public SingleBattleRecoveryManager(string filePath)
|
||||
: base(filePath)
|
||||
{
|
||||
}
|
||||
|
||||
protected override List<int> CreateEnemyDeckIDList(BattleConditionEnemyInfo enemyInfo)
|
||||
{
|
||||
return enemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList();
|
||||
}
|
||||
|
||||
public override VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func<IEnumerator, Coroutine> startCoroutine)
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
ins.IsPreRecovery = true;
|
||||
_battlePlayer = battlePlayer;
|
||||
_battleEnemy = battleEnemy;
|
||||
ai = BattleManagerBase.GetIns().EnemyAI as EnemyAI;
|
||||
_ = ai;
|
||||
_battleEnemy.EnableEnemyAI = false;
|
||||
_battlePlayer.Emotion.Enable = false;
|
||||
_battleEnemy.Emotion.Enable = false;
|
||||
BattleManagerBase.GetIns().SetupEvolCount(_operationInfo.SetupInfo.DidPlayerGoFirst);
|
||||
SingleMulliganMgr singleMulliganMgr = new SingleMulliganMgr();
|
||||
MulliganInfoControl component = GameMgr.GetIns().GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/MulliganInfo")
|
||||
.GetComponent<MulliganInfoControl>();
|
||||
singleMulliganMgr.InitMulligan(component, battlePlayer.PlayerBattleView);
|
||||
StartRecoveryEvent.Call();
|
||||
if (!base.HasMulliganInfo)
|
||||
{
|
||||
EndDataRecoveryEvent.Call();
|
||||
EndRecoveryEvent.Call();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
SkillProcessor skillProcessor = new SkillProcessor();
|
||||
singleMulliganMgr.MulliganStartDraw(_operationInfo.SetupInfo.DidPlayerGoFirst, skillProcessor);
|
||||
foreach (int playerMulliganReplaceCard in _operationInfo.SetupInfo.PlayerMulliganReplaceCards)
|
||||
{
|
||||
int cardIndex = playerMulliganReplaceCard;
|
||||
BattleCardBase battleCardBase = battlePlayer.HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == cardIndex);
|
||||
if (battleCardBase != null)
|
||||
{
|
||||
singleMulliganMgr.AbandonList.Add(battleCardBase);
|
||||
}
|
||||
}
|
||||
singleMulliganMgr.Submit(BattleManagerBase.GetIns());
|
||||
singleMulliganMgr.GetMulliganInfo().SetPlayerReady();
|
||||
_commands = _operationInfo.ActionCommands;
|
||||
_needUpdate = true;
|
||||
ins.IsPreRecovery = false;
|
||||
ins.IsRecovery = true;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase UpdateRecovery()
|
||||
{
|
||||
if (!_needUpdate)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
if (_isBeforeFramePlayerTurn)
|
||||
{
|
||||
_ = _battleEnemy.IsSelfTurn;
|
||||
}
|
||||
if (_battleEnemy.IsSelfTurn)
|
||||
{
|
||||
foreach (BattleCardBase handCard in _battleEnemy.HandCardList)
|
||||
{
|
||||
handCard.SetOnDraw(draw: false);
|
||||
}
|
||||
}
|
||||
_isBeforeFramePlayerTurn = _battlePlayer.IsSelfTurn;
|
||||
IOperationCommand operationCommand = _commands.FirstOrDefault();
|
||||
if (operationCommand != null)
|
||||
{
|
||||
if (ai != null)
|
||||
{
|
||||
ai.UpdateAICurrentVirtualField();
|
||||
}
|
||||
operationCommand.Operation(ins);
|
||||
}
|
||||
_commands = _commands.Skip(1);
|
||||
if (_commands.Any() || _commands is TurnEndOperationCommand)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
if (ins is SingleBattleMgr)
|
||||
{
|
||||
((SingleBattleMgr)ins).LifeZeroActivateLeonSkillIfNeeded();
|
||||
}
|
||||
if (ai != null)
|
||||
{
|
||||
ai.UpdateAICurrentVirtualField();
|
||||
}
|
||||
EndDataRecovery();
|
||||
RecoveryTurnStartPanel();
|
||||
_battlePlayer.PlayerBattleView.ClearPlayQueue();
|
||||
if (_battlePlayer.IsSelfTurn)
|
||||
{
|
||||
_battlePlayer.TurnStartEffectEnd();
|
||||
_battlePlayer._isPlayerActive = true;
|
||||
}
|
||||
_battleEnemy.BattleEnemyView.ClearPlayQueue();
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().StartCoroutine(FontChanger.FontChange(null));
|
||||
}), _battlePlayer.BattleView.Recovery(_operationInfo.SetupInfo.DidPlayerGoFirst, _battlePlayer.HandCardList.Count > 0), _battleEnemy.BattleView.Recovery(!_operationInfo.SetupInfo.DidPlayerGoFirst), _battlePlayer.Recovery(), _battleEnemy.Recovery());
|
||||
string path = GameMgr.GetIns().GetDataMgr().GetPlayerSkinId()
|
||||
.ToString("00");
|
||||
string path2 = GameMgr.GetIns().GetDataMgr().GetEnemySkinId()
|
||||
.ToString("00");
|
||||
parallelVfxPlayer.Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ClassCharaBase)));
|
||||
parallelVfxPlayer.Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.ClassCharaBase)));
|
||||
IBattlePlayerView battlePlayerView = (_battleEnemy.IsSelfTurn ? _battleEnemy.BattleView : _battlePlayer.BattleView);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
sequentialVfxPlayer.Register(HandViewBase.CreateHideCardMeshesVfx(_battleEnemy.HandCardList));
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
_battleEnemy.EnableEnemyAI = true;
|
||||
_battlePlayer.Emotion.Enable = true;
|
||||
_battleEnemy.Emotion.Enable = true;
|
||||
ResetLeaderAnimation(_battlePlayer, _battleEnemy);
|
||||
_battlePlayer.UpdateHandCardsPlayability();
|
||||
Dump(_battlePlayer, _battleEnemy);
|
||||
EndRecoveryEvent.Call();
|
||||
}));
|
||||
sequentialVfxPlayer.Register(battlePlayerView.RecoveryTurnStart());
|
||||
ins.IsRecovery = false;
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public SetupConditionInfo GetSetupConditionInfo()
|
||||
{
|
||||
if (_operationInfo == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _operationInfo.SetupInfo;
|
||||
}
|
||||
|
||||
public void CreateRecoveryFileFromTempFile()
|
||||
{
|
||||
if (SingleBattleRecoveryRecordManager.IsExistsTempSingleRecoveryFile())
|
||||
{
|
||||
string recordDirectoryPath = OperationRecorderBase.RecordDirectoryPath;
|
||||
string sourceFileName = recordDirectoryPath + "temp_recovery_single.json";
|
||||
string destFileName = recordDirectoryPath + "recovery_single.json";
|
||||
File.Copy(sourceFileName, destFileName, overwrite: true);
|
||||
SingleBattleRecoveryRecordManager.DeleteTempRecoveryFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ namespace Wizard.Battle.Recovery;
|
||||
|
||||
public class SingleBattleRecoveryRecordManager : RecoveryRecordManagerBase
|
||||
{
|
||||
public const string TEMP_RECOVERY_SINGLE_FILE_NAME = "temp_recovery_single.json";
|
||||
|
||||
protected override string DefaultRecoveryFileName => "recovery_single.json";
|
||||
|
||||
@@ -34,19 +33,6 @@ public class SingleBattleRecoveryRecordManager : RecoveryRecordManagerBase
|
||||
return new SingleBattleOperationRecorder(_recoveryFilePath);
|
||||
}
|
||||
|
||||
public static void DeleteTempRecoveryFile()
|
||||
{
|
||||
if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json"))
|
||||
{
|
||||
File.Delete(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json");
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearRecoderTempFilePath()
|
||||
{
|
||||
((SingleBattleOperationRecorder)_recorder).ClearTempRecoveryFilePath();
|
||||
}
|
||||
|
||||
protected override void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr)
|
||||
{
|
||||
base.SetupRecorderEvents(operationRecorder, battleMgr);
|
||||
@@ -138,9 +124,4 @@ public class SingleBattleRecoveryRecordManager : RecoveryRecordManagerBase
|
||||
singleBattleOperationRecorder.RecordChangeAI(logicName, operationQueueCount);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsExistsTempSingleRecoveryFile()
|
||||
{
|
||||
return File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user