GQ_Communicate/GQ_TongXin/Assets/script/报警/AlarmApparatus.cs

54 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
else if (num > 0)
{
gameObject.SetActive(true);
alarmUI.textMeshPro.text = num.ToString();
alarmUI.LoadShowInfo(num);
}
}
}