36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using System.Collections;
|
|
using DistantLands.Cozy;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class WeatherUi : MonoBehaviour
|
|
{
|
|
[field: SerializeField] public TMP_Text Date { get; set; }
|
|
[field: SerializeField] public TMP_Text Time { get; set; }
|
|
|
|
[field: SerializeField] public Image WeatherIcon { get; set; }
|
|
|
|
[SerializeField] private float updateTime = 1f;
|
|
|
|
private void Start()
|
|
{
|
|
StartCoroutine(nameof(TimeCoroutine));
|
|
}
|
|
|
|
private IEnumerator TimeCoroutine()
|
|
{
|
|
while (true)
|
|
{
|
|
Date.text = CozyWeather.instance.timeModule.currentDay + " Days";
|
|
Time.text = CozyWeather.instance.timeModule.currentTime.ToString();
|
|
WeatherIcon.sprite = CozyManager.Inst.CurrentWeatherInfo.Sprite;
|
|
|
|
yield return new WaitForSeconds(updateTime);
|
|
}
|
|
}
|
|
}
|
|
} |