2024-03-25 04:24:33 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using DistantLands.Cozy;
|
|
|
|
using TMPro;
|
|
|
|
using UnityEngine;
|
2024-04-01 17:46:53 +00:00
|
|
|
using UnityEngine.Serialization;
|
2024-03-25 04:24:33 +00:00
|
|
|
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;
|
2024-04-01 17:46:53 +00:00
|
|
|
[FormerlySerializedAs("cozyController")] [SerializeField] private CozyManager cozyManager;
|
2024-03-25 04:24:33 +00:00
|
|
|
|
|
|
|
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();
|
2024-04-01 17:46:53 +00:00
|
|
|
WeatherIcon.sprite = cozyManager.CurrentWeatherInfo.Sprite;
|
2024-03-25 04:24:33 +00:00
|
|
|
|
|
|
|
yield return new WaitForSeconds(updateTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|