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>
472 lines
12 KiB
C#
472 lines
12 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public class MyPageItemHome : MyPageItem
|
|
{
|
|
private enum Notification
|
|
{
|
|
Info }
|
|
|
|
public static readonly Vector3 TUTORIAL_OFFSET_FOOTER = new Vector3(0f, 19f, 0f);
|
|
|
|
private GameObject _bannerObject;
|
|
|
|
private GameObject _subBannerObject;
|
|
|
|
private MyPageBanner _banner;
|
|
|
|
private MyPageSubBanner _subBanner;
|
|
|
|
[SerializeField]
|
|
private UIButton _giftButton;
|
|
|
|
[SerializeField]
|
|
private GameObject _giftNumberRoot;
|
|
|
|
[SerializeField]
|
|
private UILabel _giftNumber;
|
|
|
|
private int _giftCount;
|
|
|
|
[SerializeField]
|
|
private UIButton _missionButton;
|
|
|
|
[SerializeField]
|
|
private UILabel _missionNumberLabel;
|
|
|
|
[SerializeField]
|
|
private UIButton _guildButton;
|
|
|
|
[SerializeField]
|
|
private UILabel _guildNotificationLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _contentsRoot;
|
|
|
|
[SerializeField]
|
|
private UIButton _battlePassButton;
|
|
|
|
[SerializeField]
|
|
private GameObject _homeDialogPrefab;
|
|
|
|
[SerializeField]
|
|
private GameObject[] _customMyPageHideList;
|
|
|
|
[SerializeField]
|
|
private GameObject[] _customMyPageOnlyList;
|
|
|
|
[SerializeField]
|
|
private UIButton _bgCustomButton;
|
|
|
|
[SerializeField]
|
|
private UIButton _hideUIButton;
|
|
|
|
[SerializeField]
|
|
private GameObject[] _hideUIList;
|
|
|
|
[SerializeField]
|
|
private UIButton _restoreUIButton;
|
|
|
|
private MyPageHomeStatic _homeStatic;
|
|
|
|
private int _notificationMask;
|
|
|
|
public GameObject ContentsRoot => _contentsRoot;
|
|
|
|
public bool IsCustomMyPage => Data.MyPage.data.BGInfo.BGType != MyPageDetail.BGType.Deck;
|
|
|
|
public override void Initialize(MyPageMenu parent)
|
|
{
|
|
base.Initialize(parent);
|
|
_giftButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushGiftButton();
|
|
}));
|
|
_missionButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushMissionButton();
|
|
}));
|
|
_guildButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushGuildButton();
|
|
}));
|
|
_battlePassButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushBattlePassButton();
|
|
}));
|
|
_bgCustomButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushBGCustomButton();
|
|
}));
|
|
_hideUIButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushHideUIButton();
|
|
}));
|
|
_restoreUIButton.onClick.Add(new EventDelegate(delegate
|
|
{
|
|
OnPushRestoreUIButton();
|
|
}));
|
|
_guildNotificationLabel.gameObject.SetActive(value: false);
|
|
}
|
|
|
|
public override void OnMyPageInfoReceive()
|
|
{
|
|
base.OnMyPageInfoReceive();
|
|
_bannerObject.GetComponent<MyPageBanner>().CreateMyPageBanner();
|
|
_subBanner.CreateMyPageBanner();
|
|
UpdateGuildNotification();
|
|
UpdateMissionNumber();
|
|
_giftCount = Data.MyPage.data.unread_mail_count;
|
|
SetUnreadGiftCount(_giftCount);
|
|
UIManager.GetInstance().StartCoroutine(WaitForTreasureBoxCpRewardDialogClosed(delegate
|
|
{
|
|
CheckNotify(delegate
|
|
{
|
|
CheckHomeDialog();
|
|
});
|
|
}));
|
|
UpdateMaintenance();
|
|
}
|
|
|
|
private IEnumerator WaitForTreasureBoxCpRewardDialogClosed(Action onFinish)
|
|
{
|
|
while (!base.Parent._treasureBoxCpRewardDialogClosed)
|
|
{
|
|
yield return null;
|
|
}
|
|
onFinish.Call();
|
|
}
|
|
|
|
public override void Show(bool skipCardAnimation = false)
|
|
{
|
|
base.Show(skipCardAnimation);
|
|
_contentsRoot.SetActive(value: true);
|
|
if (!IsCustomMyPage)
|
|
{
|
|
_homeStatic.Show();
|
|
}
|
|
_hideUIButton.gameObject.SetActive(IsCustomMyPage);
|
|
_restoreUIButton.gameObject.SetActive(value: false);
|
|
_bannerObject.SetActive(!base.Parent.IsFirstGuid);
|
|
_subBannerObject.SetActive(!base.Parent.IsFirstGuid);
|
|
_bgCustomButton.gameObject.SetActive(Data.Load.data.AcquiredMyPageBGList.Count > 0);
|
|
UpdateMaintenance();
|
|
CheckShopTutorial();
|
|
OnUpdateCustomMyPageEnable(isHomeActive: true);
|
|
}
|
|
|
|
public void OnUpdateCustomMyPageEnable(bool isHomeActive)
|
|
{
|
|
_hideUIButton.gameObject.SetActive(IsCustomMyPage);
|
|
if (isHomeActive && IsCustomMyPage)
|
|
{
|
|
_banner.Show();
|
|
_subBanner.Show();
|
|
}
|
|
else
|
|
{
|
|
CommonBackGround.Instance.EffectVisible = true;
|
|
}
|
|
GameObject[] customMyPageHideList = _customMyPageHideList;
|
|
foreach (GameObject gameObject in customMyPageHideList)
|
|
{
|
|
if (gameObject != null)
|
|
{
|
|
gameObject.SetActive(!IsCustomMyPage);
|
|
}
|
|
}
|
|
customMyPageHideList = _customMyPageOnlyList;
|
|
foreach (GameObject gameObject2 in customMyPageHideList)
|
|
{
|
|
if (gameObject2 != null)
|
|
{
|
|
gameObject2.SetActive(IsCustomMyPage);
|
|
}
|
|
}
|
|
if (_homeStatic != null && _homeStatic.CardLoadFinish)
|
|
{
|
|
_homeStatic.SetActive(!IsCustomMyPage && isHomeActive);
|
|
}
|
|
if (!(base.Parent.CustomBGControl != null))
|
|
{
|
|
return;
|
|
}
|
|
base.Parent.CustomBGControl.SetEnable(IsCustomMyPage && isHomeActive);
|
|
if (!(IsCustomMyPage && isHomeActive))
|
|
{
|
|
return;
|
|
}
|
|
base.Parent.CustomBGControl.Show(delegate
|
|
{
|
|
if (isHomeActive && IsCustomMyPage)
|
|
{
|
|
CommonBackGround.Instance.EffectVisible = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
private void CheckShopTutorial()
|
|
{
|
|
if (Data.Load.data._userTutorial.TutorialStep == 41)
|
|
{
|
|
DialogBase dialogBase = MyPageMenu.CreateDialogForTutorial();
|
|
dialogBase.SetText(Data.SystemText.Get("Tutorial_0012"));
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
base.Parent.SetGuideToOkOnlyDialog(dialogBase);
|
|
UIManager.SetObjectToGrey(_giftButton.gameObject, b: true);
|
|
UIManager.SetObjectToGrey(_missionButton.gameObject, b: true);
|
|
UIManager.SetObjectToGrey(_guildButton.gameObject, b: true);
|
|
UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: true);
|
|
UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: true);
|
|
_homeStatic.SetTutorialMode();
|
|
dialogBase.OnClose = delegate
|
|
{
|
|
Footer footer = UIManager.GetInstance()._Footer;
|
|
base.Parent.SetGuideEffect(footer._underButtons[5].transform, TUTORIAL_OFFSET_FOOTER, 180f);
|
|
};
|
|
}
|
|
}
|
|
|
|
public override void Hide()
|
|
{
|
|
base.Hide();
|
|
_homeStatic.Hide();
|
|
base.gameObject.SetActive(value: true);
|
|
_contentsRoot.SetActive(value: false);
|
|
}
|
|
|
|
private void UpdateMaintenance()
|
|
{
|
|
if (!base.Parent.IsFirstGuid)
|
|
{
|
|
bool b = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GIFT_MAINTENANCE);
|
|
bool b2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.MISSION_MAINTENANCE);
|
|
bool b3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GUILD_MAINTENANCE);
|
|
UIManager.SetObjectToGrey(_giftButton.gameObject, b);
|
|
UIManager.SetObjectToGrey(_missionButton.gameObject, b2);
|
|
UIManager.SetObjectToGrey(_guildButton.gameObject, b3);
|
|
bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BATTLE_PASS);
|
|
bool flag2 = !Data.IsBattlePassPeriod;
|
|
UIManager.SetObjectToGrey(_battlePassButton.gameObject, flag || flag2);
|
|
}
|
|
}
|
|
|
|
private void CheckNotify(Action onFinish)
|
|
{
|
|
if (!_contentsRoot.activeSelf || Data.Load.data._userTutorial.TutorialStep != 100)
|
|
{
|
|
return;
|
|
}
|
|
DateTime last_announce_time = Data.MyPage.data.last_announce_time;
|
|
// Pre-Phase-5b: gated on ambient GameMgr.AnnounceTime cursor to avoid
|
|
// re-showing the same announcement. Headless has no announcement UI to display;
|
|
// always fall through to the else branch below.
|
|
if (false)
|
|
{
|
|
_notificationMask |= 1;
|
|
if (_notificationMask != 0)
|
|
{
|
|
StartCoroutine(ShowNextNotification(onFinish));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
onFinish.Call();
|
|
}
|
|
}
|
|
|
|
private void CheckHomeDialog()
|
|
{
|
|
MyPageHomeDialogData myPageHomeDialogData = Data.MyPage.data.MyPageHomeDialogData;
|
|
if (myPageHomeDialogData.IsEnable)
|
|
{
|
|
MyPageHomeDialog.Create(_homeDialogPrefab, myPageHomeDialogData, null);
|
|
}
|
|
}
|
|
|
|
private IEnumerator ShowNextNotification(Action onFinish)
|
|
{
|
|
while (UIManager.GetInstance().isFading() || UIManager.GetInstance().isOpenDialog())
|
|
{
|
|
yield return null;
|
|
}
|
|
if (_notificationMask == 0)
|
|
{
|
|
yield break;
|
|
}
|
|
int i;
|
|
for (i = 0; (_notificationMask & (1 << i)) == 0; i++)
|
|
{
|
|
}
|
|
_notificationMask ^= 1 << i;
|
|
DialogBase dialogBase = null;
|
|
if (1 == 0)
|
|
{
|
|
yield break;
|
|
}
|
|
if (_notificationMask != 0 && dialogBase != null)
|
|
{
|
|
dialogBase.OnClose = delegate
|
|
{
|
|
StartCoroutine(ShowNextNotification(onFinish));
|
|
};
|
|
}
|
|
else
|
|
{
|
|
onFinish.Call();
|
|
}
|
|
}
|
|
|
|
private void OnPushGiftButton()
|
|
{
|
|
// Pre-Phase-5b: fired MailTopTask via NetworkManager. Headless has no wire tasks;
|
|
// short-circuit to the success callback so the UI scene-change still fires.
|
|
OnRequestGift(default(NetworkTask.ResultCode));
|
|
}
|
|
|
|
private void OnRequestGift(NetworkTask.ResultCode error)
|
|
{
|
|
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mail);
|
|
}
|
|
|
|
private void OnPushMissionButton()
|
|
{
|
|
// Pre-Phase-5b: fired MissionInfoTask via NetworkManager. See OnPushGiftButton.
|
|
OpenMission(default(NetworkTask.ResultCode));
|
|
}
|
|
|
|
private void OpenMission(NetworkTask.ResultCode error)
|
|
{
|
|
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mission);
|
|
}
|
|
|
|
public void UpdateMissionNumber()
|
|
{
|
|
if (!(_missionNumberLabel.gameObject == null))
|
|
{
|
|
int unreceived_mission_reward_count = Data.MyPage.data.unreceived_mission_reward_count;
|
|
_missionNumberLabel.gameObject.SetActive(unreceived_mission_reward_count > 0);
|
|
_missionNumberLabel.text = unreceived_mission_reward_count.ToString();
|
|
if (unreceived_mission_reward_count > 99)
|
|
{
|
|
_missionNumberLabel.text = 99 + "+";
|
|
}
|
|
else
|
|
{
|
|
_missionNumberLabel.text = unreceived_mission_reward_count.ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnPushBattlePassButton()
|
|
{
|
|
|
|
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass);
|
|
}
|
|
|
|
private void OnPushBGCustomButton()
|
|
{
|
|
|
|
MyPageBGCustomDialog.Create(OnDecideMyPageBG);
|
|
}
|
|
|
|
private void OnPushHideUIButton()
|
|
{
|
|
|
|
ToggleUIVisible(visible: false);
|
|
}
|
|
|
|
private void OnPushRestoreUIButton()
|
|
{
|
|
ToggleUIVisible(visible: true);
|
|
}
|
|
|
|
private void ToggleUIVisible(bool visible)
|
|
{
|
|
GameObject[] hideUIList = _hideUIList;
|
|
foreach (GameObject gameObject in hideUIList)
|
|
{
|
|
if (gameObject != null)
|
|
{
|
|
gameObject.SetActive(visible);
|
|
}
|
|
}
|
|
base.Parent.TopBar.gameObject.SetActive(visible);
|
|
UIManager.GetInstance()._Footer.ShowFooterMenu(visible);
|
|
_restoreUIButton.gameObject.SetActive(!visible);
|
|
}
|
|
|
|
public void OnDecideMyPageBG(MyPageDetail.BGType bgType, string selectId, List<string> randomIdList)
|
|
{
|
|
if (bgType == MyPageDetail.BGType.RandomBG)
|
|
{
|
|
selectId = DecideRandomBG(randomIdList);
|
|
}
|
|
base.Parent.ChangeMyPageBG(bgType, selectId);
|
|
}
|
|
|
|
public static string DecideRandomBG(List<string> randomIdList)
|
|
{
|
|
System.Random random = new System.Random();
|
|
return randomIdList[random.Next(0, randomIdList.Count)];
|
|
}
|
|
|
|
private void OnPushGuildButton()
|
|
{
|
|
|
|
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Guild);
|
|
}
|
|
|
|
private void UpdateGuildNotification()
|
|
{
|
|
_guildNotificationLabel.gameObject?.SetActive(IsGuildNotification());
|
|
}
|
|
|
|
private bool IsGuildNotification()
|
|
{
|
|
GuildNotification guildNotification = Data.MyPageNotifications.data.GuildNotification;
|
|
if (!guildNotification.GuildId.HasValue)
|
|
{
|
|
return guildNotification.IsInvited;
|
|
}
|
|
if (guildNotification.GuildId.Value != PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.JOINING_GUILD_ID))
|
|
{
|
|
return true;
|
|
}
|
|
if (guildNotification.GuildRoomMessageId.HasValue && guildNotification.GuildRoomMessageId.Value > PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.READ_LATEST_GUILD_CHAT_MESSAGE_ID))
|
|
{
|
|
return true;
|
|
}
|
|
if (guildNotification.IsJoinRequest)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void SetUnreadGiftCount(int count)
|
|
{
|
|
if (!(_giftNumberRoot.gameObject == null))
|
|
{
|
|
_giftNumberRoot.gameObject.SetActive(count > 0);
|
|
if (count > 99)
|
|
{
|
|
_giftNumber.text = 99 + "+";
|
|
}
|
|
else
|
|
{
|
|
_giftNumber.text = count.ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void HideAndRepositionSubBanner(string click)
|
|
{
|
|
_subBanner.HideAndRepositionBanner(click);
|
|
}
|
|
}
|