856 lines
34 KiB
C#
856 lines
34 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class UIToCabinet : MonoBehaviour
|
||
{
|
||
public List<Toggle> toggles = new List<Toggle>();
|
||
|
||
/// <summary>
|
||
/// 机柜容量标识
|
||
/// </summary>
|
||
public GameObject rongLaing;
|
||
|
||
public GameObject xianlanpz;
|
||
|
||
public GameObject mask_img;
|
||
|
||
public Button enter_home;
|
||
public Button back_home;
|
||
/// <summary>
|
||
/// 一级菜单
|
||
/// </summary>
|
||
public GameObject first_level_menu;
|
||
/// <summary>
|
||
/// 次级菜单
|
||
/// </summary>
|
||
public List<GameObject> second_level_menu;
|
||
|
||
public List<ClickEventLens> clickEventLens = new List<ClickEventLens>();
|
||
|
||
public Transform Stagin;
|
||
|
||
/// <summary>
|
||
/// 是否可以点击菜单
|
||
/// </summary>
|
||
public bool isContinue_menu = true;
|
||
/// <summary>
|
||
/// 当前是否有携程在运行
|
||
/// </summary>
|
||
//public bool isCoroutineRunning = false;
|
||
/// <summary>
|
||
/// 是否临时禁用Toggle的值变化
|
||
/// </summary>
|
||
//public bool isTemporarilyDisabled = false;
|
||
/// <summary>
|
||
/// 上一个Toggle
|
||
/// </summary>
|
||
//public Toggle last_Toggle;
|
||
//场景管理
|
||
public Toggle cjgl_Toggle;
|
||
public Toggle cjgl_Toggle_1;//场景管理一级菜单
|
||
|
||
private void Awake()
|
||
{
|
||
clickEventLens = GameObject.FindObjectsOfType<ClickEventLens>().ToList();
|
||
}
|
||
// Start is called before the first frame update
|
||
void Start()
|
||
{
|
||
|
||
enter_home.onClick.AddListener(() =>
|
||
{
|
||
mask_img.SetActive(false);
|
||
first_level_menu.SetActive(true);
|
||
matchingMenu("Toggle_数字机房", PatternChoose.Inst.huaXian);
|
||
});
|
||
toggles = GetComponentsInChildren<Toggle>(true).ToList();
|
||
back_home.onClick.AddListener(() =>
|
||
{
|
||
if (mask_img.activeSelf)
|
||
return;
|
||
WebInteraction.Inst.CloseVideo(WebInteraction.Inst.current_videoNumber);
|
||
WebInteraction.Inst.CloseTicket();
|
||
WebInteraction.Inst.ARVideo_close();
|
||
WebInteraction.Inst.Patrolvideo_close();
|
||
|
||
mask_img.SetActive(true);
|
||
|
||
TransparentGlowManage.Inst.renewALL();
|
||
|
||
CabinetUIManager.ChangeMenu(Menu.None);
|
||
//first_level_menu.transform.Find("Toggle Group/Toggle_全景监控").GetComponent<Toggle>().isOn = true;
|
||
|
||
|
||
for (int i = 10; i < WebInteraction.Inst.menu_struct.Count; i++)
|
||
{
|
||
if (WebInteraction.Inst.menu_struct[i]._ison)
|
||
{
|
||
WebInteraction.Inst.menu_struct[i].toggle.isOn = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
||
GameManager.Inst.Cabinets_go[i].transform.Find("高亮").gameObject.SetActive(false);
|
||
|
||
|
||
for (int i = 0; i < GameManager.Inst.pop_ups.Count; i++)
|
||
GameManager.Inst.pop_ups[i].SetActive(false);
|
||
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
first_level_menu.SetActive(false);
|
||
|
||
});
|
||
for (int i = 0; i < toggles.Count; i++)
|
||
{
|
||
var index = i;
|
||
toggles[index].onValueChanged.AddListener((ison) =>
|
||
{
|
||
if (!isContinue_menu)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (!toggles[index].gameObject.activeInHierarchy || mask_img.activeSelf)
|
||
return;
|
||
if (ison)
|
||
{
|
||
bool isgo = true;
|
||
if (/*toggles[index].name != "Toggle_场景管理" &&*/ Stagin.childCount > 0)
|
||
{
|
||
if (toggles[index].name != "Toggle_场景管理")
|
||
{
|
||
SecondConfirmPanel.DeleteConform((delete) =>
|
||
{
|
||
if (delete)
|
||
{
|
||
var d = PatternChoose.Inst.transform.Find("设备类").GetComponent<DeleteDevice>();
|
||
for (int z = 0; z < Stagin.childCount; z++)
|
||
{
|
||
d.mybody.ids.Add(Stagin.GetChild(z).GetComponent<DeviceQuery>().deviceList.id);
|
||
}
|
||
StartCoroutine(d.SaveJsonCoroutine((x, prompt) =>
|
||
{
|
||
if (!x)
|
||
{
|
||
cjgl_Toggle.isOn = true;
|
||
cjgl_Toggle_1.isOn = true;
|
||
|
||
Stagin.gameObject.SetActive(true);
|
||
isgo = false;
|
||
return;
|
||
}
|
||
// 删除场景
|
||
for (int z = Stagin.childCount - 1; z >= 0; z--)
|
||
{
|
||
DestroyImmediate(Stagin.GetChild(z).gameObject);
|
||
}
|
||
// 删除暂存箱
|
||
var content = GameManager.Inst.stagingPanel.transform.Find("Viewport/Content");
|
||
for (int i = content.childCount - 1; i >= 0; i--)
|
||
{
|
||
DestroyImmediate(content.GetChild(i).gameObject);
|
||
}
|
||
GameManager.Inst.stagingPanel.SetActive(false);
|
||
matchingMenu(toggles[index].name, PatternChoose.Inst.huaXian);
|
||
}));
|
||
}
|
||
else
|
||
{
|
||
cjgl_Toggle.isOn = true;
|
||
cjgl_Toggle_1.isOn = true;
|
||
|
||
Stagin.gameObject.SetActive(true);
|
||
isgo = false;
|
||
return;
|
||
}
|
||
}, "是否清空暂存箱设备(点击取消可对暂存箱子设备进行编辑)");// 请处理暂存箱内存存放的设备。是否删除暂存箱中所有设备(取消:可对暂存箱子设备进行拖拽编辑)
|
||
}
|
||
else
|
||
{
|
||
Stagin.gameObject.SetActive(true);
|
||
isgo = false;
|
||
}
|
||
}
|
||
if (!isgo || SecondConfirmPanel.Instance.transform.GetChild(0).gameObject.activeInHierarchy)
|
||
return;
|
||
CreateLine createLine = PatternChoose.Inst.huaXian;
|
||
UI_init();
|
||
Debug.Log("第" + index);
|
||
|
||
if (mask_img.activeSelf) return;
|
||
matchingMenu(toggles[index].name, createLine);//?
|
||
createLine.deletxianLan(CabinetUIManager.Instance.current_menu);
|
||
if (toggles[index].name == "Toggle_线缆连接展示" || toggles[index].name == "Toggle_线缆连接配置" ||
|
||
toggles[index].name == "Toggle_线缆组配置" || toggles[index].name == "Toggle_线缆连接")
|
||
{
|
||
xianlanpz.SetActive(true);
|
||
}
|
||
else
|
||
{
|
||
xianlanpz.SetActive(false);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 点击各个菜单按钮【根据权限匹配相应菜单(仅针对1级菜单)】
|
||
/// </summary>
|
||
/// <param name="toggle_name"></param>
|
||
/// <param name="createLine"></param>
|
||
/// <param name="ison"></param>
|
||
public void matchingMenu(string toggle_name, CreateLine createLine, Toggle toggle = null)
|
||
{
|
||
Debug.Log("按钮名称:" + toggle_name);
|
||
if (!isContinue_menu)
|
||
return;
|
||
isContinue_menu = false;
|
||
switch (toggle_name)
|
||
{
|
||
case "Toggle_智慧运维":
|
||
{
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
second_level_menu[4].SetActive(true);
|
||
string s = "";
|
||
for (int i = 3; i < 6; i++)
|
||
{
|
||
if (WebInteraction.Inst.menu_struct[i]._ison)
|
||
{
|
||
s = WebInteraction.Inst.menu_struct[i].toggle.gameObject.name;
|
||
WebInteraction.Inst.menu_struct[i].toggle.isOn = true;
|
||
break;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(s))
|
||
{
|
||
isContinue_menu = true;
|
||
Debug.Log("执行:" + s);
|
||
matchingMenu(s, createLine);
|
||
}
|
||
else
|
||
{
|
||
isContinue_menu = true;
|
||
}
|
||
}
|
||
break;
|
||
case "Toggle_教学培训":
|
||
{
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_数字机房":
|
||
{
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
second_level_menu[2].SetActive(true);
|
||
string s = "";
|
||
for (int i = 12; i < 16; i++)
|
||
{
|
||
if (WebInteraction.Inst.menu_struct[i]._ison)
|
||
{
|
||
s = WebInteraction.Inst.menu_struct[i].toggle.gameObject.name;
|
||
WebInteraction.Inst.menu_struct[i].toggle.isOn = true;
|
||
break;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(s))
|
||
{
|
||
isContinue_menu = true;
|
||
matchingMenu(s, createLine);
|
||
}
|
||
else
|
||
{
|
||
isContinue_menu = true;
|
||
}
|
||
}
|
||
break;
|
||
case "Toggle_设备告警":
|
||
{
|
||
//if (isCoroutineRunning)
|
||
// break;
|
||
//isCoroutineRunning = true;
|
||
StartCoroutine(Loadinfo(Menu.M_全景监控_设备告警, (x) =>
|
||
{
|
||
//isCoroutineRunning = false;
|
||
//if (string.IsNullOrEmpty(x))
|
||
//{
|
||
// isContinue_menu = true;
|
||
// return;
|
||
//}
|
||
init(Menu.M_全景监控_设备告警);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
SearchName searchName = GameManager.Inst.search_box.GetComponent<SearchName>();
|
||
searchName.LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.search_box.SetActive(true);
|
||
searchName.inputField.text = string.Empty;
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_设备告警);
|
||
isContinue_menu = true;
|
||
if (string.IsNullOrEmpty(x))
|
||
{
|
||
return;
|
||
}
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_设备告警);
|
||
|
||
|
||
}));
|
||
}
|
||
break;
|
||
case "Toggle_全景监控":
|
||
{
|
||
#region old
|
||
//StartCoroutine(Loadinfo(Menu.M_全景监控_设备告警, (x) =>
|
||
//{
|
||
// if (string.IsNullOrEmpty(x)) return;
|
||
// init(Menu.M_全景监控_设备告警);
|
||
// //ExtendedFlycam.Inst.QuanJing();
|
||
// GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
// GameManager.Inst.search_box.SetActive(true);GameManager.Inst.search_box.GetComponent<SearchName>().inputField.text=string.Empty;
|
||
// ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_设备告警);
|
||
// CabinetUIManager.ChangeMenu(Menu.M_全景监控_设备告警);
|
||
//}));
|
||
#endregion
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
second_level_menu[0].SetActive(true);
|
||
string s = "";
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
if (WebInteraction.Inst.menu_struct[i]._ison)
|
||
{
|
||
s = WebInteraction.Inst.menu_struct[i].toggle.gameObject.name;
|
||
WebInteraction.Inst.menu_struct[i].toggle.isOn = true;
|
||
break;
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(s))
|
||
{
|
||
isContinue_menu = true;
|
||
matchingMenu(s, createLine);
|
||
}
|
||
else
|
||
{
|
||
isContinue_menu = true;
|
||
}
|
||
}
|
||
break;
|
||
|
||
case "Toggle_温湿度":
|
||
{
|
||
//if (isCoroutineRunning)
|
||
// break;
|
||
//isCoroutineRunning = true;
|
||
StartCoroutine(Loadinfo(Menu.M_全景监控_温度, (x) =>
|
||
{
|
||
//isCorkoutineRunning = false;
|
||
if (string.IsNullOrEmpty(x))
|
||
{
|
||
isContinue_menu = true;
|
||
return;
|
||
}
|
||
init(Menu.M_全景监控_温度);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
SearchName searchName = GameManager.Inst.search_box.GetComponent<SearchName>();
|
||
searchName.LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.search_box.SetActive(true);
|
||
searchName.inputField.text = string.Empty;
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_温度);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_温度);
|
||
|
||
isContinue_menu = true;
|
||
}));
|
||
}
|
||
break;
|
||
case "Toggle_柜门状态":
|
||
{
|
||
init(Menu.M_全景监控_柜门状态);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.DoorCondition(/*ison*/);
|
||
SearchName searchName = GameManager.Inst.search_box.GetComponent<SearchName>();
|
||
searchName.LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.search_box.SetActive(true);
|
||
searchName.inputField.text = string.Empty;
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_柜门状态);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_柜门状态);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_红外监测":
|
||
{
|
||
init(Menu.M_全景监控_红外监测);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.SetActive(false);
|
||
IRPopup.Inst.LoadmoreDetails();
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_红外监测);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_红外监测);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_现场作业":
|
||
{
|
||
init(Menu.M_全景监控_现场作业);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
//if (BoolMonitor.Value)
|
||
{
|
||
|
||
WebInteraction.Inst.isWorkPlay = true;
|
||
WebInteraction.Inst.OpenTicket();
|
||
}
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_现场作业);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_现场作业);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_摄像头":
|
||
{
|
||
init(Menu.M_全景监控_摄像头);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_摄像头);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_摄像头);
|
||
ExtendedFlycam.Inst.peiDianShi[1].GetComponent<TransparentGlow>().F1();
|
||
ExtendedFlycam.Inst.jiFang[1].GetComponent<TransparentGlow>().F1();
|
||
for (int i = 0; i < clickEventLens.Count; i++)
|
||
{
|
||
if (clickEventLens[i].baseConf.conf1.LensID == "09" || clickEventLens[i].baseConf.conf1.LensID == "13")
|
||
{
|
||
clickEventLens[i].ChangeMaterialColor(clickEventLens[i].gameObject, 5);
|
||
continue;
|
||
}
|
||
if (clickEventLens[i].coroutine == null)
|
||
StartCoroutine(clickEventLens[i].TwinkleLens(0.25f));
|
||
}
|
||
LocalVideo.Inst.AlarmFlashing();
|
||
LocalVideo.Inst.RecoveryUI();
|
||
LocalVideo.Inst.AssignDataToUI();
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_机柜容量":
|
||
{
|
||
rongLaing.SetActive(true);
|
||
init(Menu.M_数字机房_机柜容量);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.DisplayCapacity(/*ison*/true);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_机柜容量);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_机柜容量);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_接地网":
|
||
{
|
||
FloorController.Inst.FloorTransparent();
|
||
init(Menu.M_数字机房_接地网);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_接地网);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_接地网);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_线缆连接":
|
||
{
|
||
init(Menu.M_数字机房_线缆连接_展示);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
//CreateLine createLine = PatternChoose.Inst.huaXian;
|
||
createLine.OnMenuChanged(Menu.M_数字机房_线缆连接_展示);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_线缆连接_展示);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_线缆连接_展示);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_场景管理":
|
||
{
|
||
init(Menu.M_数字机房_场景管理);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
//GameManager.Inst.power_open();
|
||
//GameManager.Inst.objectToShow_add.SetActive(true);
|
||
var SN1 = GameManager.Inst.objectToShow_add.GetComponent<SearchName1>();
|
||
SN1.hide_menu();
|
||
SearchName searchName = GameManager.Inst.search_box.GetComponent<SearchName>();
|
||
searchName.LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.search_box.SetActive(true);
|
||
searchName.inputField.text = string.Empty;
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_场景管理);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_场景管理);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_智能巡检":
|
||
{
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
init(Menu.M_数字机房_智能巡检);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
WebInteraction.Inst.Patrolvideo_open();
|
||
GameManager.Inst.search_box.SetActive(false);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_智能巡检);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_智能巡检);
|
||
ExtendedFlycam.Inst.room = ExtendedFlycam.Room.None;
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_温度":
|
||
{
|
||
//if (isCoroutineRunning)
|
||
// break;
|
||
//isCoroutineRunning = true;
|
||
StartCoroutine(Loadinfo(Menu.M_全景监控_温度, (x) =>
|
||
{
|
||
//isCoroutineRunning = false;
|
||
if (string.IsNullOrEmpty(x))
|
||
{
|
||
isContinue_menu = true;
|
||
return;
|
||
}
|
||
init(Menu.M_全景监控_温度);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_温度);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_温度);
|
||
|
||
isContinue_menu = true;
|
||
}));
|
||
}
|
||
break;
|
||
case "Toggle_湿度":
|
||
{
|
||
init(Menu.M_全景监控_湿度);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_湿度);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_湿度);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_烟感":
|
||
{
|
||
init(Menu.M_全景监控_烟感);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_烟感);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_烟感);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_水浸":
|
||
{
|
||
init(Menu.M_全景监控_水浸);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.机柜);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_全景监控_水浸);
|
||
CabinetUIManager.ChangeMenu(Menu.M_全景监控_水浸);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_线缆连接展示":
|
||
{
|
||
init(Menu.M_数字机房_线缆连接_展示);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
|
||
//GameManager.Inst.search_box.GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.线缆_展示);
|
||
createLine.OnMenuChanged(Menu.M_数字机房_线缆连接_展示);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_线缆连接_展示);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_线缆连接_展示);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_线缆连接配置":
|
||
{
|
||
init(Menu.M_数字机房_线缆连接_配置);
|
||
//ExtendedFlycam.Inst.QuanJing();
|
||
//GameManager.Inst.power_open();
|
||
|
||
SearchName searchName = GameManager.Inst.search_box.GetComponent<SearchName>();
|
||
searchName.LoadCabinet(SearchName.SearchType.机柜);
|
||
GameManager.Inst.search_box.SetActive(true);
|
||
searchName.inputField.text = string.Empty;
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_数字机房_线缆连接_配置);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_线缆连接_配置);
|
||
|
||
isContinue_menu = true;
|
||
|
||
LineGroupManager.Instance.ShowPanel();
|
||
SecondConfirmPanel.Instance.panel_object.SetActive(false);
|
||
}
|
||
break;
|
||
case "Toggle_线缆组配置":
|
||
{
|
||
LineGroupManager.Instance.ShowPanel();
|
||
SecondConfirmPanel.Instance.panel_object.SetActive(false);
|
||
init(Menu.M_数字机房_线缆组配置);
|
||
CabinetUIManager.ChangeMenu(Menu.M_数字机房_线缆组配置);
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
case "Toggle_远程指导":
|
||
{
|
||
for (int i = 0; i < second_level_menu.Count; i++)
|
||
second_level_menu[i].SetActive(false);
|
||
init(Menu.M_远程指导);
|
||
WebInteraction.Inst.ARVideo_open();
|
||
GameManager.Inst.search_box.SetActive(false);
|
||
ExtendedFlycam.Inst.QieHuan(Menu.M_远程指导);
|
||
CabinetUIManager.ChangeMenu(Menu.M_远程指导);
|
||
ExtendedFlycam.Inst.room = ExtendedFlycam.Room.None;
|
||
|
||
isContinue_menu = true;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 按键切换初始化
|
||
/// </summary>
|
||
public void UI_init(string toolname = null)
|
||
{
|
||
PatternChoose.Inst.xunJianImg.gameObject.SetActive(false);
|
||
WebInteraction.Inst.CloseVideo(WebInteraction.Inst.current_videoNumber);
|
||
WebInteraction.Inst.Patrolvideo_close();
|
||
WebInteraction.Inst.ARVideo_close();
|
||
//WebInteraction.Inst.Infraredsensor_close();
|
||
GameManager.Inst.power_close();
|
||
GameManager.Inst.CloseHighlight();
|
||
|
||
if (GameManager.Inst.objectToShow_add.activeSelf)
|
||
{
|
||
var SN1 = GameManager.Inst.objectToShow_add.GetComponent<SearchName1>();
|
||
SN1.hide_menu();
|
||
GameManager.Inst.objectToShow_add.SetActive(false);
|
||
}
|
||
GameManager.Inst.stagingPanel.SetActive(false);
|
||
GameManager.Inst.editorMenu.gameObject.SetActive(false);
|
||
|
||
rongLaing.SetActive(false);
|
||
FloorController.Inst.FloorNormal();
|
||
|
||
LineGroupManager.Instance.HidePanel();
|
||
|
||
for (int i = 0; i < GameManager.Inst.pop_ups.Count; i++)
|
||
{
|
||
GameManager.Inst.pop_ups[i].SetActive(false);
|
||
}
|
||
|
||
for (int i = 0; i < CabinetUIManager.Instance.cabinet_ui_base_list.Count; i++)
|
||
{
|
||
if (CabinetUIManager.Instance.cabinet_ui_base_list[i].gameObject.name != "智能巡检")
|
||
{
|
||
CabinetUIManager.Instance.cabinet_ui_base_list[i].gameObject.SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
public IEnumerator Loadinfo(Menu menu, Action<string> callback)
|
||
{
|
||
if (menu == Menu.M_全景监控_温度)
|
||
{
|
||
yield return StartCoroutine(GameManager.Inst.init_ENV((x) =>
|
||
{
|
||
if (string.IsNullOrEmpty(x))
|
||
callback.Invoke(null);
|
||
else
|
||
{
|
||
GameManager.Inst.Load_ENV();
|
||
callback?.Invoke("1");
|
||
}
|
||
}));
|
||
}
|
||
else if (menu == Menu.M_全景监控_设备告警)
|
||
{
|
||
yield return StartCoroutine(GameManager.Inst.init_TmsAlarm((x) =>
|
||
{
|
||
if (string.IsNullOrEmpty(x))
|
||
callback.Invoke(null);
|
||
else
|
||
{
|
||
GameManager.Inst.Load_TmsAlarm();
|
||
callback?.Invoke("1");
|
||
}
|
||
}));
|
||
}
|
||
}
|
||
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
if (!isContinue_menu)
|
||
{
|
||
for (int i = 0; i < WebInteraction.Inst.menu_struct.Count; i++)
|
||
{
|
||
WebInteraction.Inst.menu_struct[i].toggle.interactable = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
for (int i = 0; i < WebInteraction.Inst.menu_struct.Count; i++)
|
||
{
|
||
WebInteraction.Inst.menu_struct[i].toggle.interactable = true;
|
||
}
|
||
}
|
||
if (first_level_menu.activeSelf)
|
||
{
|
||
if (WebInteraction.Inst.menu_struct[0].toggle.isOn)//智慧运维
|
||
{
|
||
second_level_menu[4].SetActive(true);
|
||
second_level_menu[2].SetActive(false);
|
||
}
|
||
else if (WebInteraction.Inst.menu_struct[1].toggle.isOn)//数字机房
|
||
{
|
||
second_level_menu[0].SetActive(false);
|
||
second_level_menu[2].SetActive(true);
|
||
}
|
||
else if (WebInteraction.Inst.menu_struct[2].toggle.isOn) //教学培训
|
||
{
|
||
second_level_menu[4].SetActive(false);
|
||
second_level_menu[2].SetActive(false);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void init(Menu menu)
|
||
{
|
||
|
||
if (WebInteraction.Inst.isWorkPlay && menu != Menu.M_全景监控_现场作业)
|
||
WebInteraction.Inst.CloseTicket();
|
||
|
||
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
|
||
{
|
||
GameManager.Inst.Cabinets_go[i].SetActive(true);
|
||
}
|
||
|
||
GameObject createLine = PatternChoose.Inst.xianlan.gameObject;
|
||
if (!CheckAllChildrenActive(createLine.gameObject) && menu != Menu.M_数字机房_线缆连接_展示)
|
||
{
|
||
for (int i = 0; i < createLine.transform.childCount; i++)
|
||
{
|
||
createLine.transform.GetChild(i).gameObject.SetActive(false);
|
||
}
|
||
}
|
||
|
||
if (menu == Menu.M_数字机房_线缆连接_配置 || menu == Menu.M_数字机房_场景管理 ||
|
||
menu == Menu.M_数字机房_线缆组配置)
|
||
{
|
||
for (int i = 0; i < CabinetUIManager.Instance.door_list.Count; i++)
|
||
{
|
||
CabinetUIManager.Instance.door_list[i].gameObject.SetActive(false);
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
for (int i = 0; i < CabinetUIManager.Instance.door_list.Count; i++)
|
||
{
|
||
CabinetUIManager.Instance.door_list[i].gameObject.SetActive(true);
|
||
}
|
||
}
|
||
|
||
if (menu == Menu.M_数字机房_机柜容量 || menu == Menu.M_数字机房_场景管理)
|
||
{
|
||
if (CabinetUIManager.Instance.uPosItems[0].instruct.gameObject.activeInHierarchy)
|
||
{ } /*return;*/
|
||
else
|
||
{
|
||
for (int i = 0; i < CabinetUIManager.Instance.uPosItems.Count; i++)
|
||
{
|
||
CabinetUIManager.Instance.uPosItems[i].instruct.gameObject.SetActive(true);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (!CabinetUIManager.Instance.uPosItems[0].instruct.gameObject.activeInHierarchy)
|
||
{ } /*return;*/
|
||
else
|
||
{
|
||
for (int i = 0; i < CabinetUIManager.Instance.uPosItems.Count; i++)
|
||
{
|
||
CabinetUIManager.Instance.uPosItems[i].instruct.gameObject.SetActive(false);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
if (menu == Menu.M_数字机房_智能巡检)
|
||
{
|
||
//CalendarScript.Inst.open();
|
||
CalendarDetails.Inst.init();
|
||
if (GameManager.Inst.Jk_URL != null)
|
||
RobotReturnData.Inst.init();
|
||
}
|
||
else
|
||
{
|
||
//CalendarScript.Inst.close();
|
||
CalendarDetails.Inst.close();
|
||
RobotReturnData.Inst.gameObject.SetActive(false);
|
||
}
|
||
|
||
if (menu == Menu.M_全景监控_红外监测)
|
||
{
|
||
for (int i = IRPopup.Inst.content.childCount - 1; i >= 0; i--)
|
||
{
|
||
DestroyImmediate(IRPopup.Inst.content.GetChild(i).gameObject);
|
||
}
|
||
}
|
||
IRPopup.Inst.popup.SetActive(false);
|
||
|
||
if (menu == Menu.M_全景监控_摄像头)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
|
||
}
|
||
|
||
GameManager.Inst.RemoveEmptyElements();
|
||
for (int i = 0; i < GameManager.Inst.TmsPorts_go.Count; i++)
|
||
{
|
||
GameManager.Inst.TmsPorts_go[i].GetComponent<PortQuery>().hight.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;
|
||
}
|
||
}
|