废话不多说 直接上脚本
using UnityEngine;using System.Collections;
using System;
using UnityEngine.UI;
public class BatteryAndTime : MonoBehaviour
{
public Text textlog;
void Start()
{
StartCoroutine("UpdataTime");
StartCoroutine("UpdataBattery");
StartCoroutine("UpdataNetWorker");
}
void OnGUI()
{
}
//更新时间
IEnumerator UpdataTime()
{
DateTime now = DateTime.Now;
textlog.text += string.Format("{0}:{1}", now.Hour, now.Minute);
yield return new WaitForSeconds(60f - now.Second);
while (true)
{
now = DateTime.Now;
textlog.text +=