75 lines
2.5 KiB
C#
75 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class CabinetUIBase : MonoBehaviour
|
|
{
|
|
public virtual void OnMenuChanged(Menu menu)
|
|
{
|
|
if (WebInteraction.Inst.isWorkPlay && menu != Menu.M_全景监控_现场作业)
|
|
WebInteraction.Inst.CloseTicket();
|
|
//if (!GameManager.Inst.search_box.activeSelf)//搜索
|
|
//{
|
|
// if (menu == Menu.M_全景监控_柜门状态 ||
|
|
// menu == Menu.M_全景监控_设备告警 ||
|
|
// menu == Menu.M_全景监控_摄像头 ||
|
|
// menu == Menu.M_全景监控_现场作业 ||
|
|
// menu == Menu.M_全景监控_现场作业 ||
|
|
// menu == Menu.M_全景监控_温度 ||
|
|
// menu == Menu.M_全景监控_湿度 ||
|
|
// menu == Menu.M_数字孪生_场景管理||
|
|
// menu == Menu.M_数字孪生_机柜容量)
|
|
// {
|
|
// PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
|
// GameManager.Inst.search_box.SetActive(true);
|
|
// }
|
|
// else if (menu == Menu.M_全景监控_红外监测)
|
|
// {
|
|
// GameManager.Inst.search_box.SetActive(false);
|
|
// }
|
|
// else
|
|
// {
|
|
// GameManager.Inst.search_box.SetActive(false);
|
|
// }
|
|
//}
|
|
//else
|
|
//{
|
|
// if (menu == Menu.M_全景监控_红外监测)
|
|
// {
|
|
// GameManager.Inst.search_box.SetActive(false);
|
|
// }
|
|
//}
|
|
|
|
CreateLine createLine = PatternChoose.Inst.transform.Find("画线").GetComponent<CreateLine>();
|
|
if (!CheckAllChildrenActive(createLine.gameObject) && menu != Menu.M_数字孪生_线缆连接_展示)
|
|
{
|
|
for (int i = 0; i < createLine.transform.childCount; i++)
|
|
{
|
|
createLine.transform.GetChild(i).gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断父物体下子物体是否都为隐藏
|
|
/// </summary>
|
|
/// <param name="parent"></param>
|
|
/// <returns></returns>
|
|
bool CheckAllChildrenActive(GameObject parent)
|
|
{
|
|
int childCount = parent.transform.childCount;
|
|
for (int i = 0; i < childCount; i++)
|
|
{
|
|
GameObject child = parent.transform.GetChild(i).gameObject;
|
|
if (child.activeSelf)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|