_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/lianghaoLL/Announcementitem.cs

23 lines
671 B
C#
Raw Normal View History

2024-11-27 23:34:21 +08:00
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
2024-11-27 23:34:21 +08:00
using UnityEngine;
using UnityEngine.UI;
public class Announcementitem : MonoBehaviour
{
public Text neirong;
public Text creatTime;
public Announcement announcement;
2024-11-27 23:34:21 +08:00
// Start is called before the first frame update
public async void onclik()
2024-11-27 23:34:21 +08:00
{
GameObject prefab = Resources.Load<GameObject>("LLPrefabs/AnnouncementTongzhi");
Canvas canvas = GetComponentInParent<Canvas>();
Instantiate(prefab, canvas.transform);
await Task.Delay(100);
prefab.GetComponent<AnnouncementTongzhi>().Announcement = announcement;
2024-11-27 23:34:21 +08:00
}
}