55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class AlarmApparatus : CabinetUIBase
|
|
{
|
|
public static Transform Camera;
|
|
public AlarmUI alarmUI;
|
|
public List<TmsAlarmQuery> alarmQueries;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
Camera = UnityEngine.Camera.main.transform;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
transform.eulerAngles = Camera.eulerAngles;
|
|
}
|
|
|
|
public override void OnMenuChanged(Menu menu)
|
|
{
|
|
base.OnMenuChanged(menu);
|
|
var t = transform.parent.GetComponentsInChildren<TmsAlarmQuery>();
|
|
alarmQueries = Array.FindAll(t, item =>
|
|
{
|
|
if (item.tmsAlarmLists != null)
|
|
return true;
|
|
return false;
|
|
}).ToList();
|
|
int num = 0;
|
|
for (int i = 0; i < alarmQueries.Count; i++)
|
|
{
|
|
num += alarmQueries[i].tmsAlarmLists.Count;
|
|
|
|
}
|
|
if (menu != Menu.M_全景监控_设备告警)
|
|
{
|
|
gameObject.SetActive(false);
|
|
alarmUI.canvas.gameObject.SetActive(false);
|
|
}
|
|
else if (menu == Menu.M_全景监控_设备告警 && num > 0)
|
|
{
|
|
gameObject.SetActive(true);
|
|
alarmUI.textMeshPro.text = num.ToString();
|
|
alarmUI.LoadShowInfo(num);
|
|
}
|
|
|
|
}
|
|
}
|