Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/Footer.cs
gamer147 2d9a6eea4b 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>
2026-07-03 19:18:54 -04:00

390 lines
11 KiB
C#

using System;
using UnityEngine;
using Wizard.RoomMatch;
namespace Wizard;
public class Footer : UIBase
{
[SerializeField]
private UIButton[] underButtons;
[SerializeField]
private UISprite[] underButtonSprites;
[SerializeField]
private UILabel[] underButtonLabels;
[SerializeField]
private UILabelGradientOverwriter[] _labelGradientOverwriters;
[SerializeField]
private UILabelEffectOverwriter[] _labelEffectOverwriters;
[SerializeField]
private GameObject m_footerMenuObj;
[SerializeField]
private GameObject InviteIcon;
[SerializeField]
private GameObject ArenaIcon;
[SerializeField]
private GameObject _soloPlayIcon;
[SerializeField]
private GameObject _shopIcon;
[SerializeField]
private GameObject OtherIcon;
private string[] menuIdleTexTbl = new string[7] { "btn_main_home_off", "btn_main_story_off", "btn_main_battle_off", "btn_main_arena_off", "btn_main_card_off", "btn_main_shop_off", "btn_main_other_off" };
private string[] menuPushTexTbl = new string[7] { "btn_main_home_on", "btn_main_story_on", "btn_main_battle_on", "btn_main_arena_on", "btn_main_card_on", "btn_main_shop_on", "btn_main_other_on" };
public UIButton[] _underButtons => underButtons;
public GameObject _footerMenuObj => m_footerMenuObj;
public int CurrentIndex { get; private set; }
private void Awake()
{
UpdateCurrentIndex(0);
InviteIconDisp(inDisp: false);
UpdateArenaBadgeIcon();
SoloPlayIconDisp(inDisp: false);
SetShopIconVisible(visible: false);
underButtonLabels[0].text = Data.SystemText.Get("MyPage_0001");
underButtonLabels[1].text = Data.SystemText.Get("MyPage_0002");
underButtonLabels[2].text = Data.SystemText.Get("MyPage_0003");
underButtonLabels[3].text = Data.SystemText.Get("MyPage_0004");
underButtonLabels[4].text = Data.SystemText.Get("MyPage_0005");
underButtonLabels[5].text = Data.SystemText.Get("MyPage_0006");
underButtonLabels[6].text = Data.SystemText.Get("MyPage_0007");
for (int i = 0; i < underButtons.Length; i++)
{
UIButton buttonUnder = underButtons[i];
buttonUnder.gameObject.layer = 27;
buttonUnder.onClick.Clear();
buttonUnder.onClick.Add(new EventDelegate(delegate
{
UIManager uiMgr = UIManager.GetInstance();
int selectedMenu = int.Parse(buttonUnder.name);
if (uiMgr.IsTouchable)
{
if (MyPageMenu.Instance != null)
{
if (!MyPageMenu.Instance.IsVisible)
{
Action action = delegate
{
UIManager.ChangeViewSceneParam param2 = new UIManager.ChangeViewSceneParam
{
MyPageMenuIndex = selectedMenu,
IsCutCardMotion = false
};
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Room))
{
(UIManager.GetInstance().GetUIBase(UIManager.ViewScene.Room) as RoomRoot).CreateChangeSceneDialog(UIManager.ViewScene.MyPage, param2, delegate
{
UpdateCurrentIndex(selectedMenu);
});
}
else
{
buttonSoundMenu();
uiMgr.ChangeViewScene(UIManager.ViewScene.MyPage, param2);
UpdateCurrentIndex(selectedMenu);
}
};
if (uiMgr.GetUiBaseOfCurrentScene().IsGetOutOfScene(action))
{
action();
}
}
else
{
buttonSoundMenu();
if (CanPushCurrentButton(selectedMenu))
{
MyPageMenu.Instance.ChangeMenu(selectedMenu);
}
}
}
else
{
UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam
{
MyPageMenuIndex = selectedMenu,
IsCutCardMotion = false
};
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Room))
{
(UIManager.GetInstance().GetUIBase(UIManager.ViewScene.Room) as RoomRoot).CreateChangeSceneDialog(UIManager.ViewScene.MyPage, param, delegate
{
UpdateCurrentIndex(selectedMenu);
});
}
else
{
buttonSoundMenu();
uiMgr.ChangeViewScene(UIManager.ViewScene.MyPage, param);
UpdateCurrentIndex(selectedMenu);
}
}
}
}));
}
UpdateArenaBadgeIcon();
UpdateInviteIcon();
UpdateOtherBadgeIcon();
UpdateSoloPlayBadgeIcon();
UpdateShopBadgeIcon();
}
protected bool CanPushCurrentButton(int selectedMenuIndex)
{
if (CurrentIndex != selectedMenuIndex)
{
return true;
}
if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.MyPage && MyPageMenu.Instance.IsEnableFooterCurrentMenu)
{
return true;
}
return false;
}
private void buttonSoundMenu()
{
}
public void ShowFooterMenu(bool isShow)
{
m_footerMenuObj.SetActive(isShow);
EnableMyPageCamera();
if (isShow)
{
UpdateArenaBadgeIcon();
}
}
private void EnableMyPageCamera()
{
if (MyPageMenu.Instance != null)
{
UIManager.GetInstance().MyPageUICameraObj.SetActive(_footerMenuObj.activeSelf || MyPageMenu.Instance.IsVisible);
}
else
{
UIManager.GetInstance().MyPageUICameraObj.SetActive(_footerMenuObj.activeSelf);
}
}
public void UpdateCurrentIndex(int pushMenuIdx)
{
CurrentIndex = pushMenuIdx;
int num = menuIdleTexTbl.Length;
for (int i = 0; i < num; i++)
{
underButtonSprites[i].spriteName = menuIdleTexTbl[i];
}
underButtonSprites[pushMenuIdx].spriteName = menuPushTexTbl[pushMenuIdx];
}
public void SetButtonEnableColorChange(int btnIndex, bool btnIsEnable = true)
{
underButtons[btnIndex].isEnabled = btnIsEnable;
if (btnIsEnable)
{
underButtonLabels[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_ENABLE;
underButtonSprites[btnIndex].color = Color.white;
underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DEFAULT;
return;
}
underButtonLabels[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE;
underButtonSprites[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE;
if (Array.IndexOf(menuIdleTexTbl, underButtonSprites[btnIndex].spriteName) >= 0)
{
underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DISABLE_DEFAULT;
}
else
{
underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DISABLE_PUSH;
}
}
public void SetAllButtonEnableColorChange(bool isEnable)
{
for (int i = 0; i < underButtons.Length; i++)
{
SetButtonEnableColorChange(i, isEnable);
}
}
public void SetButtonEnable(int index, bool isEnable)
{
underButtons[index].isEnabled = isEnable;
}
public void InviteIconDisp(bool inDisp)
{
InviteIcon.SetActive(inDisp);
}
public void SoloPlayIconDisp(bool inDisp)
{
_soloPlayIcon.SetActive(inDisp);
}
private void OtherIconDisp(bool inDisp)
{
OtherIcon.SetActive(inDisp);
}
private void SetShopIconVisible(bool visible)
{
_shopIcon.SetActive(visible);
}
public void UpdateInviteIcon()
{
InviteIconDisp(Data.Load.data._receiveInviteCount > 0);
}
public void UpdateArenaBadgeIcon()
{
bool active = false;
if (Data.Load.data._userTutorial.TutorialStep != 100)
{
ArenaIcon.SetActive(value: false);
return;
}
if (Data.ArenaData != null && Data.ArenaData.ColosseumData.IsFreeEntry)
{
active = true;
}
if (Data.MyPageNotifications.data.IsCompetitionBadge)
{
active = true;
}
if (Data.MyPageNotifications.data.IsInviteGathering)
{
active = true;
}
if (Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification)
{
active = true;
}
ArenaIcon.SetActive(active);
}
public void UpdateSoloPlayBadgeIcon()
{
bool flag = false;
bool flag2 = false;
bool flag3 = false;
if (Data.Load.data._userTutorial.TutorialStep == 100)
{
flag = Data.MyPageNotifications.data.QuestOpenInfo.IsDisplayBadge;
flag2 = Data.MyPageNotifications.data.StoryNotification.IsDisplayBadge;
flag3 = Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable;
}
SoloPlayIconDisp(flag || flag2 || flag3);
}
public void UpdateQuestBadgeIcon(bool isDisp)
{
bool flag = isDisp;
bool flag2 = false;
bool flag3 = false;
if (Data.Load.data._userTutorial.TutorialStep == 100)
{
flag2 = Data.MyPageNotifications.data.StoryNotification.IsDisplayBadge;
flag3 = Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable;
}
SoloPlayIconDisp(flag || flag2 || flag3);
}
public void UpdateOtherBadgeIcon()
{
OtherIconDisp(Data.MyPageNotifications.data.ReceiveFriendApplyCount > 0);
}
public void UpdateShopBadgeIcon()
{
if (Data.Load.data._userTutorial.TutorialStep != 100)
{
SetShopIconVisible(visible: false);
}
else if (Data.MyPageNotifications.data.ShopNotification.AppealCardPack == null)
{
SetShopIconVisible(visible: false);
}
else
{
SetShopIconVisible(Data.MyPageNotifications.data.ShopNotification.AppealCardPack.NeedsFooterBadgeIcon);
}
}
public void SetShopBadgeIconVisible(bool visible)
{
Data.MyPageNotifications.data.ShopNotification.AppealCardPack.NeedsFooterBadgeIcon = visible;
UpdateShopBadgeIcon();
}
public void OverwriteLabelColors(eColorCodeId gradientTopColorId, eColorCodeId gradientBottomColorId, eColorCodeId effectColorId)
{
OverwriteLabelGradients(gradientTopColorId, gradientBottomColorId);
OverwriteLabelEffects(effectColorId);
}
public void CancelOverwriteLabelColors()
{
CancelOverwriteLabelGradients();
CancelOverwriteLabelEffects();
}
private void OverwriteLabelGradients(eColorCodeId topColorId, eColorCodeId bottomColorId)
{
UILabelGradientOverwriter[] labelGradientOverwriters = _labelGradientOverwriters;
foreach (UILabelGradientOverwriter obj in labelGradientOverwriters)
{
obj.enabled = true;
obj.GradientTopColorId = topColorId;
obj.GradientBottomColorId = bottomColorId;
}
}
private void CancelOverwriteLabelGradients()
{
UILabelGradientOverwriter[] labelGradientOverwriters = _labelGradientOverwriters;
for (int i = 0; i < labelGradientOverwriters.Length; i++)
{
labelGradientOverwriters[i].enabled = false;
}
}
private void OverwriteLabelEffects(eColorCodeId colorId)
{
UILabelEffectOverwriter[] labelEffectOverwriters = _labelEffectOverwriters;
foreach (UILabelEffectOverwriter obj in labelEffectOverwriters)
{
obj.enabled = true;
obj.EffectColorId = colorId;
}
}
private void CancelOverwriteLabelEffects()
{
UILabelEffectOverwriter[] labelEffectOverwriters = _labelEffectOverwriters;
for (int i = 0; i < labelEffectOverwriters.Length; i++)
{
labelEffectOverwriters[i].enabled = false;
}
}
}