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>
504 lines
14 KiB
C#
504 lines
14 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public class AreaSelInfo : MonoBehaviour
|
|
{
|
|
private enum eTableCategory
|
|
{
|
|
}
|
|
|
|
private static readonly Vector3 CLEARPRESENT_CARD_COLLISIONSIZE = new Vector3(175f, 230f, 1f);
|
|
|
|
private static readonly string[] CLEARPRESENT_NAME = new string[10] { "", "Common_0205", "", "Common_0201", "", "", "", "", "", "Common_0115" };
|
|
|
|
private static readonly string[] CLEARPRESENT_THUMBNAIL_SPRITENAME = new string[10] { "", "thumbnail_liquid", "", "thumbnail_crystal", "", "", "thumbnail_card", "thumbnail_emblem", "thumbnail_title", "thumbnail_rupy" };
|
|
|
|
private readonly Vector3 REWARD_TABLE_DEFAULT_POSITION = new Vector3(45f, -85.3f, 0f);
|
|
|
|
private readonly Vector3 REWARD_TABLE_CARD_POSITION = new Vector3(28.5f, -85.3f, 0f);
|
|
|
|
private readonly Dictionary<UserGoods.Type, float> REWARD_BG_OFFSET_MAGNIFICATION = new Dictionary<UserGoods.Type, float>
|
|
{
|
|
{
|
|
UserGoods.Type.Degree,
|
|
2f
|
|
},
|
|
{
|
|
UserGoods.Type.Card,
|
|
1.2f
|
|
},
|
|
{
|
|
UserGoods.Type.Sleeve,
|
|
1.2f
|
|
},
|
|
{
|
|
UserGoods.Type.Skin,
|
|
1.2f
|
|
},
|
|
{
|
|
UserGoods.Type.RedEther,
|
|
1f
|
|
},
|
|
{
|
|
UserGoods.Type.Rupy,
|
|
1f
|
|
},
|
|
{
|
|
UserGoods.Type.Item,
|
|
1f
|
|
},
|
|
{
|
|
UserGoods.Type.Emblem,
|
|
1f
|
|
}
|
|
};
|
|
|
|
[SerializeField]
|
|
private GameObject _clearRewardPrefab;
|
|
|
|
private List<AreaSelectClearReward> _clearRewardList = new List<AreaSelectClearReward>();
|
|
|
|
[SerializeField]
|
|
private UITable _tableRoot;
|
|
|
|
[SerializeField]
|
|
private UITable[] _tableRewardsCategory = new UITable[3];
|
|
|
|
[SerializeField]
|
|
private GameObject _cardObjEvacuationRoot;
|
|
|
|
[SerializeField]
|
|
private UISprite _spriteRewardBackground;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelAcquired;
|
|
|
|
private List<UIBase_CardManager.CardObjData> _cardObjList = new List<UIBase_CardManager.CardObjData>();
|
|
|
|
[SerializeField]
|
|
private GameObject CardDetailRoot;
|
|
|
|
[SerializeField]
|
|
private CardDetailUI CardDetailPrefab;
|
|
|
|
private CardDetailUI _cardDetail;
|
|
|
|
private List<string> _loadFileList = new List<string>();
|
|
|
|
private bool _isLoadEnd = true;
|
|
|
|
public void SetClearPresent(StoryChapterData chapterData)
|
|
{
|
|
if (chapterData == null || chapterData.Rewards == null)
|
|
{
|
|
return;
|
|
}
|
|
if (chapterData.Rewards.Length != 0)
|
|
{
|
|
base.gameObject.SetActive(value: true);
|
|
bool isCleared = chapterData.IsCleared;
|
|
for (int i = 0; i < _clearRewardList.Count; i++)
|
|
{
|
|
_clearRewardList[i].gameObject.SetActive(value: false);
|
|
}
|
|
List<long> list = new List<long>();
|
|
for (int j = 0; j < chapterData.Rewards.Length; j++)
|
|
{
|
|
StoryChapterData.StoryReward storyReward = chapterData.Rewards[j];
|
|
if (storyReward == null)
|
|
{
|
|
continue;
|
|
}
|
|
if (j >= _clearRewardList.Count)
|
|
{
|
|
break;
|
|
}
|
|
if (storyReward.RewardType == 5)
|
|
{
|
|
if (list.Contains(storyReward.RewardUserGoodsId))
|
|
{
|
|
continue;
|
|
}
|
|
list.Add(storyReward.RewardUserGoodsId);
|
|
}
|
|
_clearRewardList[j].gameObject.SetActive(value: true);
|
|
_clearRewardList[j].ShowReward((UserGoods.Type)storyReward.RewardType, storyReward.RewardUserGoodsId, storyReward.RewardNumber, isCleared);
|
|
}
|
|
RepositionRewards();
|
|
SetRewardBackgroundWidth();
|
|
SetAcquiredLabel(isCleared);
|
|
}
|
|
else
|
|
{
|
|
base.gameObject.SetActive(value: false);
|
|
}
|
|
}
|
|
|
|
private void RepositionRewards()
|
|
{
|
|
for (int i = 0; i < _tableRewardsCategory.Length; i++)
|
|
{
|
|
_tableRewardsCategory[i].gameObject.SetActive(value: false);
|
|
}
|
|
for (int j = 0; j < _clearRewardList.Count; j++)
|
|
{
|
|
if (_clearRewardList[j].gameObject.activeSelf)
|
|
{
|
|
int num = _clearRewardList[j].RewardGoodsType switch
|
|
{
|
|
UserGoods.Type.Card => 0,
|
|
UserGoods.Type.Sleeve => 1,
|
|
_ => 2,
|
|
};
|
|
Transform obj = _clearRewardList[j].gameObject.transform;
|
|
obj.SetParent(_tableRewardsCategory[num].transform);
|
|
obj.SetAsLastSibling();
|
|
_tableRewardsCategory[num].gameObject.SetActive(value: true);
|
|
}
|
|
}
|
|
for (int k = 0; k < _tableRewardsCategory.Length; k++)
|
|
{
|
|
if (_tableRewardsCategory[k].gameObject.activeInHierarchy)
|
|
{
|
|
_tableRewardsCategory[k].Reposition();
|
|
}
|
|
}
|
|
_tableRoot.Reposition();
|
|
if (_tableRewardsCategory[0].gameObject.activeInHierarchy)
|
|
{
|
|
_tableRoot.transform.localPosition = REWARD_TABLE_CARD_POSITION;
|
|
for (int l = 0; l < _tableRewardsCategory.Length; l++)
|
|
{
|
|
if (l != 0)
|
|
{
|
|
Vector3 localPosition = _tableRewardsCategory[l].transform.localPosition;
|
|
localPosition.x += -16f;
|
|
_tableRewardsCategory[l].transform.localPosition = localPosition;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_tableRoot.transform.localPosition = REWARD_TABLE_DEFAULT_POSITION;
|
|
}
|
|
}
|
|
|
|
private void SetRewardBackgroundWidth()
|
|
{
|
|
float num = 0f;
|
|
for (int i = 0; i < _clearRewardList.Count; i++)
|
|
{
|
|
if (_clearRewardList[i].gameObject.activeInHierarchy)
|
|
{
|
|
UserGoods.Type rewardGoodsType = _clearRewardList[i].RewardGoodsType;
|
|
num += REWARD_BG_OFFSET_MAGNIFICATION[rewardGoodsType];
|
|
}
|
|
}
|
|
int width = 250 + (int)(90f * num);
|
|
_spriteRewardBackground.width = width;
|
|
}
|
|
|
|
private void SetAcquiredLabel(bool isAcquired)
|
|
{
|
|
_labelAcquired.gameObject.SetActive(isAcquired);
|
|
if (!isAcquired)
|
|
{
|
|
return;
|
|
}
|
|
float a = float.MaxValue;
|
|
float num = float.MinValue;
|
|
bool flag = true;
|
|
for (int i = 0; i < _clearRewardList.Count; i++)
|
|
{
|
|
if (_clearRewardList[i].gameObject.activeInHierarchy)
|
|
{
|
|
Transform rewardTransform = _clearRewardList[i].GetRewardTransform();
|
|
a = Mathf.Min(a, rewardTransform.position.x);
|
|
num = Mathf.Max(num, rewardTransform.position.x);
|
|
if (_clearRewardList[i].RewardGoodsType != UserGoods.Type.Degree)
|
|
{
|
|
flag = false;
|
|
}
|
|
}
|
|
}
|
|
Vector3 position = _labelAcquired.transform.position;
|
|
position.x = Mathf.Lerp(a, num, 0.5f);
|
|
_labelAcquired.transform.position = position;
|
|
Vector3 localPosition = _labelAcquired.transform.localPosition;
|
|
localPosition.y = _tableRoot.transform.localPosition.y + (flag ? (-10f) : 0f);
|
|
_labelAcquired.transform.localPosition = localPosition;
|
|
}
|
|
|
|
public void LoadClearPresent(IReadOnlyList<StoryChapterData> stageDataList)
|
|
{
|
|
if (!_isLoadEnd)
|
|
{
|
|
return;
|
|
}
|
|
_isLoadEnd = false;
|
|
ReleaseClearPresent();
|
|
if (CardDetailPrefab != null)
|
|
{
|
|
_cardDetail = Object.Instantiate(CardDetailPrefab);
|
|
_cardDetail.transform.parent = CardDetailRoot.transform;
|
|
_cardDetail.transform.localPosition = Vector3.zero;
|
|
_cardDetail.transform.localScale = Vector3.one;
|
|
_cardDetail.OnClose = OnCardDetailClose;
|
|
_cardDetail.gameObject.SetActive(value: false);
|
|
_cardDetail.Initialize(_cardDetail.gameObject.layer, CardMaster.CardMasterId.Default);
|
|
_cardDetail.IsShowFlavorTextButton = true;
|
|
_cardDetail.IsShowVoiceButton = true;
|
|
_cardDetail.IsShowEvolutionButton = true;
|
|
}
|
|
_clearRewardList.Clear();
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
AreaSelectClearReward component = NGUITools.AddChild(_tableRoot.gameObject, _clearRewardPrefab).GetComponent<AreaSelectClearReward>();
|
|
_clearRewardList.Add(component);
|
|
}
|
|
List<int> list = new List<int>(2);
|
|
List<string> loadPath = new List<string>();
|
|
StoryChapterData.StoryReward storyReward = null;
|
|
for (int j = 0; j < stageDataList.Count; j++)
|
|
{
|
|
for (int k = 0; k < stageDataList[j].Rewards.Length; k++)
|
|
{
|
|
string text = string.Empty;
|
|
storyReward = stageDataList[j].Rewards[k];
|
|
if (storyReward == null)
|
|
{
|
|
continue;
|
|
}
|
|
if (storyReward.RewardType == 5)
|
|
{
|
|
if (!list.Contains((int)storyReward.RewardUserGoodsId))
|
|
{
|
|
list.Add((int)storyReward.RewardUserGoodsId);
|
|
}
|
|
}
|
|
else if (storyReward.RewardType == 4)
|
|
{
|
|
string userGoodsImageName = UserGoods.GetUserGoodsImageName(UserGoods.Type.Item, storyReward.RewardUserGoodsId);
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item);
|
|
}
|
|
else if (storyReward.RewardType == 6)
|
|
{
|
|
long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(storyReward.RewardUserGoodsId);
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture);
|
|
Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId);
|
|
if (sleeve.IsPremiumSleeve)
|
|
{
|
|
UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve);
|
|
}
|
|
}
|
|
else if (storyReward.RewardType == 8)
|
|
{
|
|
foreach (string degreeResource in DegreeHelper.GetDegreeResourceList(storyReward.RewardUserGoodsId, DegreeHelper.DegreeType.SMALL, isFetch: false))
|
|
{
|
|
if (!loadPath.Contains(degreeResource))
|
|
{
|
|
loadPath.Add(degreeResource);
|
|
}
|
|
}
|
|
}
|
|
else if (storyReward.RewardType == 7)
|
|
{
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M);
|
|
}
|
|
else if (storyReward.RewardType == 10)
|
|
{
|
|
text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail);
|
|
}
|
|
if (text != string.Empty && !loadPath.Contains(text))
|
|
{
|
|
loadPath.Add(text);
|
|
}
|
|
}
|
|
}
|
|
if (list.Count == 0 && loadPath.Count == 0)
|
|
{
|
|
_isLoadEnd = true;
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine(LoadClearPresentInner(list, loadPath));
|
|
}
|
|
}
|
|
|
|
private IEnumerator LoadClearPresentInner(List<int> cardidlist, List<string> rewardPathList)
|
|
{
|
|
UIManager uiMgr = UIManager.GetInstance();
|
|
UIBase_CardManager uiCardMgr = uiMgr.getUIBase_CardManager();
|
|
bool isLoadRewardEnd = false;
|
|
_loadFileList.Clear();
|
|
bool isLoadCard = cardidlist.Count > 0;
|
|
if (isLoadCard)
|
|
{
|
|
int layer = LayerMask.NameToLayer("FrontUI");
|
|
uiMgr.CardLoadSelect(base.gameObject, cardidlist, layer, is2D: true);
|
|
}
|
|
StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(rewardPathList, delegate
|
|
{
|
|
_loadFileList.AddRange(rewardPathList);
|
|
isLoadRewardEnd = true;
|
|
}));
|
|
while ((isLoadCard && (!uiCardMgr.getCreateEndFlag() || !uiCardMgr.isAssetAllReady)) || !isLoadRewardEnd)
|
|
{
|
|
yield return null;
|
|
}
|
|
_cardObjList = uiMgr.getCardList2DObjs();
|
|
if (_cardObjList != null)
|
|
{
|
|
for (int num = 0; num < _cardObjList.Count; num++)
|
|
{
|
|
GameObject cardObj = _cardObjList[num].CardObj;
|
|
if (!(cardObj == null))
|
|
{
|
|
cardObj.SetActive(value: false);
|
|
UITexture[] componentsInChildren = cardObj.GetComponentsInChildren<UITexture>(includeInactive: true);
|
|
for (int num2 = 0; num2 < componentsInChildren.Length; num2++)
|
|
{
|
|
componentsInChildren[num2].depth += 50;
|
|
}
|
|
UILabel[] componentsInChildren2 = cardObj.GetComponentsInChildren<UILabel>(includeInactive: true);
|
|
for (int num3 = 0; num3 < componentsInChildren2.Length; num3++)
|
|
{
|
|
componentsInChildren2[num3].depth += 50;
|
|
}
|
|
UISprite[] componentsInChildren3 = cardObj.GetComponentsInChildren<UISprite>(includeInactive: true);
|
|
for (int num4 = 0; num4 < componentsInChildren3.Length; num4++)
|
|
{
|
|
componentsInChildren3[num4].depth += 50;
|
|
}
|
|
cardObj.GetComponent<CardListTemplate>().HideNum();
|
|
cardObj.AddComponent<BoxCollider>().size = CLEARPRESENT_CARD_COLLISIONSIZE;
|
|
cardObj.AddComponent<UIEventListener>().onClick = _cardDetail.OnPushCardDetailOn;
|
|
}
|
|
}
|
|
}
|
|
for (int num5 = 0; num5 < 3; num5++)
|
|
{
|
|
_clearRewardList[num5].Init(_cardObjList, _cardObjEvacuationRoot);
|
|
}
|
|
_isLoadEnd = true;
|
|
}
|
|
|
|
public void ReleaseClearPresent()
|
|
{
|
|
if (_cardDetail != null)
|
|
{
|
|
Object.Destroy(_cardDetail.gameObject);
|
|
_cardDetail = null;
|
|
}
|
|
if (_cardObjList != null)
|
|
{
|
|
for (int i = 0; i < _cardObjList.Count; i++)
|
|
{
|
|
Object.Destroy(_cardObjList[i].CardObj.gameObject);
|
|
}
|
|
_cardObjList.Clear();
|
|
}
|
|
Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList);
|
|
_loadFileList.Clear();
|
|
}
|
|
|
|
private void OnCardDetailClose()
|
|
{
|
|
}
|
|
|
|
public bool GetLoadEnd()
|
|
{
|
|
return _isLoadEnd;
|
|
}
|
|
|
|
public void MoveToScreen(bool isIn, bool isImmediate)
|
|
{
|
|
MoveToScreenObj(base.gameObject, isIn ? 0f : (-1120f), isImmediate ? 0f : 0.5f);
|
|
}
|
|
|
|
public void MoveToScreenObj(GameObject target, float localPosX, float time)
|
|
{
|
|
if (Mathf.Approximately(time, 0f))
|
|
{
|
|
Vector3 localPosition = target.transform.localPosition;
|
|
localPosition.x = localPosX;
|
|
target.transform.localPosition = localPosition;
|
|
return;
|
|
}
|
|
iTween.MoveTo(target, iTween.Hash("islocal", true, "x", localPosX, "time", time));
|
|
}
|
|
|
|
public static string GetPresentItemName(int itemID, long userGoodsId)
|
|
{
|
|
switch ((UserGoods.Type)itemID)
|
|
{
|
|
case UserGoods.Type.RedEther:
|
|
case UserGoods.Type.Rupy:
|
|
return Data.SystemText.Get(CLEARPRESENT_NAME[itemID]);
|
|
case UserGoods.Type.Item:
|
|
{
|
|
Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId);
|
|
if (item == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return item.name;
|
|
}
|
|
case UserGoods.Type.Sleeve:
|
|
{
|
|
Sleeve sleeve = Data.Master.SleeveMgr.Get(userGoodsId);
|
|
if (sleeve == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return sleeve.sleeve_name;
|
|
}
|
|
case UserGoods.Type.Emblem:
|
|
{
|
|
Emblem emblem = Data.Master.EmblemMgr.Get(userGoodsId);
|
|
if (emblem == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return emblem._name;
|
|
}
|
|
case UserGoods.Type.Degree:
|
|
{
|
|
Degree degree = Data.Master.DegreeMgr.Get((int)userGoodsId);
|
|
if (degree == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return degree._name;
|
|
}
|
|
case UserGoods.Type.Skin:
|
|
{
|
|
ClassCharacterMasterData charaPrmByCharaId = null; // Pre-Phase-5b: no chara master headless
|
|
if (charaPrmByCharaId == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return charaPrmByCharaId.chara_name;
|
|
}
|
|
case UserGoods.Type.SpotCardPoint:
|
|
return Data.SystemText.Get("Common_0161");
|
|
case UserGoods.Type.MyPageBG:
|
|
return Data.Master.MyPageCustomBGMaster[userGoodsId.ToString()].Name;
|
|
default:
|
|
return string.Empty;
|
|
}
|
|
}
|
|
|
|
public static string GetPresentItemSpriteName(int itemID)
|
|
{
|
|
if (itemID < 0 || itemID >= CLEARPRESENT_THUMBNAIL_SPRITENAME.Length)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return CLEARPRESENT_THUMBNAIL_SPRITENAME[itemID];
|
|
}
|
|
}
|