using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; /// /// 本地视频告警UI /// public class LocalVideoAlarm : CabinetUIBase { /// /// 摄像头配置 /// public BaseConf baseConf; public LocalVideoAlarmUI localVideoAlarmUI; public Transform Camera; private void Awake() { baseConf = transform.parent.GetComponent().baseConf; } // Start is called before the first frame update void Start() { localVideoAlarmUI.preform.GetComponent().image_view = LocalVideo.Inst.transform.Find("图片轮播").gameObject; Camera = UnityEngine.Camera.main.transform; gameObject.SetActive(false); } // Update is called once per frame void Update() { transform.eulerAngles = Camera.eulerAngles; if (localVideoAlarmUI.Content && localVideoAlarmUI.Content.gameObject.activeSelf) { // Grid 的高 = 图高 * 行 + 行间距 * (行 - 1) var content = localVideoAlarmUI.Content; var grid = content.GetComponent(); var x = content.sizeDelta.x; var y = grid.cellSize.y * content.childCount; content.sizeDelta = new Vector2(x, y); } } public override void OnMenuChanged(Menu menu) { EnterTheCameraModule(menu); } public void EnterTheCameraModule(Menu menu = Menu.M_全景监控_摄像头) { base.OnMenuChanged(menu); if (menu == Menu.M_全景监控_摄像头 && baseConf.conf1.alarmEntities.Count > 0) { gameObject.SetActive(true); localVideoAlarmUI.LoadShowInfo(baseConf.conf1.alarmEntities.Count); } else { if (!gameObject.activeInHierarchy) return; localVideoAlarmUI.canvas.transform.GetChild(0).gameObject.SetActive(false); gameObject.SetActive(false); } } }