using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using static PopUpWindowitem; public class PopUpWindowitem : MonoBehaviour { public BoxTypeItem boxTypeItem = new BoxTypeItem();//窗体数据对象 public GameObject titleObj;//标题对象 public GameObject contentObj;//标题对象 void Update() { if (titleObj != null) { titleObj.GetComponent().text = boxTypeItem.title; } if (contentObj != null) { contentObj.GetComponent().text = boxTypeItem.content; } } public void UpdateBoxTypeItem(BoxTypeItem _boxType) { boxTypeItem = _boxType; } public delegate void OnClikeWT(BoxTypeItem boxType, int type);//事件函数执行委托回调 public event OnClikeWT OnClike;//点击事件 public void onClikeAsync(int type = 0)//点击事件 { OnClike?.Invoke(boxTypeItem, type); } public void register_click(OnClikeWT onClikeWT) { OnClike += onClikeWT; } }