55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class CabinetUIBase : MonoBehaviour
|
|
{
|
|
public virtual void OnMenuChanged(Menu menu)
|
|
{
|
|
if (WebInteraction.Inst.isWorkPlay && menu != Menu.M_全景监控_现场作业)
|
|
WebInteraction.Inst.CloseTicket();
|
|
|
|
//if (menu == Menu.M_数字孪生_场景管理)
|
|
//{
|
|
|
|
// Camera.main.GetComponent<PhysicsRaycaster>().enabled = true;
|
|
//}
|
|
//else
|
|
//{
|
|
// Camera.main.GetComponent<PhysicsRaycaster>().enabled = 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;
|
|
}
|
|
|
|
}
|