using System;
using UnityEngine;
using System.Collections;
public class TimeCountdown : MonoBehaviour
{
//之前的一个时间点
public long startTime = ;
//限定时间秒
private long fixedTime = ;
private long nowTime;
// Use this for initialization
void Start()
{
nowTime = (System.DateTime.Now.Ticks - System.DateTime.Parse("1970-01-01").Ticks) / ;
if (nowTime - startTime >= fixedTime)
{
Debug.Log("倒计时结束");
}
else
{
InvokeRepeating("CountDown", , );
}
}
// Update is called once per frame
void Update()
{
}
void CountDown()
{
fixedTime -= ;
gameObject.GetComponent<UILabel>().text = (fixedTime / ( * * )).ToString() + "天"
+ ((fixedTime/ - fixedTime / ( * * )**)/).ToString() + "小时"
+ ((fixedTime / ) % ).ToString() + "分"
+ (fixedTime % ).ToString() + "秒";
}
}