2025-02-20 09:59:37 +09:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using WI;
|
|
|
|
|
|
using TMPro;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using static MQTT;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CHN
|
|
|
|
|
|
{
|
2025-02-24 18:48:14 +09:00
|
|
|
|
public enum MachineStatusnm
|
|
|
|
|
|
{
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
|
<EFBFBD><EFBFBD>,
|
|
|
|
|
|
<EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
}
|
2025-02-20 09:59:37 +09:00
|
|
|
|
public class UI_CompleteTimeAlarmInfo : UIBase, IPointerEnterHandler
|
|
|
|
|
|
{
|
2025-02-24 18:48:14 +09:00
|
|
|
|
public MachineStatusnm statusnm;
|
|
|
|
|
|
|
2025-02-20 09:59:37 +09:00
|
|
|
|
public CompleteInfo completeInfo;
|
|
|
|
|
|
public TextMeshProUGUI Worknm;
|
|
|
|
|
|
public TextMeshProUGUI Progressrate;
|
|
|
|
|
|
public TextMeshProUGUI Ptotm;
|
|
|
|
|
|
public TextMeshProUGUI Statusnm;
|
|
|
|
|
|
|
|
|
|
|
|
public bool isCheck;
|
|
|
|
|
|
public Action<UI_CompleteTimeAlarmInfo> onCheck;
|
|
|
|
|
|
|
|
|
|
|
|
public void SetInfo(CompleteInfo completeInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.completeInfo = completeInfo;
|
|
|
|
|
|
var progressrate = DecimalRoundingCalculate(completeInfo.progressrate) + "%";
|
|
|
|
|
|
Worknm.SetText(completeInfo.worknm);
|
|
|
|
|
|
Progressrate.SetText(progressrate.ToString());
|
|
|
|
|
|
Ptotm.SetText(completeInfo.ptotm);
|
|
|
|
|
|
Statusnm.SetText(completeInfo.statusnm);
|
2025-02-24 18:48:14 +09:00
|
|
|
|
StatusSetColor();
|
2025-02-20 09:59:37 +09:00
|
|
|
|
}
|
|
|
|
|
|
private int DecimalRoundingCalculate(string value)
|
|
|
|
|
|
{
|
|
|
|
|
|
var originFloatValue = float.Parse(value);
|
|
|
|
|
|
int intValue = Mathf.RoundToInt(originFloatValue);
|
|
|
|
|
|
|
|
|
|
|
|
if (intValue >= 100)
|
|
|
|
|
|
{
|
|
|
|
|
|
intValue = 100;
|
|
|
|
|
|
}
|
2025-02-24 18:48:14 +09:00
|
|
|
|
|
2025-02-20 09:59:37 +09:00
|
|
|
|
return intValue;
|
|
|
|
|
|
}
|
2025-02-24 18:48:14 +09:00
|
|
|
|
private void StatusSetColor()
|
2025-02-20 09:59:37 +09:00
|
|
|
|
{
|
2025-02-24 18:48:14 +09:00
|
|
|
|
var color = Color.white;
|
|
|
|
|
|
var status = MachineStatusnm.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
2025-02-20 09:59:37 +09:00
|
|
|
|
|
2025-02-24 18:48:14 +09:00
|
|
|
|
if(Enum.TryParse(completeInfo.statusnm, out status))
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (status)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MachineStatusnm.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
|
|
|
|
|
color = Color.green;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MachineStatusnm.<EFBFBD><EFBFBD>:
|
|
|
|
|
|
color = Color.red;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case MachineStatusnm.<EFBFBD><EFBFBD>ȹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
|
|
|
|
|
color = Color.white;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
color = new Color(255, 86, 0, 255);
|
|
|
|
|
|
}
|
|
|
|
|
|
Statusnm.color = color;
|
|
|
|
|
|
}
|
2025-02-20 09:59:37 +09:00
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
|
|
|
|
{
|
|
|
|
|
|
isCheck = true;
|
|
|
|
|
|
onCheck?.Invoke(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|