using System;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
public class BestLuckyTreasureItemWin : Window
|
{
|
[SerializeField] CommonItemBaisc itemBaisc;
|
[SerializeField] Button closeBtn;
|
[SerializeField] Button gotoBtn;
|
[SerializeField] Text nameText;
|
[SerializeField] UIEffect effect;
|
|
LuckyTreasureModel luckyTreasureModel { get { return ModelCenter.Instance.GetModel<LuckyTreasureModel>(); } }
|
|
OperationLuckyTreasure.LuckyTreasureItem luckyItem;
|
#region Built-in
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void AddListeners()
|
{
|
closeBtn.AddListener(CloseClick);
|
gotoBtn.AddListener(ClickGoTo);
|
}
|
|
protected override void OnPreOpen()
|
{
|
SetDisplay();
|
}
|
|
protected override void OnAfterOpen()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
|
}
|
protected override void OnAfterClose()
|
{
|
|
}
|
#endregion
|
|
private void SetDisplay()
|
{
|
if(!luckyTreasureModel.IsBigLuckItem())
|
{
|
CloseImmediately();
|
return;
|
}
|
var operation = luckyTreasureModel.GetOperation();
|
luckyItem = null;
|
if (operation.TryGetLuckBigAward(out luckyItem))
|
{
|
var itemConfig = ItemConfig.Get(luckyItem.itemId);
|
nameText.text = itemConfig.ItemName;
|
if(itemConfig.ItemColor <= 4)
|
{
|
effect.effect = 1175;
|
}
|
else
|
{
|
effect.effect = 1176;
|
}
|
ItemCellModel model = new ItemCellModel(luckyItem.itemId,false,(ulong)luckyItem.itemCount);
|
itemBaisc.Init(model);
|
itemBaisc.button.RemoveAllListeners();
|
itemBaisc.button.AddListener(()=>
|
{
|
ItemTipUtility.Show(luckyItem.itemId);
|
});
|
}
|
}
|
|
private void ClickGoTo()
|
{
|
CloseImmediately();
|
if(luckyItem != null)
|
{
|
var itemConfig = ItemConfig.Get(luckyItem.itemId);
|
if (itemConfig.Jump != 0)
|
{
|
WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)itemConfig.Jump);
|
}
|
}
|
}
|
|
}
|
}
|