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>
This commit is contained in:
@@ -11,39 +11,14 @@ public class DeckCreateMenuUI : MonoBehaviour
|
||||
{
|
||||
private enum DeckCopyCodeType
|
||||
{
|
||||
QRCode,
|
||||
DeckCode
|
||||
}
|
||||
|
||||
public const int DECK_CODE_LENGTH_MIN = 4;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnCreateNew;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnCopy;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnDeckCode;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnAutoDeck;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _btnCamera;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _btnLibrary;
|
||||
|
||||
[SerializeField]
|
||||
private DeckCopyDialog _deckCopyDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private DeckCopyDialog _useSubClassDeckCopyDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private SubClassSelectDialog _subClassSelectDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _foilPreferred;
|
||||
|
||||
@@ -63,10 +38,6 @@ public class DeckCreateMenuUI : MonoBehaviour
|
||||
|
||||
private Action _onStartChangeViewScene;
|
||||
|
||||
private const float CENTER_SEPARATOR_LINE_OFFSET = -70f;
|
||||
|
||||
private static readonly Version ENABLE_USE_CAMERA_LIBRARY_IOS_VERSION = new Version("11.0");
|
||||
|
||||
public static void ShowDeckCreateMenu(DeckData deck, ConventionDeckList conventionDeckList, Action onStartChangeViewScene = null)
|
||||
{
|
||||
Format format = deck.Format;
|
||||
@@ -114,525 +85,8 @@ public class DeckCreateMenuUI : MonoBehaviour
|
||||
component._onStartChangeViewScene = onStartChangeViewScene;
|
||||
}
|
||||
|
||||
private void OnSelectFinally()
|
||||
{
|
||||
DeckCardEditUI.CurrentDeckName = null;
|
||||
if (_parentDialog != null)
|
||||
{
|
||||
_parentDialog.CloseWithoutSelect();
|
||||
_parentDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIEventListener.Get(m_btnCreateNew.gameObject).onClick = OnClickCreateNew;
|
||||
UIEventListener.Get(m_btnCopy.gameObject).onClick = OnClickCopy;
|
||||
UIEventListener.Get(m_btnDeckCode.gameObject).onClick = OnClickDeckCode;
|
||||
UIEventListener.Get(m_btnAutoDeck.gameObject).onClick = OnClickAutoDeck;
|
||||
UIEventListener.Get(_btnCamera.gameObject).onClick = OnClickFromCamera;
|
||||
UIEventListener.Get(_btnLibrary.gameObject).onClick = OnClickFromLibrary;
|
||||
}
|
||||
|
||||
private void SetParentDialog(DialogBase dialog)
|
||||
{
|
||||
_parentDialog = dialog;
|
||||
}
|
||||
|
||||
private void OnClickCreateNew(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
|
||||
ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnClickCopy(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
Format format = _format;
|
||||
if (format == Format.Crossover)
|
||||
{
|
||||
format = Format.All;
|
||||
}
|
||||
DeckInfoTask task = new DeckInfoTask();
|
||||
task.SetParameterForCopySrcGet(Format.All, format);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
DeckGroupListData deckGroupListData = task.DeckGroupListData;
|
||||
if (!_formatBehavior.UseSubClass)
|
||||
{
|
||||
deckGroupListData.RemoveUseSubClassDeckList();
|
||||
}
|
||||
if (_format != Format.MyRotation)
|
||||
{
|
||||
deckGroupListData.RemoveFormat(Format.MyRotation);
|
||||
}
|
||||
deckGroupListData.ForceVisiblePreRotation(Prerelease.Status != Prerelease.eStatus.NONE);
|
||||
Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT);
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Card_0109"), deckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: false, returnDeckSelect, new DeckSelectUI.InitOptions
|
||||
{
|
||||
OnUpdateDeckUICustomize = OnUpdateDeckUIForConvention
|
||||
}).SetPanelDepth(12);
|
||||
_parentDialog.Close();
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnUpdateDeckUIForConvention(DeckUI deckUI)
|
||||
{
|
||||
if (_conventionDeckList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!deckUI.Deck.IsUsable(canUseNonPossessionCard: true))
|
||||
{
|
||||
deckUI.SetSelectable(isSelectable: false);
|
||||
return;
|
||||
}
|
||||
bool flag = _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckClassID());
|
||||
if (_formatBehavior.UseSubClass && _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckSubClassID()))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0085"));
|
||||
deckUI.SetSelectable(isSelectable: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickDeckCode(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
DialogBase nameEditDialog = InputDialog.Create(16, 16, UIInput.KeyboardType.EmailAddress);
|
||||
nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0110");
|
||||
nameEditDialog.InputAreaObjs.labels[3].text = "";
|
||||
nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0111"));
|
||||
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.QuestSelectionPage))
|
||||
{
|
||||
AllLabelColorChanger.ChangeAllLabel(nameEditDialog.InputAreaObjs.gameObject);
|
||||
}
|
||||
Action method_btn = delegate
|
||||
{
|
||||
string text = nameEditDialog.InputAreaObjs.labels[0].text;
|
||||
GetDeckDataFromCodeTask getDeckDataFromCodeTask = new GetDeckDataFromCodeTask();
|
||||
getDeckDataFromCodeTask.SetParameter(text);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(getDeckDataFromCodeTask, OnSuccessDeckCodeInfo, OnFailedDeckCodeInfo, OnFailedDeckCodeInfo, encrypt: false));
|
||||
};
|
||||
nameEditDialog.SetButtonDelegate(method_btn);
|
||||
nameEditDialog.SetPanelDepth(2000);
|
||||
nameEditDialog.SetButtonDisable(isEnableOK: true);
|
||||
UIInput deckCodeInput = nameEditDialog.GetComponentInChildren<UIInput>();
|
||||
if (deckCodeInput != null)
|
||||
{
|
||||
deckCodeInput.onChange.Add(new EventDelegate(delegate
|
||||
{
|
||||
nameEditDialog.SetButtonDisable(deckCodeInput.value.Length < 4);
|
||||
}));
|
||||
}
|
||||
_parentDialog.Close();
|
||||
}
|
||||
|
||||
private void OnClickAutoDeck(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.AUTO_DECK_CREATE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
bool canUseNonPossessionCard = _conventionDeckList == null;
|
||||
DeckCardEditUI.SetCreateAutoParameter(_format, canUseNonPossessionCard);
|
||||
ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
|
||||
ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnClickFromCamera(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
GameObject qrCameraObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
|
||||
QrCamera qrCamera = qrCameraObject.GetComponent<QrCamera>();
|
||||
UIButton backButton = qrCamera.backButton;
|
||||
qrCamera.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
UIManager.GetInstance().StartCoroutine(qrCamera.StartQRCamera(qrCameraObject, _formatBehavior.CardMasterId, delegate
|
||||
{
|
||||
_parentDialog.Close();
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
backButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL);
|
||||
qrCamera.StopQRCamera();
|
||||
UnityEngine.Object.Destroy(qrCameraObject);
|
||||
}));
|
||||
}, delegate
|
||||
{
|
||||
qrCamera.StopQRCamera();
|
||||
UnityEngine.Object.Destroy(qrCameraObject);
|
||||
FailedToStartQRCamera();
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
_parentDialog.Close();
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnClickFromLibrary(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
|
||||
QrCamera component = gameObject.GetComponent<QrCamera>();
|
||||
component.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
|
||||
component.StartGetQRCodeFromImageFile(gameObject, _formatBehavior.CardMasterId);
|
||||
UnityEngine.Object.Destroy(gameObject);
|
||||
_parentDialog.Close();
|
||||
}
|
||||
|
||||
private void FailedToStartQRCamera()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0270"));
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void ButtonMaintenance()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0266"));
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
}
|
||||
|
||||
private DialogBase CreateDeckCopyDialog(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
bool flag = _formatBehavior.UseSubClass && FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass;
|
||||
if (_format == Format.MyRotation)
|
||||
{
|
||||
if (deck.Format == Format.MyRotation)
|
||||
{
|
||||
return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
return DeckCopyDialog.CreateDeckCopyDialogForMyRotation(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return DeckCopyDialog.CreateDeckCopyDialogUseSubClass(_useSubClassDeckCopyDialogPrefab, deck);
|
||||
}
|
||||
return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
|
||||
private void returnDeckSelect(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
DialogBase dialog = CreateDeckCopyDialog(dialogDeckList, deck);
|
||||
dialog.onPushButton1 = delegate
|
||||
{
|
||||
if (!_formatBehavior.UseSubClass)
|
||||
{
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
}
|
||||
else if (FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS))
|
||||
{
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnSelectSubClassFromDeckCopy(dialog, dialogDeckList, deck);
|
||||
}
|
||||
};
|
||||
dialog.SetPanelDepth(100);
|
||||
}
|
||||
|
||||
private void OnSelectSubClassFromDeckCopy(DialogBase dialog, DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
dialog.Close();
|
||||
SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
|
||||
{
|
||||
deck.SetDeckSubClassID(classId);
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
});
|
||||
}
|
||||
|
||||
private void OnChangeViewSceneFromDeckCopy(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
bool isCopySubClass = FormatBehaviorManager.Create(deck.Format, _conventionDeckList).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS);
|
||||
MyRotationInfo myRotationInfo = null;
|
||||
if (_format == Format.MyRotation)
|
||||
{
|
||||
myRotationInfo = ((deck.Format != Format.MyRotation) ? deck.GetMyRotationInfoFromCardList() : Data.MyRotationAllInfo.Get(deck.MyRotationId));
|
||||
}
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: false, isCopySubClass, _conventionDeckList, myRotationInfo);
|
||||
dialogDeckList.CloseWithoutSelect();
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnSuccessDeckCodeInfo(NetworkTask.ResultCode errorcode)
|
||||
{
|
||||
OnSuccessCodeDeckInfo(DeckCopyCodeType.DeckCode);
|
||||
}
|
||||
|
||||
private void OnSuccessQRCodeDeckInfo()
|
||||
{
|
||||
OnSuccessCodeDeckInfo(DeckCopyCodeType.QRCode);
|
||||
}
|
||||
|
||||
private void OnSuccessCodeDeckInfo(DeckCopyCodeType copyCodeType)
|
||||
{
|
||||
bool flag = false;
|
||||
SetCodeCopyDeckParam(copyCodeType, out var clanId, out var subClanId, out var isSubClassSet, out var cardIds, out var myRotationInfo);
|
||||
if (_conventionDeckList != null)
|
||||
{
|
||||
List<int> conventionDeckClassList = _conventionDeckList.GetConventionDeckClassList();
|
||||
for (int i = 0; i < conventionDeckClassList.Count; i++)
|
||||
{
|
||||
if (conventionDeckClassList[i] == clanId)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
for (int j = 0; j < conventionDeckClassList.Count; j++)
|
||||
{
|
||||
if (conventionDeckClassList[j] == subClanId)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDeckcodeIncludingNonExistentCard(cardIds))
|
||||
{
|
||||
string title = Data.SystemText.Get("Card_0196");
|
||||
string text = Data.SystemText.Get("Card_0197");
|
||||
CreateErrorDialog(title, text).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
string title2 = Data.SystemText.Get("ErrorHeader_10002");
|
||||
string text2 = Data.SystemText.Get("Arena_0067");
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
text2 = Data.SystemText.Get("Arena_0141");
|
||||
}
|
||||
CreateErrorDialog(title2, text2).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (!_formatBehavior.UseSubClass && isSubClassSet)
|
||||
{
|
||||
string title3 = Data.SystemText.Get("Card_0196");
|
||||
string text3 = "";
|
||||
switch (copyCodeType)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
text3 = Data.SystemText.Get("Card_0285");
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
text3 = Data.SystemText.Get("Card_0295");
|
||||
break;
|
||||
}
|
||||
CreateErrorDialog(title3, text3).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (myRotationInfo != null && _format != Format.MyRotation)
|
||||
{
|
||||
string title4 = Data.SystemText.Get("Card_0196");
|
||||
string text4 = "";
|
||||
switch (copyCodeType)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
text4 = Data.SystemText.Get("MyRotation_ID_17");
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
text4 = Data.SystemText.Get("MyRotation_ID_18");
|
||||
break;
|
||||
}
|
||||
CreateErrorDialog(title4, text4).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
DeckData deck = CreateDeckFromCopyCode(clanId, subClanId, isSubClassSet, cardIds, myRotationInfo);
|
||||
if (_formatBehavior.UseSubClass && !isSubClassSet)
|
||||
{
|
||||
OnCreateDeckFromCodeSelectSubClass(deck);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnCreateDeckFromCode(deck);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCodeCopyDeckParam(DeckCopyCodeType deckCopyCodeTypeout, out int clanId, out int subClanId, out bool isSubClassSet, out int[] cardIds, out MyRotationInfo myRotationInfo)
|
||||
{
|
||||
clanId = 10;
|
||||
subClanId = 10;
|
||||
isSubClassSet = false;
|
||||
cardIds = null;
|
||||
myRotationInfo = null;
|
||||
switch (deckCopyCodeTypeout)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
clanId = (int)QRCodeUtility.deckDataFromQRCode.ClanId;
|
||||
subClanId = (int)QRCodeUtility.deckDataFromQRCode.SubClanId;
|
||||
isSubClassSet = QRCodeUtility.deckDataFromQRCode.IsSubClassSet;
|
||||
cardIds = QRCodeUtility.deckDataFromQRCode.CardIds;
|
||||
myRotationInfo = QRCodeUtility.deckDataFromQRCode.MyRotationInfo;
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
clanId = Data.DeckDataFromDeckCode.ClanId;
|
||||
subClanId = Data.DeckDataFromDeckCode.SubClanId;
|
||||
isSubClassSet = Data.DeckDataFromDeckCode.IsSubClanSet;
|
||||
cardIds = Data.DeckDataFromDeckCode.CardIds;
|
||||
if (Data.DeckDataFromDeckCode.MyRotationId != null)
|
||||
{
|
||||
myRotationInfo = Data.MyRotationAllInfo.Get(Data.DeckDataFromDeckCode.MyRotationId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private DeckData CreateDeckFromCopyCode(int clanId, int subClanId, bool isSubClassSet, int[] cardIds, MyRotationInfo myRotationInfo)
|
||||
{
|
||||
DeckData deckData = new DeckData(_format);
|
||||
deckData.SetDeckClassID(clanId);
|
||||
if (isSubClassSet)
|
||||
{
|
||||
deckData.SetDeckSubClassID(subClanId);
|
||||
}
|
||||
deckData.SetDeckName("");
|
||||
deckData.SetDeckSleeveID(3000011L);
|
||||
deckData.SetDeckIsComplete(isComplete: true);
|
||||
deckData.SetCardIdList(cardIds.ToList());
|
||||
if (myRotationInfo != null)
|
||||
{
|
||||
deckData.MyRotationId = myRotationInfo.Id;
|
||||
}
|
||||
return deckData;
|
||||
}
|
||||
|
||||
private DialogBase CreateErrorDialog(string title, string text)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetTitleLabel(title);
|
||||
dialogBase.SetText(text);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
return dialogBase;
|
||||
}
|
||||
|
||||
private void OnFailedQRCodeDeckInfo(string message)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(message);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnCreateDeckFromCode(DeckData deck)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0142"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Card_0115"));
|
||||
if (_format == Format.MyRotation && Data.MyRotationAllInfo.Get(deck.MyRotationId) == null)
|
||||
{
|
||||
MyRotationInfo myRotationInfoFromCardList = deck.GetMyRotationInfoFromCardList();
|
||||
deck.MyRotationId = myRotationInfoFromCardList.Id;
|
||||
}
|
||||
dialogBase.OnCloseStart = delegate
|
||||
{
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: true, _conventionDeckList);
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnCreateDeckFromCodeSelectSubClass(DeckData deck)
|
||||
{
|
||||
SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
|
||||
{
|
||||
deck.SetDeckSubClassID(classId);
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: false, _conventionDeckList);
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
});
|
||||
}
|
||||
|
||||
private bool isDeckcodeIncludingNonExistentCard(int[] targetDeckCardIds)
|
||||
{
|
||||
List<int> allCardIds = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetAllCardIds();
|
||||
int num = targetDeckCardIds.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
int item = targetDeckCardIds[i];
|
||||
if (!allCardIds.Contains(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnFailedDeckCodeInfo(NetworkTask.ResultCode errorcode)
|
||||
{
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnFailedDeckCodeInfo(int errorcode)
|
||||
{
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private List<int> GetConventionUsedClassIdList()
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
if (_conventionDeckList == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return _conventionDeckList.GetConventionDeckClassList();
|
||||
}
|
||||
|
||||
private void ChangeViewScene(UIManager.ViewScene viewScene, object sceneParam)
|
||||
{
|
||||
_onStartChangeViewScene.Call();
|
||||
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle))
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(viewScene, null, null, sceneParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.GetInstance().ChangeViewScene(viewScene, null, sceneParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user