using UnityEngine; using UnityEngine.UI; using TableConfig; using Snxxz.UI; namespace Snxxz.UI { public class BuySuccessWin : Window { [SerializeField] private ItemCell _itemCell; [SerializeField] private Text _itemNameText; [SerializeField] private Text _itemCountText; private ItemConfig _tagItemModel; private float delayTime = 1; private bool isStart = false; protected override void AddListeners() { } protected override void BindController() { } protected override void OnAfterClose() { } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnPreOpen() { OnShowWin(BuySuccessModel.Instance.ItemID,BuySuccessModel.Instance.itemCnt, BuySuccessModel.Instance.IsBind); isStart = true; delayTime = 1; } protected override void LateUpdate() { base.LateUpdate(); if(isStart) { delayTime -= Time.deltaTime; if (delayTime <= 0) { isStart = false; CloseImmediately(); } } } public void OnShowWin(int itemId,int count,int isBind = 0) { _tagItemModel = Config.Instance.Get(itemId); if (_tagItemModel == null) return; ItemCellModel cellModel = new ItemCellModel(itemId,false, (ulong)count,isBind); _itemCell.Init(cellModel); _itemNameText.text = _tagItemModel.ItemName; _itemNameText.color = UIHelper.GetUIColor(_tagItemModel.ItemColor,true); _itemCountText.text = "X" + count; } } }