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>
233 lines
7.9 KiB
C#
233 lines
7.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
using Wizard.Battle.View;
|
|
using Wizard.RoomMatch;
|
|
|
|
namespace Wizard;
|
|
|
|
public class AvatarAbilityDetailDialog : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
private UITexture _characterTexture;
|
|
|
|
[SerializeField]
|
|
private UILabel _characterName;
|
|
|
|
[SerializeField]
|
|
private UILabel _characterHBP;
|
|
|
|
[SerializeField]
|
|
private UISprite _classIcon;
|
|
|
|
[SerializeField]
|
|
private GameObject _itemRoot;
|
|
|
|
[SerializeField]
|
|
private UILabel _passiveAbilityDescLabel;
|
|
|
|
[SerializeField]
|
|
private List<UILabel> _abilityDescLabel = new List<UILabel>();
|
|
|
|
[SerializeField]
|
|
private GameObject _passiveKeyWordCollider;
|
|
|
|
[SerializeField]
|
|
private List<GameObject> _keyWordCollider = new List<GameObject>();
|
|
|
|
[SerializeField]
|
|
private List<UIWidget> _abilityItemRoot = new List<UIWidget>();
|
|
|
|
[SerializeField]
|
|
private UIWidget _passiveAbilityRoot;
|
|
|
|
[SerializeField]
|
|
private GameObject _thirdUnderLine;
|
|
|
|
[SerializeField]
|
|
private List<UILabel> _costLabel = new List<UILabel>();
|
|
|
|
[SerializeField]
|
|
private List<UILabel> _signLabel = new List<UILabel>();
|
|
|
|
[SerializeField]
|
|
private UIScrollView _scrollView;
|
|
|
|
private DeckData _deckData;
|
|
|
|
private AvatarBattleInfo _avatarBattleInfo;
|
|
|
|
private static DialogBase _avatarAbilityDialog;
|
|
|
|
private static DialogBase _keywordDialog;
|
|
|
|
private List<string> _loadList = new List<string>();
|
|
|
|
public static void Create(AvatarBattleInfo avatarBattleInfo, DeckData deck)
|
|
{
|
|
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/AvatarAbilityDetailDialog")) as GameObject;
|
|
string titleLabel = Data.SystemText.Get("HeroesBattle_0006");
|
|
_avatarAbilityDialog = UIManager.GetInstance().CreateDialogClose();
|
|
_avatarAbilityDialog.SetTitleLabel(titleLabel);
|
|
_avatarAbilityDialog.SetSize(DialogBase.Size.L);
|
|
_avatarAbilityDialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
|
_avatarAbilityDialog.SetObj(gameObject);
|
|
gameObject.GetComponent<AvatarAbilityDetailDialog>().Initialize(avatarBattleInfo, deck);
|
|
}
|
|
|
|
private void Initialize(AvatarBattleInfo avatarBattleInfo, DeckData deck)
|
|
{
|
|
_deckData = deck;
|
|
_avatarBattleInfo = avatarBattleInfo;
|
|
_itemRoot.SetActive(value: false);
|
|
RoomBase.StartDialogLoading();
|
|
UIManager.GetInstance().createInSceneCenterLoading();
|
|
StartCoroutine(LoadResources(deck.GetSkinId(), delegate
|
|
{
|
|
StartCoroutine(SetResources());
|
|
}));
|
|
}
|
|
|
|
private IEnumerator SetResources()
|
|
{
|
|
ClassCharacterMasterData charaPrmByCharaId = null; // Pre-Phase-5b: no chara master headless
|
|
InitializeClassCharacter(_deckData.GetSkinId());
|
|
InitializeDescLabel(_avatarBattleInfo);
|
|
_characterName.text = charaPrmByCharaId.chara_name;
|
|
_characterHBP.text = _avatarBattleInfo.Bonus.BattleStartFirstPlayerTurnBp.ToString();
|
|
ClassCharaPrm.SetClassLabelSetting(_characterName, charaPrmByCharaId.clan);
|
|
_classIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaPrmByCharaId.clan);
|
|
_itemRoot.SetActive(value: true);
|
|
yield return null;
|
|
_scrollView.GetComponent<FlexibleGrid>().Reposition();
|
|
_scrollView.ResetPosition();
|
|
UIManager.GetInstance().closeInSceneCenterLoading();
|
|
RoomBase.FinishDiloagLoading();
|
|
}
|
|
|
|
private void InitializeDescLabel(AvatarBattleInfo avatarBattleInfo)
|
|
{
|
|
string allAbilityText = avatarBattleInfo.Bonus.PassiveAbilityDesc;
|
|
string[] abilityDesc = avatarBattleInfo.Bonus.AbilityDesc;
|
|
foreach (string text in abilityDesc)
|
|
{
|
|
allAbilityText += text;
|
|
}
|
|
if (avatarBattleInfo.Bonus.PassiveAbilityDesc == string.Empty)
|
|
{
|
|
_passiveAbilityRoot.gameObject.SetActive(value: false);
|
|
_passiveAbilityRoot.transform.localPosition = new Vector3(0f, 140f, 0f);
|
|
}
|
|
else
|
|
{
|
|
_passiveAbilityDescLabel.SetWrapText(BattleCardBase.ConvertSkillDescriptionText(avatarBattleInfo.Bonus.PassiveAbilityDesc));
|
|
UIEventListener.Get(_passiveAbilityDescLabel.gameObject).onClick = delegate
|
|
{
|
|
OnClickDescLabel(allAbilityText, _passiveAbilityDescLabel);
|
|
};
|
|
UIEventListener.Get(_passiveKeyWordCollider).onPress = delegate(GameObject g, bool b)
|
|
{
|
|
BattlePlayerView.PressKeyWordColorChange(_passiveAbilityDescLabel, b);
|
|
};
|
|
UIEventListener.Get(_passiveKeyWordCollider).onDragStart = delegate
|
|
{
|
|
BattlePlayerView.SetKeyWordLabelColor(_passiveAbilityDescLabel);
|
|
};
|
|
_passiveAbilityRoot.height = _passiveAbilityDescLabel.height;
|
|
_passiveAbilityDescLabel.GetComponent<BoxCollider>().size = new Vector3(_passiveAbilityRoot.localSize.x, _passiveAbilityRoot.localSize.y + 22f, 0f);
|
|
}
|
|
if (avatarBattleInfo.Bonus.AbilityCosts.Length < 3 || avatarBattleInfo.Bonus.AbilityDesc.Length < 3)
|
|
{
|
|
_abilityItemRoot[2].gameObject.SetActive(value: false);
|
|
_thirdUnderLine.SetActive(value: false);
|
|
}
|
|
for (int num = 0; num < avatarBattleInfo.Bonus.AbilityDesc.Length; num++)
|
|
{
|
|
int textNum = num;
|
|
_abilityDescLabel[textNum].SetWrapText(BattleCardBase.ConvertSkillDescriptionText(avatarBattleInfo.Bonus.AbilityDesc[textNum]));
|
|
UIEventListener.Get(_abilityDescLabel[textNum].gameObject).onClick = delegate
|
|
{
|
|
OnClickDescLabel(allAbilityText, _abilityDescLabel[textNum]);
|
|
};
|
|
UIEventListener.Get(_keyWordCollider[textNum]).onPress = delegate(GameObject g, bool b)
|
|
{
|
|
BattlePlayerView.PressKeyWordColorChange(_abilityDescLabel[textNum], b);
|
|
};
|
|
UIEventListener.Get(_keyWordCollider[textNum]).onDragStart = delegate
|
|
{
|
|
BattlePlayerView.SetKeyWordLabelColor(_abilityDescLabel[textNum]);
|
|
};
|
|
_abilityItemRoot[textNum].height = 60;
|
|
if (_abilityItemRoot[textNum].height < _abilityDescLabel[textNum].height)
|
|
{
|
|
_abilityItemRoot[textNum].height = _abilityDescLabel[textNum].height;
|
|
}
|
|
_abilityDescLabel[textNum].GetComponent<BoxCollider>().size = new Vector3(_abilityItemRoot[textNum].localSize.x, _abilityItemRoot[textNum].localSize.y + 22f, 0f);
|
|
_abilityDescLabel[textNum].GetComponent<BoxCollider>().center = new Vector3(-22f, 0f, 0f);
|
|
if (!int.TryParse(avatarBattleInfo.Bonus.AbilityCosts[textNum], out var result))
|
|
{
|
|
_signLabel[textNum].text = "-";
|
|
_costLabel[textNum].text = "X";
|
|
}
|
|
else if (result != 0)
|
|
{
|
|
_signLabel[textNum].text = ((result < 0) ? "-" : "+");
|
|
_costLabel[textNum].text = Mathf.Abs(result).ToString();
|
|
}
|
|
else
|
|
{
|
|
_signLabel[textNum].text = string.Empty;
|
|
_costLabel[textNum].text = "0";
|
|
_costLabel[textNum].transform.localPosition = new Vector3(0f, 2f, 0f);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnClickDescLabel(string abilityText, UILabel textLabel)
|
|
{
|
|
if (HasKeyword(abilityText))
|
|
{
|
|
|
|
IList<string> keywords = BattleKeywordInfoListMgr.GetKeywords(abilityText);
|
|
_keywordDialog = BattlePlayerView.CreateKeyPanel(textLabel, keywords, CardMaster.CardMasterId.Default);
|
|
_keywordDialog.SetPanelDepth(20, isSetBackViewDepthImmediately: true);
|
|
_keywordDialog.GetComponentInChildren<BattleKeywordInfoListMgr>().SetPanelDepth(25);
|
|
}
|
|
}
|
|
|
|
private bool HasKeyword(string skillText)
|
|
{
|
|
IList<string> keywords = BattleKeywordInfoListMgr.GetKeywords(skillText);
|
|
bool result = false;
|
|
foreach (string item in keywords)
|
|
{
|
|
if (Data.Master.BattleKeyWordDic.ContainsKey(item))
|
|
{
|
|
result = true;
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private IEnumerator LoadResources(int skinId, Action callBack)
|
|
{
|
|
_loadList.Add(GetCharacterTexturePath(skinId, isFetch: false));
|
|
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadList, null));
|
|
callBack.Call();
|
|
}
|
|
|
|
private string GetCharacterTexturePath(int skinId, bool isFetch)
|
|
{
|
|
return Toolbox.ResourcesManager.GetAssetTypePath(skinId.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isFetch);
|
|
}
|
|
|
|
private void InitializeClassCharacter(int skinId)
|
|
{
|
|
_characterTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetCharacterTexturePath(skinId, isFetch: true)) as Texture;
|
|
}
|
|
}
|