94 lines
2.6 KiB
C#
94 lines
2.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using static MQTT;
|
|
using WI;
|
|
|
|
public class Panel_WorkProgressStatus : PanelBase
|
|
{
|
|
public Dictionary<string, UI_WorkStatusItem> workStatuses = new Dictionary<string, UI_WorkStatusItem>();
|
|
private Panel_Effect effect;
|
|
private UI_WorkStatusItem prf_workStatusItem;
|
|
public ScrollRect ScrollView_StatusItems;
|
|
public Button CloseButton;
|
|
public TextMeshProUGUI CurrentDate;
|
|
public TextMeshProUGUI CurrentTime;
|
|
|
|
public float fadeTime;
|
|
|
|
public override void AfterAwake()
|
|
{
|
|
prf_workStatusItem = Resources.Load<UI_WorkStatusItem>("Prefabs/UI/UI_WorkStatusItem");
|
|
CloseButton.onClick.AddListener(Close);
|
|
SetDate();
|
|
Close();
|
|
}
|
|
public void Update()
|
|
{
|
|
SetTime();
|
|
}
|
|
public void Open()
|
|
{
|
|
effect.ActivePanel(gameObject);
|
|
gameObject.SetActive(true);
|
|
gameObject.transform.SetAsLastSibling();
|
|
|
|
StopAllCoroutines();
|
|
StartCoroutine(ScaleUp());
|
|
}
|
|
public void Close()
|
|
{
|
|
effect.DeactivePanel(gameObject);
|
|
gameObject.SetActive(false);
|
|
gameObject.transform.localScale = Vector3.zero;
|
|
}
|
|
public void SetWorkProgressStatus(List<WorkShopInfo> workShopInfos)
|
|
{
|
|
bool odd = true;
|
|
foreach (var workShopInfo in workShopInfos)
|
|
{
|
|
if (!workStatuses.ContainsKey(workShopInfo.groupcd))
|
|
{
|
|
var workStatusItem = Instantiate(prf_workStatusItem, ScrollView_StatusItems.content);
|
|
workStatuses.Add(workShopInfo.groupcd, workStatusItem);
|
|
}
|
|
|
|
if (odd)
|
|
{
|
|
workStatuses[workShopInfo.groupcd].SetStatusData(workShopInfo, new Color(0.07058824f, 0.1294118f, 0.2941177f));
|
|
}
|
|
else
|
|
{
|
|
workStatuses[workShopInfo.groupcd].SetStatusData(workShopInfo, new Color(0.04313726f, 0.09019608f, 0.2235294f));
|
|
}
|
|
odd = !odd;
|
|
}
|
|
}
|
|
public void SetDate()
|
|
{
|
|
CurrentDate.text = DateTime.Now.ToString("yyyy.MM.dd");
|
|
}
|
|
public void SetTime()
|
|
{
|
|
CurrentTime.text = DateTime.Now.ToString("HH:mm");
|
|
}
|
|
IEnumerator ScaleUp()
|
|
{
|
|
float timer = 0f;
|
|
float percent = 0f;
|
|
|
|
while (percent < 1)
|
|
{
|
|
timer += Time.deltaTime;
|
|
percent = timer / fadeTime;
|
|
transform.localScale = Vector3.Lerp(transform.localScale, Vector3.one, percent);
|
|
|
|
yield return null;
|
|
}
|
|
|
|
}
|
|
}
|