68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
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
|
|
{
|
|
public class UI_CompleteTimeAlarmInfo : UIBase, IPointerEnterHandler
|
|
{
|
|
public CompleteInfo completeInfo;
|
|
public TextMeshProUGUI Worknm;
|
|
public TextMeshProUGUI Progressrate;
|
|
public TextMeshProUGUI Ptotm;
|
|
public TextMeshProUGUI Statusnm;
|
|
|
|
//public Slider Progressrate;
|
|
public Image Image_Alarm;
|
|
|
|
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);
|
|
//Progressrate.value = float.Parse(completeInfo.progressrate);
|
|
}
|
|
private int DecimalRoundingCalculate(string value)
|
|
{
|
|
var originFloatValue = float.Parse(value);
|
|
int intValue = Mathf.RoundToInt(originFloatValue);
|
|
|
|
if (intValue >= 100)
|
|
{
|
|
intValue = 100;
|
|
}
|
|
|
|
return intValue;
|
|
}
|
|
|
|
public void StartAlarmBlink()
|
|
{
|
|
if (!rectTransform.gameObject.activeInHierarchy || isCheck)
|
|
return;
|
|
Image_Alarm.color = Color.red;
|
|
//StopAllCoroutines();
|
|
//StartCoroutine(Blink());
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
Image_Alarm.color = new Color(1, 1, 1, 1);
|
|
isCheck = true;
|
|
onCheck?.Invoke(this);
|
|
}
|
|
}
|
|
}
|