설비 KPI 기능 및 디자인 수정
This commit is contained in:
@@ -10,11 +10,18 @@ using static MQTT;
|
||||
using CHN;
|
||||
using System.Globalization;
|
||||
|
||||
public class UI_MachineKPI : UIBase, IPointerClickHandler
|
||||
public class UI_MachineKPI : UIBase, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public SimpleField data;
|
||||
|
||||
private TextMeshProUGUI MachineName;
|
||||
public RectTransform Default_KPI;
|
||||
private RectTransform Expand_KPI;
|
||||
|
||||
private TextMeshProUGUI DefaultMachineName;
|
||||
private TextMeshProUGUI ExpandMachineName;
|
||||
private Image Default_Status;
|
||||
private Image Expand_Status;
|
||||
|
||||
private TextMeshProUGUI eorate;
|
||||
private TextMeshProUGUI daynight;
|
||||
private TextMeshProUGUI workcd;
|
||||
@@ -36,9 +43,31 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
|
||||
workcd.SetText(data.machineInfo.workcd);
|
||||
goodqtyrate.SetText(DecimalPointCalculate(data.kpiDataInfo.goodqtyrate).ToString() + "%");
|
||||
porate.SetText(DecimalPointCalculate(data.kpiDataInfo.porate).ToString() +"%");
|
||||
workdt.SetText(CorrectionTime(data.machineInfo.workdt, "yyyy-MM-dd"));
|
||||
|
||||
var workdate = CorrectionTime(data.machineInfo.workdt, "yyyy-MM-dd");
|
||||
MachineName.SetText(ApplyDualFont(data.machineInfo.worknm, workdate, secondaryFontName));
|
||||
DefaultMachineName.SetText(data.machineInfo.worknm);
|
||||
ExpandMachineName.SetText(data.machineInfo.worknm);
|
||||
|
||||
Default_Status.color = SetStatusColor(data.machineInfo.statusnm);
|
||||
Expand_Status.color = SetStatusColor(data.machineInfo.statusnm);
|
||||
}
|
||||
private Color SetStatusColor(string value)
|
||||
{
|
||||
var color = Color.white;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case "°¡µ¿Áß":
|
||||
color = Color.green;
|
||||
break;
|
||||
case "ºñ°¡µ¿":
|
||||
color = Color.red;
|
||||
break;
|
||||
default:
|
||||
color = Color.yellow;
|
||||
break;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
private bool CheckDataExists(string value)
|
||||
{
|
||||
@@ -62,16 +91,12 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
|
||||
}
|
||||
private string CorrectionTime(string value, string dateForm)
|
||||
{
|
||||
DateTime.TryParseExact(value, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate);
|
||||
|
||||
return parsedDate.ToString(dateForm);
|
||||
}
|
||||
string ApplyDualFont(string originText, string addText, string fontName)
|
||||
{
|
||||
string result = originText;
|
||||
|
||||
result += $"<font=\"{fontName}\"><size=\"10f\">({addText})</size></font>";
|
||||
return result;
|
||||
if(DateTime.TryParseExact(value, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out var parsedDate))
|
||||
{
|
||||
return parsedDate.ToString(dateForm);
|
||||
}
|
||||
return "----/--/--";
|
||||
|
||||
}
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
@@ -88,4 +113,30 @@ public class UI_MachineKPI : UIBase, IPointerClickHandler
|
||||
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (!isExpand)
|
||||
{
|
||||
if (Expand_KPI == null && Default_KPI == null)
|
||||
return;
|
||||
|
||||
Expand_KPI.gameObject.SetActive(true);
|
||||
Default_KPI.gameObject.SetActive(false);
|
||||
|
||||
isExpand = true;
|
||||
|
||||
transform.SetAsLastSibling();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if (isExpand)
|
||||
{
|
||||
Default_KPI.gameObject.SetActive(true);
|
||||
Expand_KPI.gameObject.SetActive(false);
|
||||
isExpand = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user