powerfun-unity/Assets/Scripts/UI/Prefab/NewsController.cs

40 lines
980 B
C#
Raw Normal View History

2021-04-16 17:49:11 +08:00
using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2021-04-21 11:19:31 +08:00
using UnityEngine.EventSystems;
2021-04-16 17:49:11 +08:00
using UnityEngine.UI;
public class NewsController : PFUIPanel
{
// Start is called before the first frame update
void Start()
{
content = transform.Find("Main").Find("Inner").Find("Content");
exit = transform.Find("Main").Find("Exit");
if (exit != null)
{
2021-04-21 11:19:31 +08:00
UIManager.AddEvent(exit.gameObject, EventTriggerType.PointerClick, (b) =>
2021-04-16 17:49:11 +08:00
{
Close();
});
}
Get();
}
Transform content,exit;
async void Get()
{
var r = await ConfigHelper.userApi.GetNotify();
if (r.result)
{
content.GetComponent<Text>().text = r.data.Value<string>("Content");
//content.GetComponent<Text>().text
}
}
// Update is called once per frame
void Update()
{
}
}