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>
293 lines
9.0 KiB
C#
293 lines
9.0 KiB
C#
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
namespace Wizard;
|
|
|
|
internal class AreaSelectClearReward : MonoBehaviour
|
|
{
|
|
private class TextureTransformParam
|
|
{
|
|
public int Width { get; private set; }
|
|
|
|
public int Height { get; private set; }
|
|
|
|
public Vector3 Position { get; private set; }
|
|
|
|
public Quaternion Rotation { get; private set; }
|
|
|
|
public TextureTransformParam(int width, int height, Vector3 position, Quaternion rotation)
|
|
{
|
|
Width = width;
|
|
Height = height;
|
|
Position = position;
|
|
Rotation = rotation;
|
|
}
|
|
}
|
|
|
|
private readonly Dictionary<UserGoods.Type, TextureTransformParam> USERGOODS_TEXTURE_LAYOUT_DICT = new Dictionary<UserGoods.Type, TextureTransformParam>
|
|
{
|
|
{
|
|
UserGoods.Type.Item,
|
|
new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Sleeve,
|
|
new TextureTransformParam(80, 108, new Vector3(12f, 12f, 0f), Quaternion.Euler(0f, 0f, -15f))
|
|
},
|
|
{
|
|
UserGoods.Type.Emblem,
|
|
new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Degree,
|
|
new TextureTransformParam(169, 43, new Vector3(44f, -10f, 0f), Quaternion.identity)
|
|
},
|
|
{
|
|
UserGoods.Type.Skin,
|
|
new TextureTransformParam(100, 80, Vector3.zero, Quaternion.identity)
|
|
}
|
|
};
|
|
|
|
private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f);
|
|
|
|
private readonly Color32 ACQUIRED_GRAY_COLOR = new Color32(144, 144, 144, byte.MaxValue);
|
|
|
|
private readonly Vector3 DEFAULT_NUM_POSITION = new Vector3(48f, -25f, 0f);
|
|
|
|
private readonly Vector3 CARD_NUM_POSITION = new Vector3(66f, -25f, 0f);
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutCard;
|
|
|
|
[SerializeField]
|
|
private GameObject _objAttachCard;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteCardAcquiredMask;
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutSprite;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteGoods;
|
|
|
|
[SerializeField]
|
|
private GameObject _objLayoutTexture;
|
|
|
|
[SerializeField]
|
|
private UITexture _textureGoods;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelNum;
|
|
|
|
private List<UIBase_CardManager.CardObjData> _cardObjList;
|
|
|
|
private GameObject _cardObjEvacuationRoot;
|
|
|
|
private GameObject _displayedCardObj;
|
|
|
|
public UserGoods.Type RewardGoodsType { get; private set; }
|
|
|
|
public void Init(List<UIBase_CardManager.CardObjData> cardObjList, GameObject cardObjEvacuationRoot)
|
|
{
|
|
_cardObjList = cardObjList;
|
|
_cardObjEvacuationRoot = cardObjEvacuationRoot;
|
|
HideAllLayout();
|
|
}
|
|
|
|
public void ShowReward(UserGoods.Type goodsType, long goodsId, int goodsCount, bool isAcquired)
|
|
{
|
|
HideAllLayout();
|
|
switch (goodsType)
|
|
{
|
|
case UserGoods.Type.Card:
|
|
ShowCard((int)goodsId, goodsCount, isAcquired);
|
|
break;
|
|
case UserGoods.Type.RedEther:
|
|
case UserGoods.Type.Rupy:
|
|
ShowSprite(goodsType, goodsCount, isAcquired);
|
|
break;
|
|
case UserGoods.Type.Item:
|
|
case UserGoods.Type.Sleeve:
|
|
case UserGoods.Type.Emblem:
|
|
case UserGoods.Type.Degree:
|
|
case UserGoods.Type.Skin:
|
|
ShowTexture(goodsType, goodsId, goodsCount, isAcquired);
|
|
break;
|
|
}
|
|
RewardGoodsType = goodsType;
|
|
}
|
|
|
|
public Transform GetRewardTransform()
|
|
{
|
|
switch (RewardGoodsType)
|
|
{
|
|
case UserGoods.Type.Card:
|
|
return _objAttachCard.transform;
|
|
case UserGoods.Type.RedEther:
|
|
case UserGoods.Type.Rupy:
|
|
return _spriteGoods.transform;
|
|
case UserGoods.Type.Item:
|
|
case UserGoods.Type.Sleeve:
|
|
case UserGoods.Type.Emblem:
|
|
case UserGoods.Type.Degree:
|
|
case UserGoods.Type.Skin:
|
|
return _textureGoods.transform;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private void HideAllLayout()
|
|
{
|
|
_objLayoutCard.SetActive(value: false);
|
|
_objLayoutSprite.SetActive(value: false);
|
|
_objLayoutTexture.SetActive(value: false);
|
|
}
|
|
|
|
private void ShowCard(int cardId, int cardCount, bool isAcquired)
|
|
{
|
|
if (_displayedCardObj != null)
|
|
{
|
|
_displayedCardObj.SetActive(value: false);
|
|
_displayedCardObj.transform.SetParent(_cardObjEvacuationRoot.transform);
|
|
}
|
|
_objLayoutCard.SetActive(value: true);
|
|
UIBase_CardManager.CardObjData cardObjData = GetCardObjData(cardId);
|
|
if (cardObjData == null)
|
|
{
|
|
_objLayoutCard.SetActive(value: false);
|
|
return;
|
|
}
|
|
_displayedCardObj = cardObjData.CardObj;
|
|
_displayedCardObj.transform.SetParent(_objAttachCard.transform);
|
|
_displayedCardObj.transform.localPosition = Vector3.zero;
|
|
_displayedCardObj.transform.localScale = Vector3.one;
|
|
_displayedCardObj.transform.rotation = CARDOBJECT_ROTATION_QUATERNION;
|
|
_displayedCardObj.SetActive(value: true);
|
|
CardListTemplate component = _displayedCardObj.GetComponent<CardListTemplate>();
|
|
component._newLabel.gameObject.SetActive(value: false);
|
|
_labelNum.text = Data.SystemText.Get("Common_0040", cardCount.ToString());
|
|
_labelNum.transform.localPosition = CARD_NUM_POSITION;
|
|
_labelNum.gameObject.SetActive(value: true);
|
|
_spriteCardAcquiredMask.gameObject.SetActive(isAcquired);
|
|
UIManager.SetObjectToGrey(_displayedCardObj, isAcquired);
|
|
if (isAcquired)
|
|
{
|
|
_spriteCardAcquiredMask.depth = component._frameSprite.depth + -1;
|
|
component._cardTexture.depth = component._frameSprite.depth + -2;
|
|
_displayedCardObj.GetComponent<BoxCollider>().enabled = true;
|
|
}
|
|
}
|
|
|
|
private UIBase_CardManager.CardObjData GetCardObjData(int cardId)
|
|
{
|
|
for (int i = 0; i < _cardObjList.Count; i++)
|
|
{
|
|
UIBase_CardManager.CardObjData cardObjData = _cardObjList[i];
|
|
if (cardObjData != null && cardObjData.ids == cardId)
|
|
{
|
|
return cardObjData;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private void ShowSprite(UserGoods.Type goodsType, int goodsCount, bool isAcquired)
|
|
{
|
|
_objLayoutSprite.SetActive(value: true);
|
|
_spriteGoods.spriteName = AreaSelInfo.GetPresentItemSpriteName((int)goodsType);
|
|
_spriteGoods.gameObject.SetActive(value: true);
|
|
_labelNum.text = Data.SystemText.Get("Common_0040", goodsCount.ToString());
|
|
_labelNum.transform.localPosition = DEFAULT_NUM_POSITION;
|
|
_labelNum.gameObject.SetActive(value: true);
|
|
_spriteGoods.color = GetAcquiredColor(isAcquired);
|
|
}
|
|
|
|
private void ShowTexture(UserGoods.Type goodsType, long goodsId, int goodsCount, bool isAcquired)
|
|
{
|
|
_objLayoutTexture.SetActive(value: true);
|
|
InitializeGoodsTexture(_textureGoods, goodsType, goodsId);
|
|
TextureTransformParam textureTransformParam = USERGOODS_TEXTURE_LAYOUT_DICT[goodsType];
|
|
_textureGoods.width = textureTransformParam.Width;
|
|
_textureGoods.height = textureTransformParam.Height;
|
|
_textureGoods.transform.localPosition = textureTransformParam.Position;
|
|
_textureGoods.transform.localRotation = textureTransformParam.Rotation;
|
|
if (goodsType == UserGoods.Type.Item)
|
|
{
|
|
_labelNum.text = Data.SystemText.Get("Common_0040", goodsCount.ToString());
|
|
_labelNum.transform.localPosition = DEFAULT_NUM_POSITION;
|
|
_labelNum.gameObject.SetActive(value: true);
|
|
}
|
|
else
|
|
{
|
|
_labelNum.gameObject.SetActive(value: false);
|
|
}
|
|
_textureGoods.color = GetAcquiredColor(isAcquired);
|
|
}
|
|
|
|
private void InitializeGoodsTexture(UITexture texture, UserGoods.Type goodsType, long goodsId)
|
|
{
|
|
string text = string.Empty;
|
|
switch (goodsType)
|
|
{
|
|
default:
|
|
return;
|
|
case UserGoods.Type.Sleeve:
|
|
{
|
|
long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId);
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true);
|
|
break;
|
|
}
|
|
case UserGoods.Type.Emblem:
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true);
|
|
break;
|
|
case UserGoods.Type.Degree:
|
|
DegreeHelper.InitializeDegree(texture, goodsId, DegreeHelper.DegreeType.SMALL);
|
|
break;
|
|
case UserGoods.Type.Skin:
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true);
|
|
break;
|
|
case UserGoods.Type.Item:
|
|
{
|
|
Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == goodsId);
|
|
if (item == null)
|
|
{
|
|
return;
|
|
}
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
|
break;
|
|
}
|
|
case UserGoods.Type.Card:
|
|
case UserGoods.Type.Rupy:
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(text))
|
|
{
|
|
return;
|
|
}
|
|
texture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(text);
|
|
_textureGoods.material = null;
|
|
_textureGoods.gameObject.SetActive(value: true);
|
|
if (goodsType == UserGoods.Type.Sleeve)
|
|
{
|
|
long existingSleeveId2 = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId);
|
|
Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId2);
|
|
if (sleeve.IsPremiumSleeve)
|
|
{
|
|
UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(_textureGoods, sleeve.sleeve_id);
|
|
}
|
|
}
|
|
}
|
|
|
|
private Color32 GetAcquiredColor(bool isAcquired)
|
|
{
|
|
if (isAcquired)
|
|
{
|
|
return ACQUIRED_GRAY_COLOR;
|
|
}
|
|
return Color.white;
|
|
}
|
|
}
|