Files
SVSimServer/SVSim.BattleEngine/Engine/DeckDecisionUI.cs
gamer147 957af3d1ec feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
2026-06-05 17:22:20 -04:00

246 lines
7.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;
using Wizard;
using Wizard.Dialog.Setting;
using Wizard.RoomMatch;
public class DeckDecisionUI : MonoBehaviour
{
[SerializeField]
private UILabel _textForOneLine;
[SerializeField]
private UILabel _descTextLabel;
[SerializeField]
private UILabel _deckNameTextLabel;
[SerializeField]
private ItemToggle m_simpleStageToggle;
[SerializeField]
private GameObject _uiCardListPrefab;
[SerializeField]
private GameObject _cardDetailPrefab;
[SerializeField]
private UILabel _optionLabel;
protected List<string> _loadCardAssetList;
private bool _textSetEnd;
protected static int DetailLayer;
protected const float CARD_DETAIL_Z = -300f;
private ConventionDeckList conventionDeckList;
public bool IsCanShowQRCode = true;
private IFormatBehavior _formatBehavior;
public DeckData DeckData { get; private set; }
public string DeckName { get; set; }
public UILabel OptionLabel => _optionLabel;
public Action<UICardList> CardListCustomize { get; set; }
protected CardDetailUI CardDetail { get; set; }
protected UICardList UiCardList { get; set; }
public Action<CardDetailUI> CardDetailCustomize { get; set; }
public bool IsShowSimpleStageOption { get; set; }
public void SetDeckData(DeckData deck, ConventionDeckList deckList)
{
DeckData = deck;
conventionDeckList = deckList;
_formatBehavior = FormatBehaviorManager.Create(deck.Format, deckList);
}
public virtual void Start()
{
DetailLayer = LayerMask.NameToLayer("MyPage");
UIWidget component = GetComponent<UIWidget>();
if (!_textSetEnd)
{
_descTextLabel.text = Data.SystemText.Get("Card_0006");
_deckNameTextLabel.text = Data.SystemText.Get("Card_0299", DeckName);
SetTextLabelesState(string.IsNullOrEmpty(_descTextLabel.text), string.IsNullOrEmpty(_deckNameTextLabel.text));
}
if (IsShowSimpleStageOption)
{
SettingToggle_SimpleStage();
component.pivot = UIWidget.Pivot.Center;
}
else
{
m_simpleStageToggle.gameObject.SetActive(value: false);
component.pivot = UIWidget.Pivot.Bottom;
}
}
public void SetText(string descText, string cardDeckText)
{
_textForOneLine.text = descText;
_descTextLabel.text = descText;
_deckNameTextLabel.text = cardDeckText;
SetTextLabelesState(string.IsNullOrEmpty(descText), string.IsNullOrEmpty(cardDeckText));
_textSetEnd = true;
}
protected void OnDestroy()
{
if (_loadCardAssetList != null)
{
Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList);
_loadCardAssetList = null;
}
if (UiCardList != null)
{
UnityEngine.Object.Destroy(UiCardList.gameObject);
UiCardList = null;
}
if (CardDetail != null)
{
UnityEngine.Object.Destroy(CardDetail.gameObject);
CardDetail = null;
}
}
protected ItemToggle SettingToggle_SimpleStage(bool isSperatorUse = true)
{
SystemText systemText = Data.SystemText;
ItemToggle item = m_simpleStageToggle;
item.SetTitleLabel(systemText.Get("OtherConfig_0022"));
item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SIMPLE_STAGE));
item.AddChangeCallback(delegate
{
bool value = item.GetValue();
PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SIMPLE_STAGE, value);
});
if (isSperatorUse)
{
item.SetActive_SeparatorLine(isActive: true);
}
return item;
}
public void OnClickCreateCardList()
{
CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask();
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
UIManager.GetInstance().createInSceneCenterLoading();
if (CardDetail == null)
{
CardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab).GetComponent<CardDetailUI>();
CardDetail.transform.parent = base.transform.parent.parent;
CardDetail.transform.localPosition = new Vector3(0f, 0f, -300f);
CardDetail.transform.localScale = Vector3.one;
CardDetail.Initialize(DetailLayer, _formatBehavior.CardMasterId, _formatBehavior);
CardDetail.IsShowFlavorTextButton = true;
CardDetail.IsShowVoiceButton = true;
CardDetail.IsShowEvolutionButton = true;
CardDetail.IsCardTextDialogLayerSet = false;
CardDetailCustomize.Call(CardDetail);
UIManager.GetInstance().SetLayerRecursive(CardDetail.gameObject.transform, DetailLayer);
}
if (UiCardList == null)
{
bool in_DetailCameraUse = false;
UiCardList = UnityEngine.Object.Instantiate(_uiCardListPrefab).GetComponent<UICardList>();
UIManager.ViewScene currentScene = UIManager.GetInstance().GetCurrentScene();
if (currentScene != UIManager.ViewScene.MyPage && currentScene != UIManager.ViewScene.QuestSelectionPage)
{
in_DetailCameraUse = true;
}
else
{
UiCardList.SetCamera(UIManager.GetInstance().MyPageUICameraObj.GetComponent<Camera>());
}
int in_MaxCardNum = 40;
if (DeckData.Format == Format.Windfall)
{
in_MaxCardNum = 35;
}
UiCardList.Init(base.transform.parent.parent.gameObject, CardDetail, null, DeckViewClose, LayerMask.LayerToName(DetailLayer), in_DetailCameraUse, null, in_MaxCardNum);
UiCardList.SetActive(in_Active: false);
}
CardListCustomize.Call(UiCardList);
CardDetail.gameObject.SetActive(value: false);
StartCoroutine(CardLoadCoroutine(DeckData));
}));
}
private IEnumerator CardLoadCoroutine(DeckData inDeckData)
{
RoomBase.StartDialogLoading();
IList<int> cardIdList = inDeckData.GetCardIdList();
inDeckData.GetDeckName();
UiCardList.RemoveData();
UiCardList._loadingEnd = false;
_loadCardAssetList = UiCardList.GetLoadFileList(cardIdList as List<int>);
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null));
UiCardList.SetDeck(inDeckData, conventionDeckList);
yield return null;
DialogSetDisp(inDisp: false);
if (IsCanShowQRCode)
{
UiCardList.SetQRSmallTexture();
}
UiCardList.SetActive(in_Active: true);
UIManager.GetInstance().closeInSceneCenterLoading();
UiCardList._loadingEnd = true;
RoomBase.FinishDiloagLoading();
}
protected void DeckViewClose()
{
UiCardList.SetActive(in_Active: false);
if (_loadCardAssetList != null)
{
Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList);
_loadCardAssetList = null;
}
DialogSetDisp(inDisp: true);
UnityEngine.Object.Destroy(UiCardList.gameObject);
UnityEngine.Object.Destroy(CardDetail.gameObject);
UiCardList = null;
CardDetail = null;
}
protected void DialogSetDisp(bool inDisp)
{
UIManager.GetInstance().ActiveChangeDialogAll(inDisp);
}
private void SetTextLabelesState(bool noDescText, bool noDeckNameText)
{
if (noDescText && noDeckNameText)
{
_textForOneLine.gameObject.SetActive(value: false);
_descTextLabel.gameObject.SetActive(value: false);
_deckNameTextLabel.gameObject.SetActive(value: false);
}
else if (noDeckNameText)
{
_descTextLabel.gameObject.SetActive(value: false);
_deckNameTextLabel.gameObject.SetActive(value: false);
}
else
{
_textForOneLine.gameObject.SetActive(value: false);
}
}
}