This commit is contained in:
高国正 2023-08-27 12:44:10 +08:00
parent 3a340cabed
commit 04d1a408c2
10 changed files with 4615 additions and 864 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,47 +8,10 @@ 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;
}
}

View File

@ -100,4 +100,5 @@ public enum Menu
M_数字孪生_线缆连接_配置,
M_数字孪生_场景管理,
M_数字孪生_智能巡检,
M_数字孪生_线缆组配置,
}

View File

@ -32,6 +32,7 @@ public class UIToCabinet : MonoBehaviour
{
case "Toggle_设备告警":
{
init(Menu.M_全景监控_设备告警);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
GameManager.Inst.search_box.SetActive(true);
@ -40,6 +41,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_全景监控":
{
init(Menu.M_全景监控_设备告警);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
GameManager.Inst.search_box.SetActive(true);
@ -48,6 +50,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_数字孪生":
{
init(Menu.M_数字孪生_机柜容量);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.DisplayCapacity(ison);
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
@ -56,6 +59,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_温湿度":
{
init(Menu.M_全景监控_温度);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
GameManager.Inst.search_box.SetActive(true);
@ -64,6 +68,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_柜门状态":
{
init(Menu.M_全景监控_柜门状态);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.DoorCondition(/*ison*/);
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
@ -73,6 +78,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_红外监测":
{
init(Menu.M_全景监控_红外监测);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.search_box.SetActive(false);
CabinetUIManager.ChangeMenu(Menu.M_全景监控_红外监测);
@ -80,10 +86,11 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_现场作业":
{
init(Menu.M_全景监控_现场作业);
ExtendedFlycam.Inst.QuanJing();
if (BoolMonitor.Value)
{
WebInteraction.Inst.isWorkPlay = true;
WebInteraction.Inst.OpenTicket();
}
@ -92,6 +99,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_摄像头":
{
init(Menu.M_全景监控_摄像头);
ExtendedFlycam.Inst.QuanJing();
//if (BoolMonitor.Value)
// WebInteraction.Inst.OpenVideo();
@ -101,6 +109,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_机柜容量":
{
init(Menu.M_数字孪生_机柜容量);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
GameManager.Inst.DisplayCapacity(ison);
@ -109,12 +118,14 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_接地网":
{
init(Menu.M_数字孪生_接地网);
ExtendedFlycam.Inst.QuanJing();
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_接地网);
}
break;
case "Toggle_线缆链接":
{
init(Menu.M_数字孪生_线缆连接_展示);
ExtendedFlycam.Inst.QuanJing();
CreateLine createLine = PatternChoose.Inst.transform.Find("画线").GetComponent<CreateLine>();
createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示);
@ -123,14 +134,16 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_场景管理":
{
init(Menu.M_数字孪生_场景管理);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.power_open();
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_场景管理);
}
break;
case "Toggle_智能巡检":
{
init(Menu.M_数字孪生_智能巡检);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.search_box.SetActive(false);
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_智能巡检);
@ -138,6 +151,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_温度":
{
init(Menu.M_全景监控_温度);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
CabinetUIManager.ChangeMenu(Menu.M_全景监控_温度);
@ -145,6 +159,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_湿度":
{
init(Menu.M_全景监控_湿度);
ExtendedFlycam.Inst.QuanJing();
PatternChoose.Inst.transform.Find("Panel搜索框").GetComponent<SearchName>().LoadCabinet(SearchName.SearchType.);
CabinetUIManager.ChangeMenu(Menu.M_全景监控_湿度);
@ -152,6 +167,7 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_线缆连接展示":
{
init(Menu.M_数字孪生_线缆连接_展示);
ExtendedFlycam.Inst.QuanJing();
CreateLine createLine = PatternChoose.Inst.transform.Find("画线").GetComponent<CreateLine>();
createLine.OnMenuChanged(Menu.M_数字孪生_线缆连接_展示);
@ -160,11 +176,18 @@ public class UIToCabinet : MonoBehaviour
break;
case "Toggle_线缆连接配置":
{
init(Menu.M_数字孪生_线缆连接_配置);
ExtendedFlycam.Inst.QuanJing();
GameManager.Inst.power_open();
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆连接_配置);
}
break;
case "Toggle_线缆组配置":
{
init(Menu.M_数字孪生_线缆组配置);
CabinetUIManager.ChangeMenu(Menu.M_数字孪生_线缆组配置);
}
break;
default:
break;
}
@ -179,5 +202,37 @@ public class UIToCabinet : MonoBehaviour
}
public void init(Menu menu)
{
if (WebInteraction.Inst.isWorkPlay && menu != Menu.M_全景监控_现场作业)
WebInteraction.Inst.CloseTicket();
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;
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8fa23e72e92b1b04eb2c03eb632d77d6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Linq;
public class GroundingGrid : CabinetUIBase
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public override void OnMenuChanged(Menu menu)
{
if (menu == Menu.M_Êý×ÖÂÏÉú_½ÓµØÍø)
{
gameObject.SetActive(true);
var s = Array.FindAll(TransparentGlowManage.Inst.points.ToArray(), (item) =>
{
return (item.GetComponent<TransparentGlow>() != null &&
item.name != "R08" && item.name != "R15" && item.name != "R65" &&
item.name != "R57" && item.name != "R54" && item.name != "R45" &&
item.name != "R37" && item.name != "R29" && item.name != "R22");
}).Select(item => item.GetComponent<TransparentGlow>()).ToArray();
TransparentGlowManage.Inst.transparencyALL(s);
}
else
{
gameObject.SetActive(false);
var s = Array.FindAll(TransparentGlowManage.Inst.points.ToArray(), (item) =>
{
return (item.GetComponent<TransparentGlow>() != null);
}).Select(item => item.GetComponent<TransparentGlow>()).ToArray();
TransparentGlowManage.Inst.renewALL(s);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 468c35b9499ffb04c8b1cfb468acc141
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LocatingPlace : MonoBehaviour
{
public List<Transform> transforms;
LineRenderer line;
private void Awake()
{
line = GetComponent<LineRenderer>();
line.positionCount = 0;
}
void Start()
{
if (transforms.Count == 0) return;
List<Vector3> vector3s = new List<Vector3>();
for (int i = 0; i < transforms.Count; i++)
{
vector3s.Add(transforms[i].localPosition);
}
line.positionCount = transforms.Count;
line.SetPositions(vector3s.ToArray());
}
// Update is called once per frame
void Update()
{
}
[ContextMenu("Éú³É")]
public void asd()
{
line = GetComponent<LineRenderer>();
line.positionCount = 0;
if (transforms.Count == 0) return;
List<Vector3> vector3s = new List<Vector3>();
for (int i = 0; i < transforms.Count; i++)
{
vector3s.Add(transforms[i].localPosition);
}
line.positionCount = transforms.Count;
line.SetPositions(vector3s.ToArray());
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f077ceec6265024aac713ff792a8180
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/SampleScene1.unity
path: Assets/Scenes/SampleSceneG.unity
guid: 09a8e21b385b3d14ca7b6a7e26c2e63a
m_configObjects: {}