unitytools/Assets/UnityTools/script/PopUpWindowitem.cs
2024-11-12 02:50:27 +08:00

34 lines
993 B
C#

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>().text = boxTypeItem.title; }
if (contentObj != null) { contentObj.GetComponent<Text>().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;
}
}