powerfun-unity/Assets/Scripts/UI/Prefab/NewsController.cs
2021-04-19 14:11:53 +08:00

39 lines
928 B
C#

using Assets.Scripts;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
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)
{
exit.GetComponent<Button>().onClick.AddListener(() =>
{
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()
{
}
}