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