using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
class EquGridBehaviour
|
{
|
public Transform transform;
|
|
public Button equGridBtn;
|
ItemCell itemCell;
|
Text equNameText;
|
Text tipText;
|
Transform bgImg;
|
RedpointBehaviour redpointBehaviour;
|
|
ItemModel itemModel;
|
|
public void BindController(Transform transform, Action clickEvent, int redPointID)
|
{
|
this.transform = transform;
|
this.equGridBtn = this.transform.GetComponentEx<Button>();
|
this.itemCell = this.transform.FindComponentEx<ItemCell>("ItemCell");
|
this.equNameText = this.transform.FindComponentEx<Text>("Text_EquName");
|
this.tipText = this.transform.FindComponentEx<Text>("Text_Tip");
|
this.bgImg = this.transform.Find("Img_Bg");
|
this.redpointBehaviour = this.transform.FindComponentEx<RedpointBehaviour>("RedPoint");
|
this.redpointBehaviour.redpointId = redPointID;
|
this.itemCell.button.SetListener(() =>
|
{
|
ItemTipUtility.Show(this.itemModel.itemId);
|
});
|
this.equGridBtn.SetListener(() => { clickEvent(); });
|
}
|
|
public void Init(ItemModel itemModel, string equName)
|
{
|
this.itemModel = itemModel;
|
if (this.itemModel == null)
|
{
|
this.bgImg.SetActiveIL(true);
|
this.itemCell.SetActiveIL(false);
|
this.equNameText.text = equName;
|
this.tipText.SetActiveIL(true);
|
}
|
else
|
{
|
this.bgImg.SetActiveIL(false);
|
this.itemCell.SetActiveIL(true);
|
this.itemCell.Init(this.itemModel);
|
this.equNameText.text = this.itemModel.config.ItemName;
|
this.tipText.SetActiveIL(false);
|
}
|
}
|
|
}
|