You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InfoWnd : MonoBehaviour
{
public Text carInTxt;
public Text carOutTxt;
public Text carAllTxt;
public Text dateTxt;
public Button roadInfoCloseBtn;
public GameObject RoadInfo;
public GameObject colorTitle;
public string date;
public void Init()
{
if (RoadInfo.activeSelf)
{
SetRoadInfoActive(false);
}
roadInfoCloseBtn.onClick.AddListener(()=> { SetRoadInfoActive(false); });
}
public void SetCarInText(int Addvalue)
{
int n = int.Parse(carInTxt.text) + Addvalue;
carInTxt.text = n.ToString();
int n1 = int.Parse(carAllTxt.text) + Addvalue;
carAllTxt.text = n1.ToString();
}
public void SetCarOutText(int Addvalue)
{
int n = int.Parse(carOutTxt.text) + Addvalue;
carOutTxt.text = n.ToString();
int n1 = int.Parse(carAllTxt.text) + Addvalue;
carAllTxt.text = n1.ToString();
}
public void SetColorTitleActive()
{
if (colorTitle.activeSelf != false)
{
colorTitle.SetActive(false);
}
else
{
colorTitle.SetActive(true);
}
}
public void UpdateTime()
{
var hour = DateTime.Now.Hour;
var minute = DateTime.Now.Minute;
var second = DateTime.Now.Second;
var year = DateTime.Now.Year;
var month = DateTime.Now.Month;
var day = DateTime.Now.Day;
date = string.Format("{0:D4}/{1:D2}/{2:D2}" + "-" + "{3:D2}:{4:D2}:{5:D2} ", year, month, day, hour, minute, second);
dateTxt.text = date;
}
public void SetRoadInfoActive(bool t)
{
RoadInfo.SetActive(t);
}
}