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.
This commit is contained in:
411
SVSim.BattleEngine/Engine/SimpleCardDetail.cs
Normal file
411
SVSim.BattleEngine/Engine/SimpleCardDetail.cs
Normal file
@@ -0,0 +1,411 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.View;
|
||||
|
||||
public class SimpleCardDetail : CardDetailBase
|
||||
{
|
||||
private const string EVO_EFFECT_PATH = "cmn_deckedit_evo_1";
|
||||
|
||||
private int _cardID;
|
||||
|
||||
[SerializeField]
|
||||
private Transform _offset;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _attackLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _lifeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _skillCollider;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _evoPanel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _evoAttackLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _evoLifeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _skillColliderEvo;
|
||||
|
||||
[SerializeField]
|
||||
private CardCraftPanel _craftPanel;
|
||||
|
||||
[SerializeField]
|
||||
private UIWidget _myRotationAnchor;
|
||||
|
||||
[SerializeField]
|
||||
private Transform _myRotationAnchorTargetWithEvol;
|
||||
|
||||
[SerializeField]
|
||||
private Transform _myRotationAnchorTargetNoEvol;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _myRotationRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _myRotationLabel;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _closeCollider;
|
||||
|
||||
[SerializeField]
|
||||
private PurchaseConfirm _purchaseConfirmPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private UITweener[] _openTween;
|
||||
|
||||
private CardMake _cardMaker;
|
||||
|
||||
private List<BuffInfo> _buffList;
|
||||
|
||||
private BoxCollider _craftPanelCollider;
|
||||
|
||||
private DetailPanelInfo _currentPanel;
|
||||
|
||||
private CardMaster.CardMasterId _cardMasterId = CardMaster.CardMasterId.Default;
|
||||
|
||||
public bool IsVisible { get; set; }
|
||||
|
||||
public int CardID
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cardID;
|
||||
}
|
||||
private set
|
||||
{
|
||||
CardParam = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(_cardID = value);
|
||||
if (CardParam != null)
|
||||
{
|
||||
if (CardParam.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
_currentPanel = _followerPanel;
|
||||
_followerPanel._root.SetActive(value: true);
|
||||
_nonFollowerPanel._root.SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPanel = _nonFollowerPanel;
|
||||
_followerPanel._root.SetActive(value: false);
|
||||
_nonFollowerPanel._root.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private CardParameter CardParam { get; set; }
|
||||
|
||||
public bool IsDetailPanelDragging { get; private set; }
|
||||
|
||||
public event Action OnClickCloseButton;
|
||||
|
||||
public event Action OnClickCreateButton;
|
||||
|
||||
public event Action<int> OnClickLiquefyButton;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_currentPanel = _followerPanel;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_cardMaker = base.gameObject.AddComponent<CardMake>();
|
||||
_cardMaker.OnCardBuy = delegate
|
||||
{
|
||||
UpdateCraftPanel();
|
||||
this.OnClickCreateButton.Call();
|
||||
};
|
||||
_cardMaker.OnCardSellId = delegate(int cardId)
|
||||
{
|
||||
UpdateCraftPanel();
|
||||
this.OnClickLiquefyButton.Call(cardId);
|
||||
};
|
||||
if ((bool)_closeCollider)
|
||||
{
|
||||
UIEventListener.Get(_closeCollider.gameObject).onClick = delegate
|
||||
{
|
||||
this.OnClickCloseButton.Call();
|
||||
};
|
||||
}
|
||||
Action onClickCreateBtn = delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
OpenCraftDialog(delegate
|
||||
{
|
||||
_cardMaker.StartCardCraft(CardID);
|
||||
}, buy: true);
|
||||
};
|
||||
Action onClickDestructBtn = delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
OpenCraftDialog(delegate
|
||||
{
|
||||
_cardMaker.StartCardDestruct(CardID);
|
||||
}, buy: false);
|
||||
};
|
||||
_craftPanel.Init(onClickCreateBtn, onClickDestructBtn);
|
||||
UIEventListener.Get(_followerPanel.DiscCollider.gameObject).onClick = delegate
|
||||
{
|
||||
if (UIManager.GetInstance().IsTouchable)
|
||||
{
|
||||
OpenSkillInfo(_followerPanel.DiscLabel, isEvol: false);
|
||||
}
|
||||
};
|
||||
BattlePlayerView.SetKeyWordColor(_followerPanel.DiscCollider.gameObject, _followerPanel.DiscLabel);
|
||||
UIEventListener.Get(_followerEvoPanel.DiscCollider.gameObject).onClick = delegate
|
||||
{
|
||||
if (UIManager.GetInstance().IsTouchable)
|
||||
{
|
||||
OpenSkillInfo(_followerEvoPanel.DiscLabel, isEvol: true);
|
||||
}
|
||||
};
|
||||
BattlePlayerView.SetKeyWordColor(_followerEvoPanel.DiscCollider.gameObject, _followerEvoPanel.DiscLabel);
|
||||
UIEventListener.Get(_nonFollowerPanel.DiscCollider.gameObject).onClick = delegate
|
||||
{
|
||||
OpenSkillInfo(_nonFollowerPanel.DiscLabel, isEvol: false);
|
||||
};
|
||||
BattlePlayerView.SetKeyWordColor(_nonFollowerPanel.DiscCollider.gameObject, _nonFollowerPanel.DiscLabel);
|
||||
_followerPanel.Initialize();
|
||||
_nonFollowerPanel.Initialize();
|
||||
_followerEvoPanel.Initialize();
|
||||
_craftPanelCollider = _craftPanel.GetComponent<BoxCollider>();
|
||||
HideDetail();
|
||||
}
|
||||
|
||||
public void ChangeDetail(int id, CardMaster.CardMasterId cardMasterId, MyRotationInfo myRotationInfo = null)
|
||||
{
|
||||
if (!IsVisible || CardID != id)
|
||||
{
|
||||
_cardMasterId = cardMasterId;
|
||||
CardID = id;
|
||||
UpdateFirstPanel();
|
||||
UpdateEvoPanel();
|
||||
UpdateCraftPanel();
|
||||
UpdateMyRotationPanel(myRotationInfo);
|
||||
Load();
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowDetail()
|
||||
{
|
||||
IsVisible = true;
|
||||
if ((bool)_closeCollider)
|
||||
{
|
||||
_closeCollider.gameObject.SetActive(value: true);
|
||||
}
|
||||
for (int i = 0; i < _openTween.Length; i++)
|
||||
{
|
||||
if (_openTween[i] != null)
|
||||
{
|
||||
_openTween[i].PlayForward();
|
||||
}
|
||||
}
|
||||
ActivePanelColliders(isActive: true);
|
||||
_currentPanel._root.SetActive(value: true);
|
||||
}
|
||||
|
||||
public void HideDetail()
|
||||
{
|
||||
IsVisible = false;
|
||||
if ((bool)_closeCollider)
|
||||
{
|
||||
_closeCollider.gameObject.SetActive(value: false);
|
||||
}
|
||||
if (base.gameObject.activeInHierarchy)
|
||||
{
|
||||
for (int i = 0; i < _openTween.Length; i++)
|
||||
{
|
||||
if (_openTween[i] != null)
|
||||
{
|
||||
_openTween[i].PlayReverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivePanelColliders(isActive: false);
|
||||
_followerEvoPanel._root.SetActive(value: false);
|
||||
_currentPanel._root.SetActive(value: false);
|
||||
IsDetailPanelDragging = false;
|
||||
}
|
||||
|
||||
public void SetLocalOffset(Vector3 pos)
|
||||
{
|
||||
_offset.localPosition = pos;
|
||||
}
|
||||
|
||||
public void ActiveCraftPanel(bool isActive)
|
||||
{
|
||||
_craftPanel.gameObject.SetActive(isActive);
|
||||
UpdateCraftPanel();
|
||||
}
|
||||
|
||||
public void ActiveCloseCollider(bool isActive)
|
||||
{
|
||||
_closeCollider.enabled = isActive;
|
||||
}
|
||||
|
||||
private void ActivePanelColliders(bool isActive)
|
||||
{
|
||||
_skillColliderEvo.enabled = isActive;
|
||||
_skillCollider.enabled = isActive;
|
||||
_craftPanelCollider.enabled = isActive;
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
||||
_currentPanel._logImage.mainTexture = resourcesManager.LoadObject(GetIllustPath(CardID, isFetch: true)) as Texture;
|
||||
ShowDetail();
|
||||
}
|
||||
|
||||
private void UpdateFirstPanel()
|
||||
{
|
||||
if (CardParam != null)
|
||||
{
|
||||
bool flag = CardParam.CharType == CardBasePrm.CharaType.NORMAL;
|
||||
_attackLabel.gameObject.SetActive(flag);
|
||||
_lifeLabel.gameObject.SetActive(flag);
|
||||
_currentPanel._nameLabel.text = CardParam.CardName;
|
||||
_currentPanel._costLabel.text = CardParam.Cost.ToString();
|
||||
_attackLabel.text = CardParam.Atk.ToString();
|
||||
_lifeLabel.text = CardParam.Life.ToString();
|
||||
if (!flag)
|
||||
{
|
||||
SetDescLabelText(_currentPanel, CardParam.ConvertedSkillDescription);
|
||||
}
|
||||
_currentPanel._classLabel.text = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)CardParam.Clan);
|
||||
if (CardParam.TribeName != "ALL")
|
||||
{
|
||||
UILabel classLabel = _currentPanel._classLabel;
|
||||
classLabel.text = classLabel.text + "/" + CardParam.TribeName;
|
||||
}
|
||||
_currentPanel._classBG.spriteName = string.Format("battle_card_info_{0}", ((int)CardParam.Clan).ToString("00"));
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEvoPanel()
|
||||
{
|
||||
if (CardParam != null)
|
||||
{
|
||||
bool flag = CardParam.CharType == CardBasePrm.CharaType.NORMAL;
|
||||
_followerEvoPanel._root.gameObject.SetActive(flag);
|
||||
_evoAttackLabel.text = CardParam.EvoAtk.ToString();
|
||||
_evoLifeLabel.text = CardParam.EvoLife.ToString();
|
||||
if (flag)
|
||||
{
|
||||
SetFollowerDetailLabel(CardParam.ConvertedSkillDescription, CardParam.ConvertedEvoSkillDescription, needEvolutionOrFusionButton: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDragEvent(BoxCollider dragCollider)
|
||||
{
|
||||
UIEventListener.Get(dragCollider.gameObject).onDragStart = delegate
|
||||
{
|
||||
IsDetailPanelDragging = true;
|
||||
};
|
||||
UIEventListener.Get(dragCollider.gameObject).onDragEnd = delegate
|
||||
{
|
||||
IsDetailPanelDragging = false;
|
||||
};
|
||||
}
|
||||
|
||||
private void UpdateCraftPanel()
|
||||
{
|
||||
if (CardParam != null && !(_craftPanel == null) && _craftPanel.gameObject.activeInHierarchy)
|
||||
{
|
||||
_craftPanel.UpdateCraftPanel(CardParam);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateMyRotationPanel(MyRotationInfo myRotationInfo)
|
||||
{
|
||||
if (CardParam == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_myRotationRoot.SetActive(myRotationInfo != null);
|
||||
if (myRotationInfo != null)
|
||||
{
|
||||
if (CardParam.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
_myRotationAnchor.topAnchor.target = _myRotationAnchorTargetWithEvol;
|
||||
_myRotationAnchor.bottomAnchor.target = _myRotationAnchorTargetWithEvol;
|
||||
}
|
||||
else
|
||||
{
|
||||
_myRotationAnchor.topAnchor.target = _myRotationAnchorTargetNoEvol;
|
||||
_myRotationAnchor.bottomAnchor.target = _myRotationAnchorTargetNoEvol;
|
||||
}
|
||||
_myRotationAnchor.ResetAndUpdateAnchors();
|
||||
CardParameter cardParameter = CardParam;
|
||||
if (cardParameter.IsPrizeCard || cardParameter.IsCollaboCard)
|
||||
{
|
||||
cardParameter = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(cardParameter.BaseCardId);
|
||||
}
|
||||
string cardSetId = cardParameter.CardSetId;
|
||||
CardSetName cardSetName = Data.Master.CardSetNameMgr.Get(cardSetId);
|
||||
string text = (int.Parse(cardSetId) - 10000).ToString();
|
||||
string id = "MyRotation_ID_09";
|
||||
if (int.Parse(cardSetId) == 10000)
|
||||
{
|
||||
id = "MyRotation_ID_10";
|
||||
}
|
||||
_myRotationLabel.text = Data.SystemText.Get(id, cardSetName.LongName, cardSetName.ShortName, text);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSkillInfo(UILabel label, bool isEvol)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(CardID);
|
||||
if (cardParameterFromId != null && (isEvol ? cardParameterFromId.EvoSkillDescription : cardParameterFromId.SkillDescription).Length > 0 && BattlePlayerView.HasKeyword(cardParameterFromId) && !UIManager.GetInstance().isOpenDialog())
|
||||
{
|
||||
BattlePlayerView.CreateKeyPanel(cardParameterFromId.ConvertedSkillDescription + cardParameterFromId.ConvertedEvoSkillDescription, label, _cardMasterId);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenCraftDialog(Action onOk, bool buy)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(_purchaseConfirmPrefab);
|
||||
dialogBase.SetObj(purchaseConfirm.gameObject);
|
||||
int userRedEtherCount = PlayerStaticData.UserRedEtherCount;
|
||||
SystemText systemText = Data.SystemText;
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(CardID);
|
||||
if (buy)
|
||||
{
|
||||
dialogBase.SetTitleLabel(systemText.Get("Card_0081"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetButtonText(systemText.Get("Dia_CardList_003_Button"));
|
||||
int useRedEther = cardParameterFromId.UseRedEther;
|
||||
purchaseConfirm.SetCardBuy(systemText.Get("Common_0205"), userRedEtherCount, useRedEther, cardParameterFromId);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogBase.SetTitleLabel(systemText.Get("Card_0080"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn);
|
||||
dialogBase.SetButtonText(systemText.Get("Dia_CardList_002_Button"));
|
||||
int getRedEther = cardParameterFromId.GetRedEther;
|
||||
purchaseConfirm.SetCardSell(systemText.Get("Common_0205"), userRedEtherCount, getRedEther, cardParameterFromId.CardName, cardParameterFromId.IsFoil);
|
||||
}
|
||||
dialogBase.onPushButton1 = onOk;
|
||||
}
|
||||
|
||||
private string GetIllustPath(int id, bool isFetch)
|
||||
{
|
||||
CardMaster instance = CardMaster.GetInstance(_cardMasterId);
|
||||
CardParameter cardParameterFromId = instance.GetCardParameterFromId(id);
|
||||
string path = instance.GetCardParameterFromId(cardParameterFromId.NormalCardId).ResourceCardId + "0";
|
||||
ResourcesManager.AssetLoadPathType type = ((cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL || CardMaster.IsMutationCardCheck(cardParameterFromId.BaseCardId)) ? ResourcesManager.AssetLoadPathType.UnitHeader : ResourcesManager.AssetLoadPathType.OtherHeader);
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(path, type, isFetch);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user