备份CatanBuilding瘦身独立工程
This commit is contained in:
47
Assets/Scripts/UI/Setting/NoticePopupPanel.cs
Normal file
47
Assets/Scripts/UI/Setting/NoticePopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using asap.core;
|
||||
using game;
|
||||
using GameCore;
|
||||
using PlayFab.ClientModels;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NoticePopupPanel : MonoBehaviour
|
||||
{
|
||||
public Button btn_close;
|
||||
public Button btn_close2;
|
||||
public Button btn_sure;
|
||||
public TMP_Text text_content;
|
||||
public TMP_Text text_time;
|
||||
public TMP_Text text_title;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("mask").GetComponent<Button>();
|
||||
btn_close2 = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_sure = transform.Find("root/btn_sure/btn_green").GetComponent<Button>();
|
||||
text_content = transform.Find("root/ScrollView/Viewport/Content/text_content").GetComponent<TMP_Text>();
|
||||
text_time = transform.Find("root/ScrollView/Viewport/Content/text_time").GetComponent<TMP_Text>();
|
||||
text_title = transform.Find("root/text_title").GetComponent<TMP_Text>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(OnClose);
|
||||
btn_sure.onClick.AddListener(OnClose);
|
||||
btn_close2.onClick.AddListener(OnClose);
|
||||
TitleNewsEvent titleNewsEvent = new TitleNewsEvent();
|
||||
titleNewsEvent.show = true;
|
||||
GContext.Publish(titleNewsEvent);
|
||||
TitleNewsItem titleNewsItem = titleNewsEvent.titleNewsItem;
|
||||
if (titleNewsItem != null)
|
||||
{
|
||||
text_title.text = titleNewsItem.Title;
|
||||
text_content.text = titleNewsItem.Body;
|
||||
text_time.text = titleNewsItem.Timestamp.ToString("dd/MM/yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
void OnClose()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.NoticePopupPanel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user