using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InitUI : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
GetTimeDeltaTime();
}
public Text text_timeSpend;
public Text test_chenggong;
int hour;
int minute;
int second;
int millisecond;
float timeSpend = 0.0f;
public void GetTimeDeltaTime()
{
timeSpend += Time.deltaTime;
//GlobalSetting.timeSpent = timeSpend;
hour = (int)timeSpend / 3600;
minute = ((int)timeSpend - hour * 3600) / 60;
second = (int)timeSpend - hour * 3600 - minute * 60;
millisecond = (int)((timeSpend - (int)timeSpend) * 1000);
text_timeSpend.text = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", hour, minute, second, millisecond);
test_chenggong.text = string.Format("{0:D2}:{1:D2}:{2:D2}", hour, minute, second);
if (timeSpend >= 10)
{
timeSpend = 0;
}
}
}