Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/GachaPointExchangePlate.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

116 lines
3.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Wizard.Scripts.Network.Data.TaskData.Arena;
namespace Wizard;
public class GachaPointExchangePlate : MonoBehaviour
{
private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f);
private const string SPOT_CARD_NUM_FORMAT = "[fcd24a]+{0}[-]";
[SerializeField]
private GameObject _objCardRoot;
[SerializeField]
private UILabel _labelCardName;
[SerializeField]
private UILabel _labelCardPossessionNum;
[SerializeField]
private UILabel _labelCardPossessionNumNormal;
[SerializeField]
private UILabel _labelCardPossessionNumPremium;
[SerializeField]
private UIButton _btnExchangeCard;
[SerializeField]
private UILabel _labelReward;
[SerializeField]
private UILabel _labelOwnedReward;
private GameObject _cardObject;
public void SetData(GachaPointExchangeInfo gachaPointInfo, Action<GachaPointExchangeInfo> onClickExchangButton, bool isExchangeable)
{
string text = gachaPointInfo.GetExchangeCardText();
if (gachaPointInfo.RewardList.Any((Wizard.Scripts.Network.Data.TaskData.Arena.Reward c) => c.UserGoodsData.GoodsType == UserGoods.Type.Skin))
{
text = Data.SystemText.Get("Shop_0232") + " " + text;
}
if (gachaPointInfo.IsDisplayPrize)
{
text = Data.SystemText.Get("Shop_0235") + " " + text;
}
_labelCardName.text = text;
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
int possessionCardNum = dataMgr.GetPossessionCardNum(gachaPointInfo.CardId, isIncludingSpotCard: false);
int spotCardNum = dataMgr.SpotCardData.GetSpotCardNum(gachaPointInfo.CardId);
_labelCardPossessionNumNormal.text = possessionCardNum + ((spotCardNum > 0) ? $"[fcd24a]+{spotCardNum}[-]" : string.Empty);
int cardId = gachaPointInfo.CardId + 1;
int possessionCardNum2 = dataMgr.GetPossessionCardNum(cardId, isIncludingSpotCard: false);
_labelCardPossessionNumPremium.text = possessionCardNum2.ToString();
int num = possessionCardNum + possessionCardNum2 + spotCardNum;
_labelCardPossessionNum.text = num.ToString();
_btnExchangeCard.onClick.Clear();
if (isExchangeable)
{
_btnExchangeCard.onClick.Add(new EventDelegate(delegate
{
onClickExchangButton(gachaPointInfo);
}));
UIManager.SetObjectToGrey(_btnExchangeCard.gameObject, b: false);
}
else
{
_btnExchangeCard.isEnabled = false;
UIManager.SetObjectToGrey(_btnExchangeCard.gameObject, b: true);
}
if (gachaPointInfo.RewardList.Count > 0)
{
_labelReward.text = GetRewardListText(gachaPointInfo.RewardList);
}
else
{
_labelReward.text = string.Empty;
}
if (gachaPointInfo.IsReceived)
{
_labelOwnedReward.gameObject.SetActive(value: true);
_labelOwnedReward.text = Data.SystemText.Get("Shop_0163");
}
else
{
_labelOwnedReward.gameObject.SetActive(value: false);
}
}
public void SetCardObject(GameObject cardObject, GameObject evacuationParent)
{
if (_cardObject != null)
{
_cardObject.SetActive(value: false);
_cardObject.transform.parent = evacuationParent.transform;
}
cardObject.transform.parent = _objCardRoot.transform;
cardObject.transform.localPosition = Vector3.zero;
cardObject.transform.rotation = CARDOBJECT_ROTATION_QUATERNION;
cardObject.SetActive(value: true);
_cardObject = cardObject;
}
private static string GetRewardListText(List<Wizard.Scripts.Network.Data.TaskData.Arena.Reward> rewardList)
{
return UIUtil.CreateListText(rewardList.Select((Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward) => reward.UserGoodsData).OrderBy(GachaUtil.GetRewardListSortIndex).Select(GachaUtil.GetRewardListGoodsTypeName)
.Distinct()
.ToList(), Data.SystemText.Get("Shop_0226"), Data.SystemText.Get("Shop_0225"));
}
}