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>
442 lines
14 KiB
C#
442 lines
14 KiB
C#
using System.Collections;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
public class PurchaseConfirm : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteConfirmItemIcon;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteHaveItemIcon;
|
|
|
|
[SerializeField]
|
|
private UITexture m_TextureConfirmTicket;
|
|
|
|
[SerializeField]
|
|
private UITexture m_TextureHaveTicket;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelUseItemCnt;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelBuyPack;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelItemName;
|
|
|
|
[SerializeField]
|
|
private UILabel _premiumCardWarning;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelBeforeItemCnt;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelAfterItemCnt;
|
|
|
|
[SerializeField]
|
|
private UILabel m_LabelAfterItemUnit;
|
|
|
|
[SerializeField]
|
|
private GameObject _confirmObj;
|
|
|
|
[SerializeField]
|
|
private GameObject _haveObj;
|
|
|
|
[SerializeField]
|
|
private UITable _tablePackPoint;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelBeforPackPoint;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelAfterPackPoint;
|
|
|
|
[SerializeField]
|
|
private UITable _preReleasePointTable;
|
|
|
|
[SerializeField]
|
|
private UILabel _preReleasePointBeforeLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _preReleasePointAfterlabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _preReleasePointArleadyMax;
|
|
|
|
[SerializeField]
|
|
private Transform _nonItemRoot;
|
|
|
|
[SerializeField]
|
|
private CenteringUIWidget _nonItemCentering;
|
|
|
|
[SerializeField]
|
|
private UILabel _nonItemBeforeCountLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _nonItemAfterCountLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _nonItemRemainingLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _nonItemUnitLabel;
|
|
|
|
[SerializeField]
|
|
private UILabel _campaignNameLabel;
|
|
|
|
[SerializeField]
|
|
private GameObject _rootObj;
|
|
|
|
[SerializeField]
|
|
private GameObject _jpnLawRoot;
|
|
|
|
[SerializeField]
|
|
private GameObject _saleTimeExistLayout;
|
|
|
|
[SerializeField]
|
|
private GameObject _saleTimeNoneLayout;
|
|
|
|
[SerializeField]
|
|
private UILabel _expiryTimeLabel;
|
|
|
|
private void UpdateJpnLawObj()
|
|
{
|
|
_ = _rootObj == null;
|
|
}
|
|
|
|
private void HideJpnLawObj()
|
|
{
|
|
if (!(_jpnLawRoot == null))
|
|
{
|
|
_jpnLawRoot.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
public void SetClystalConfirmDialog(int useItemNum, string purchaseText, int haveItemCnt, ShopExpirtyInfo expirtyInfo)
|
|
{
|
|
SetIconImage(UserGoods.Type.Crystal);
|
|
int afterItemNum = haveItemCnt - useItemNum;
|
|
string unit = Data.SystemText.Get("Common_0116");
|
|
string useItemNumText = Data.SystemText.Get("Shop_0091", useItemNum.ToString());
|
|
SetLabelText(Data.SystemText.Get("Common_0201"), useItemNumText, afterItemNum, unit, purchaseText, haveItemCnt);
|
|
UpdateJpnLawObj();
|
|
_expiryTimeLabel.gameObject.SetActive(expirtyInfo.IsEnableText);
|
|
_expiryTimeLabel.text = expirtyInfo.GetText();
|
|
if (_saleTimeExistLayout != null && _saleTimeNoneLayout != null)
|
|
{
|
|
_saleTimeExistLayout.SetActive(expirtyInfo.IsEnableText);
|
|
_saleTimeNoneLayout.SetActive(!expirtyInfo.IsEnableText);
|
|
}
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
public void ChangePurchaceConfirmTextWidth()
|
|
{
|
|
}
|
|
|
|
public void SetTicketConfirmDialog(int useItemNum, string purchaseText, int haveItemCnt, Texture icon)
|
|
{
|
|
SetIconImage(UserGoods.Type.Item, Item.Type.CardPackTicket, icon);
|
|
int afterItemNum = haveItemCnt - useItemNum;
|
|
string unit = Data.SystemText.Get("Common_0117");
|
|
string useItemNumText = Data.SystemText.Get("Shop_0042", useItemNum.ToString());
|
|
SetLabelText(Data.SystemText.Get("Common_0114"), useItemNumText, afterItemNum, unit, purchaseText, haveItemCnt);
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
public void SetRupyConfirmDialog(int useItemNum, string purchaseText, int haveItemCnt)
|
|
{
|
|
SetIconImage(UserGoods.Type.Rupy);
|
|
int afterItemNum = haveItemCnt - useItemNum;
|
|
string unit = Data.SystemText.Get("Common_0120");
|
|
string useItemNumText = Data.SystemText.Get("Shop_0090", useItemNum.ToString());
|
|
SetLabelText(Data.SystemText.Get("Common_0115"), useItemNumText, afterItemNum, unit, purchaseText, haveItemCnt);
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
public void SetLeaderSkinTicketConfirmDialog(int cost, string purchaseText, int haveItem, long itemId)
|
|
{
|
|
int afterItemNum = haveItem - cost;
|
|
string unit = Data.SystemText.Get("Common_0117");
|
|
string useItemNumText = Data.SystemText.Get("Shop_0042", cost.ToString());
|
|
SetLabelText(Data.SystemText.Get("Common_0114"), useItemNumText, afterItemNum, unit, purchaseText, haveItem);
|
|
SetIconImage(UserGoods.Type.Item, Item.Type.LeaderSkinTicket, Toolbox.ResourcesManager.LoadObject<Texture>(ShopCommonUtility.GetTicketIconRightDownPath(itemId.ToString(), isFetch: true)));
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
private void SetIconImage(UserGoods.Type type, Item.Type ticket = (Item.Type)0, Texture packIcon = null)
|
|
{
|
|
switch (type)
|
|
{
|
|
case UserGoods.Type.Crystal:
|
|
ViewIconSprite("icon_crystal_s");
|
|
break;
|
|
case UserGoods.Type.Rupy:
|
|
ViewIconSprite("icon_rupy_s");
|
|
break;
|
|
case UserGoods.Type.Item:
|
|
switch (ticket)
|
|
{
|
|
case Item.Type.TwoPickTicket:
|
|
ViewIconSprite("icon_2pick_s");
|
|
break;
|
|
case Item.Type.CardPackTicket:
|
|
case Item.Type.LeaderSkinTicket:
|
|
_spriteConfirmItemIcon.gameObject.SetActive(value: false);
|
|
_spriteHaveItemIcon.gameObject.SetActive(value: false);
|
|
m_TextureConfirmTicket.gameObject.SetActive(value: true);
|
|
m_TextureHaveTicket.gameObject.SetActive(value: true);
|
|
m_TextureConfirmTicket.mainTexture = packIcon;
|
|
m_TextureHaveTicket.mainTexture = packIcon;
|
|
break;
|
|
case Item.Type.Orb:
|
|
ViewIconSprite("icon_orb_s");
|
|
break;
|
|
case Item.Type.OrbPiece:
|
|
ViewIconSprite("icon_orb_piece_s");
|
|
break;
|
|
}
|
|
break;
|
|
case UserGoods.Type.RedEther:
|
|
ViewIconSprite("icon_liquid_s");
|
|
break;
|
|
case UserGoods.Type.SpotCardPoint:
|
|
ViewIconSprite("icon_spotpoint_s");
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void ViewIconSprite(string spriteName)
|
|
{
|
|
_spriteConfirmItemIcon.gameObject.SetActive(value: true);
|
|
_spriteHaveItemIcon.gameObject.SetActive(value: true);
|
|
m_TextureConfirmTicket.gameObject.SetActive(value: false);
|
|
m_TextureHaveTicket.gameObject.SetActive(value: false);
|
|
_spriteConfirmItemIcon.spriteName = spriteName;
|
|
_spriteHaveItemIcon.spriteName = spriteName;
|
|
}
|
|
|
|
private void HideIcon()
|
|
{
|
|
_spriteConfirmItemIcon.gameObject.SetActive(value: false);
|
|
_spriteHaveItemIcon.gameObject.SetActive(value: false);
|
|
m_TextureConfirmTicket.gameObject.SetActive(value: false);
|
|
m_TextureHaveTicket.gameObject.SetActive(value: false);
|
|
}
|
|
|
|
private void SetLabelText(string itemName, string useItemNumText, int afterItemNum, string unit, string purchaseText, int haveItemCnt)
|
|
{
|
|
m_LabelUseItemCnt.text = useItemNumText;
|
|
m_LabelBuyPack.text = purchaseText;
|
|
m_LabelItemName.text = itemName;
|
|
m_LabelBeforeItemCnt.text = haveItemCnt.ToString();
|
|
m_LabelAfterItemCnt.text = afterItemNum.ToString();
|
|
m_LabelAfterItemUnit.text = unit;
|
|
}
|
|
|
|
public void SetCardBuy(string moneyKindName, int moneyHave, int moneyUse, CardParameter cardData)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
m_LabelUseItemCnt.text = systemText.Get("Card_0064", moneyUse.ToString());
|
|
m_LabelBuyPack.text = systemText.Get("Card_0077", cardData.CardName);
|
|
string text = CheckMyRotationCardBuyCheck(cardData);
|
|
if (cardData.IsResurgentCard)
|
|
{
|
|
SetWarningTextId("Card_0300");
|
|
}
|
|
else if (!cardData.IsAvailableFormat(Format.Unlimited, ClassType.None))
|
|
{
|
|
SetWarningTextId("Card_0204");
|
|
}
|
|
else if (cardData.SameKindNumMaxInUnlimited == 1)
|
|
{
|
|
SetWarningTextId("Card_0205");
|
|
}
|
|
else if (cardData.SameKindNumMaxInUnlimited == 2)
|
|
{
|
|
SetWarningTextId("Card_0206");
|
|
}
|
|
else if (text != null)
|
|
{
|
|
SetWarningText(text);
|
|
}
|
|
else if (Data.Crossover.IsWithinPracticePeriod)
|
|
{
|
|
int num = Mathf.Min(cardData.SameKindNumMaxInCrossoverMainClass, cardData.SameKindNumMaxInCrossoverSubClass);
|
|
if (num == 0)
|
|
{
|
|
SetWarningText(systemText.Get("Card_0277"));
|
|
}
|
|
else if (num < FormatBehaviorManager.GetDefaultBehaviour(Format.Crossover).DeckSameKindCardNumMax)
|
|
{
|
|
SetWarningText(systemText.Get("Card_0278", num.ToString()));
|
|
}
|
|
}
|
|
m_LabelItemName.text = systemText.Get("Common_0113");
|
|
int moneyAfter = moneyHave - moneyUse;
|
|
SetCardCommon(moneyHave, moneyAfter);
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
private string CheckMyRotationCardBuyCheck(CardParameter cardParameter)
|
|
{
|
|
if (!Data.MyRotationAllInfo.IsMyRotationEnable)
|
|
{
|
|
return null;
|
|
}
|
|
int num = 0;
|
|
int num2 = 0;
|
|
int num3 = 0;
|
|
IFormatBehavior defaultBehaviour = FormatBehaviorManager.GetDefaultBehaviour(Format.MyRotation);
|
|
foreach (MyRotationInfo myRotationInfo in Data.MyRotationAllInfo.MyRotationInfoList)
|
|
{
|
|
int sameCardCount = myRotationInfo.GetSameCardCount(cardParameter.BaseCardId);
|
|
if (sameCardCount != defaultBehaviour.DeckSameKindCardNumMax)
|
|
{
|
|
if (sameCardCount == 0)
|
|
{
|
|
num2++;
|
|
}
|
|
else
|
|
{
|
|
num++;
|
|
}
|
|
num3 = sameCardCount;
|
|
}
|
|
}
|
|
if (num == 0 && num2 == 0)
|
|
{
|
|
return null;
|
|
}
|
|
int count = Data.MyRotationAllInfo.MyRotationInfoList.Count;
|
|
if (num2 == count)
|
|
{
|
|
return Data.SystemText.Get("MyRotation_ID_19");
|
|
}
|
|
if (num2 > 0)
|
|
{
|
|
return Data.SystemText.Get("MyRotation_ID_20");
|
|
}
|
|
if (num == count)
|
|
{
|
|
return Data.SystemText.Get("MyRotation_ID_21", num3.ToString());
|
|
}
|
|
return Data.SystemText.Get("MyRotation_ID_22", num3.ToString());
|
|
}
|
|
|
|
public void SetCardSell(string moneyKindName, int moneyHave, int moneyGet, string cardName, bool inIsPremiumCard)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
m_LabelUseItemCnt.text = systemText.Get("Card_0079", moneyGet.ToString());
|
|
m_LabelBuyPack.text = systemText.Get("Card_0078", cardName);
|
|
m_LabelItemName.text = systemText.Get("Card_0097");
|
|
if (inIsPremiumCard)
|
|
{
|
|
_premiumCardWarning.gameObject.SetActive(value: true);
|
|
_premiumCardWarning.text = systemText.Get("Card_0144");
|
|
_confirmObj.transform.localPosition = new Vector3(0f, -40f, 0f);
|
|
_haveObj.transform.localPosition = new Vector3(0f, -40f, 0f);
|
|
}
|
|
else
|
|
{
|
|
_premiumCardWarning.gameObject.SetActive(value: false);
|
|
}
|
|
int moneyAfter = moneyHave + moneyGet;
|
|
SetCardCommon(moneyHave, moneyAfter);
|
|
HideJpnLawObj();
|
|
}
|
|
|
|
private void SetCardCommon(int moneyHave, int moneyAfter)
|
|
{
|
|
SetIconImage(UserGoods.Type.RedEther);
|
|
SystemText systemText = Data.SystemText;
|
|
m_LabelBeforeItemCnt.text = moneyHave.ToString();
|
|
m_LabelAfterItemCnt.text = systemText.Get("Shop_0045", moneyAfter.ToString());
|
|
m_LabelAfterItemUnit.text = systemText.Get("Card_0100");
|
|
}
|
|
|
|
public void SetWarningTextId(string warningTextId)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
SetWarningText(systemText.Get(warningTextId));
|
|
}
|
|
|
|
public void SetWarningText(string warningText)
|
|
{
|
|
_premiumCardWarning.gameObject.SetActive(value: true);
|
|
_premiumCardWarning.text = warningText;
|
|
_confirmObj.transform.localPosition = new Vector3(0f, -40f, 0f);
|
|
_haveObj.transform.localPosition = new Vector3(0f, -40f, 0f);
|
|
}
|
|
|
|
public IEnumerator SetCardPackPoint(int beforePoint, int afterPoint)
|
|
{
|
|
_tablePackPoint.gameObject.SetActive(value: true);
|
|
_labelBeforPackPoint.text = beforePoint.ToString();
|
|
_labelAfterPackPoint.text = afterPoint.ToString();
|
|
_confirmObj.transform.localPosition = new Vector3(0f, -32f, 0f);
|
|
_haveObj.transform.localPosition = new Vector3(0f, 0f, 0f);
|
|
if (_nonItemRoot != null)
|
|
{
|
|
_nonItemRoot.localPosition = new Vector3(0f, -12f, 0f);
|
|
}
|
|
yield return null;
|
|
_tablePackPoint.Reposition();
|
|
}
|
|
|
|
public IEnumerator SetCardPackPointWithPreRelease(int beforePoint, int afterPoint, int beforePrereleasePoint, int afterPrereleasePoint, bool arleadyLimitPreReleasePoint)
|
|
{
|
|
_tablePackPoint.gameObject.SetActive(value: true);
|
|
_labelBeforPackPoint.text = beforePoint.ToString();
|
|
_labelAfterPackPoint.text = afterPoint.ToString();
|
|
_preReleasePointArleadyMax.SetActive(arleadyLimitPreReleasePoint);
|
|
if (!arleadyLimitPreReleasePoint)
|
|
{
|
|
_preReleasePointTable.gameObject.SetActive(value: true);
|
|
}
|
|
_preReleasePointBeforeLabel.text = beforePrereleasePoint.ToString();
|
|
_preReleasePointAfterlabel.text = afterPrereleasePoint.ToString();
|
|
_confirmObj.transform.localPosition = new Vector3(0f, -32f, 0f);
|
|
_haveObj.transform.localPosition = new Vector3(0f, 0f, 0f);
|
|
_tablePackPoint.transform.localPosition = new Vector3(0f, -60f, 0f);
|
|
yield return null;
|
|
_tablePackPoint.Reposition();
|
|
_preReleasePointTable.Reposition();
|
|
}
|
|
|
|
public void SetFreePacksConfirmDialog(string purchaseText, int useNum, int beforeCount, int buyPackCount, string campaignName)
|
|
{
|
|
HideIcon();
|
|
m_LabelUseItemCnt.text = string.Empty;
|
|
m_LabelBuyPack.text = purchaseText;
|
|
_haveObj.SetActive(value: false);
|
|
_nonItemRoot.gameObject.SetActive(value: true);
|
|
_nonItemBeforeCountLabel.text = (beforeCount / buyPackCount).ToString();
|
|
_nonItemAfterCountLabel.text = ((beforeCount - useNum) / buyPackCount).ToString();
|
|
_nonItemRemainingLabel.text = Data.SystemText.Get("Shop_0224");
|
|
_nonItemUnitLabel.text = Data.SystemText.Get("Shop_0221");
|
|
_nonItemCentering.Reposition();
|
|
HideJpnLawObj();
|
|
SetCampaignName(campaignName);
|
|
}
|
|
|
|
public void SetFreePacksLayout()
|
|
{
|
|
_confirmObj.transform.localPosition = new Vector3(0f, -45f, 0f);
|
|
_nonItemRoot.localPosition = new Vector3(0f, -24f, 0f);
|
|
}
|
|
|
|
private void SetCampaignName(string name)
|
|
{
|
|
if (!(_campaignNameLabel == null))
|
|
{
|
|
_campaignNameLabel.gameObject.SetActive(value: true);
|
|
_campaignNameLabel.text = name;
|
|
}
|
|
}
|
|
}
|