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.
94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using System;
|
|
using Cute;
|
|
using UnityEngine;
|
|
using Wizard.Scripts.Network.Data.TaskData.ItemPurchase;
|
|
|
|
namespace Wizard;
|
|
|
|
public class ItemPurchasePlate : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private UITexture _textureThumbnail;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelItemName;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelCostName;
|
|
|
|
[SerializeField]
|
|
private UILabel _labelStockNum;
|
|
|
|
[SerializeField]
|
|
private UIButton _btnBuyItem;
|
|
|
|
[SerializeField]
|
|
private UISprite _useItemIconSprite;
|
|
|
|
private ItemPurchaseData _itemData;
|
|
|
|
public Action<ItemPurchaseData> _buyBtnCallBack;
|
|
|
|
private int _dataIndex;
|
|
|
|
public void SetData(int dataIndex)
|
|
{
|
|
_dataIndex = dataIndex;
|
|
UpdateDisplay(Data.ItemPurchaseInfo.itemPurchaseList[dataIndex]);
|
|
}
|
|
|
|
public void UpdatePlate()
|
|
{
|
|
UpdateDisplay(Data.ItemPurchaseInfo.itemPurchaseList[_dataIndex]);
|
|
}
|
|
|
|
private void UpdateDisplay(ItemPurchaseData data)
|
|
{
|
|
_itemData = data;
|
|
_textureThumbnail.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(data.textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true)) as Texture;
|
|
_labelItemName.text = data.purchase_name;
|
|
string typeName = "";
|
|
string detailName = "";
|
|
ShopCommonUtility.GetRewardNames((int)data.require_item_type, data.RequireUserGoodsId, data.require_item_num, out typeName, out detailName);
|
|
_labelCostName.text = Data.SystemText.Get("Shop_0129", typeName, detailName);
|
|
_useItemIconSprite.gameObject.SetActive(value: true);
|
|
if (data.require_item_type == UserGoods.Type.RedEther)
|
|
{
|
|
_useItemIconSprite.spriteName = "icon_liquid_s";
|
|
}
|
|
else if (data.require_item_type == UserGoods.Type.Item && data.RequireUserGoodsId == 1001)
|
|
{
|
|
_useItemIconSprite.spriteName = "icon_orb_piece_s";
|
|
}
|
|
else
|
|
{
|
|
_useItemIconSprite.gameObject.SetActive(value: false);
|
|
}
|
|
if (data.isMonthryReset)
|
|
{
|
|
_labelStockNum.text = Data.SystemText.Get("Shop_0130", data.rest.ToString());
|
|
}
|
|
else
|
|
{
|
|
_labelStockNum.text = Data.SystemText.Get("Shop_0131", data.rest.ToString());
|
|
}
|
|
int haveUserGoods = PlayerStaticData.GetHaveUserGoods(_itemData.require_item_type, _itemData.RequireUserGoodsId);
|
|
if (_itemData.rest > 0 && haveUserGoods >= _itemData.require_item_num)
|
|
{
|
|
UIManager.SetObjectToGrey(_btnBuyItem.gameObject, b: false);
|
|
_btnBuyItem.isEnabled = true;
|
|
}
|
|
else
|
|
{
|
|
UIManager.SetObjectToGrey(_btnBuyItem.gameObject, b: true);
|
|
_btnBuyItem.isEnabled = false;
|
|
}
|
|
}
|
|
|
|
public void OnPushBuyButton()
|
|
{
|
|
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
|
_buyBtnCallBack.Call(_itemData);
|
|
}
|
|
}
|