58 lines
1.2 KiB
C#
58 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using System;
|
|
using UnityEngine.UI;
|
|
|
|
public class UIManager : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 时刻
|
|
/// </summary>
|
|
[SerializeField] TextMeshProUGUI text1;
|
|
/// <summary>
|
|
/// 时间
|
|
/// </summary>
|
|
[SerializeField] TextMeshProUGUI text2;
|
|
/// <summary>
|
|
/// 切换到智慧运维
|
|
/// </summary>
|
|
[Header("Btn_古泉站")]
|
|
public Button btn1;
|
|
void Start()
|
|
{
|
|
text1.text = DateTime.Now.ToShortTimeString();
|
|
text2.text = DateTime.Now.ToLongDateString();
|
|
InvokeRepeating("UpdateTime", 1, 1);
|
|
BtnEvent();
|
|
|
|
}
|
|
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
void UpdateTime()
|
|
{
|
|
text1.text = DateTime.Now.ToShortTimeString();
|
|
text2.text = DateTime.Now.ToLongDateString();
|
|
//print("更新了时间");
|
|
}
|
|
void BtnEvent()
|
|
{
|
|
btn1.onClick.AddListener(() =>
|
|
{
|
|
Invoke("InvokeSetActive",1f);
|
|
});
|
|
}
|
|
void InvokeSetActive()
|
|
{
|
|
GameObject go1 = transform.Find("Panel_智慧运维").gameObject;
|
|
GameObject go2 = transform.Find("Panel_安徽省地图").gameObject;
|
|
go1.SetActive(true);
|
|
go2.SetActive(false);
|
|
}
|
|
}
|