GQ_Communicate/GQ_URP/GQ/Assets/Scripts/WJ/CabinetUIManager.cs

152 lines
4.0 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Accessibility;
public class CabinetUIManager : MonoBehaviour
{
public static CabinetUIManager Instance;
public Menu current_menu;
public List<CabinetUIBase> cabinet_ui_base_list = new List<CabinetUIBase>();
public List<Door> door_list = new List<Door>();
public List<TransparentGlow> transparentGlows_list = new List<TransparentGlow>();
/// <summary>
/// 机柜所有高亮
/// </summary>
[Header("机柜所有高亮组件")]
public List<GameObject> cabine_hights;
/// <summary>
/// 当前机柜高亮
/// </summary>
[Header("当前机柜在高亮的高亮组件")]
public List<GameObject> cabine_hights_now;
public Transform Stagin;
public List<UPosItem> uPosItems;
public GameObject jieDiWang;
private void Awake()
{
Instance = this;
uPosItems = transform.GetComponentsInChildren<UPosItem>(true).ToList();
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
{
cabine_hights.Add(GameManager.Inst.Cabinets_go[i].transform.Find("高亮").gameObject);
}
}
private void Start()
{
init();
}
public void init()
{
door_list = GetComponentsInChildren<Door>(true).ToList();
cabinet_ui_base_list = GetComponentsInChildren<CabinetUIBase>(true).ToList();
transparentGlows_list = GetComponentsInChildren<TransparentGlow>(true).ToList();
}
public static void ChangeMenu(Menu menu)
{
TransparentGlowManage.Inst.renewALL(TransparentGlowManage.Inst.transparentGlows);
if (menu != Menu.M_全景监控_摄像头)
{
ExtendedFlycam.Inst.peiDianShi[1].GetComponent<MeshCollider>().enabled = true;
ExtendedFlycam.Inst.jiFang[1].GetComponent<MeshCollider>().enabled = true;
}
else
{
ExtendedFlycam.Inst.peiDianShi[1].GetComponent<MeshCollider>().enabled = false;
ExtendedFlycam.Inst.jiFang[1].GetComponent<MeshCollider>().enabled = false;
}
if (menu != Menu.M_全景监控_柜门状态)
{
}
Instance.current_menu = menu;
PatternChoose.Inst.current_menu = menu;
Instance.cabinet_ui_base_list.ForEach(x => x.OnMenuChanged(menu));
RobotManager.Instance.OnMenuChanged(menu);
}
public bool SomeMethod()
{
var l = Array.FindAll(cabinet_ui_base_list.ToArray(), (item) =>
{
return (item.name.Contains("报警") || item.name.Contains("温湿度"));
});
for (int i = 0; i < l.Length; i++)
{
if (l[i].gameObject.activeSelf)
{
return false;
}
}
return true;
}
#region Editor Test
[ContextMenu("Editor Change Menu")]
public void ChangeMenu()
{
ChangeMenu(current_menu);
}
public GameObject 湿;
[ContextMenu("创建温湿度预制体")]
public void CreateWsd()
{
for (int i = 0; i < transform.childCount; i++)
{
if (transform.GetChild(i).Find("温湿度")) continue;
var go = Instantiate(湿);
go.name = "温湿度";
go.transform.SetParent(transform.GetChild(i));
}
}
#endregion
}
public enum Menu
{
M_全景监控_设备告警,
M_全景监控_温度,
M_全景监控_湿度,
M_全景监控_柜门状态,
M_全景监控_红外监测,
M_全景监控_现场作业,
M_全景监控_摄像头,
M_数字机房_机柜容量,
M_数字机房_接地网,
M_数字机房_线缆连接_展示,
M_数字机房_线缆连接_配置,
M_数字机房_场景管理,
M_数字机房_智能巡检,
M_数字机房_线缆组配置,
M_全景监控_烟感,
M_全景监控_水浸,
None,
M_远程指导,
M_智慧运维,
M_教学培训,
}