123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.Events;
- using UnityEngine.UI;
- using Blue;
- namespace GHZLangChao
- {
- public class XunJianManager : SingletonMonobehaviour<XunJianManager>, IController
- {
- public bool Test = false;
- [SerializeField] private GameObject SearchPanel; // 搜索面板
- [SerializeField] private Transform SearchPanelContent; // 搜索面板Item父物体
- [SerializeField] private GameObject FaultPanel; // 故障面板
- [SerializeField] private Transform FaultPanelContent;// 故障面板Item父物体
- [SerializeField] private Button Serach_Btn;
- public Button Fault_Btn;
- private FontStyle FontStyleB = FontStyle.Bold;
- private FontStyle FontStyleN = FontStyle.Normal;
- [SerializeField] private TextMeshProUGUI Serach_Text;
- [SerializeField] private TextMeshProUGUI Fault_Text;
- [SerializeField] private Button Titile_Btn;
- [SerializeField] private Button Nav_Btn; // 导航按钮
- [SerializeField] private GameObject Retract_go; // 收起
- [SerializeField] private GameObject Expand_go; // 展开
- public GameObject UI_go;
- public UnityEvent OnReset = new UnityEvent();
- public UnityEvent OnRetract = new UnityEvent();
- public UnityEvent OnExpand = new UnityEvent();
- void Start()
- {
- #if UNITY_EDITOR
- Test = true;
- #endif
- Serach_Btn.onClick.AddListener(SerachChange);
- Fault_Btn.onClick.AddListener(FaultChange);
- Nav_Btn.onClick.AddListener(StartNav);
- Titile_Btn.onClick.AddListener(ClickTitle);
- //UICallManager.Instance.MachineRoomInit();
- XRRGBCamera.Instance.stopCamera();
- Init();
- }
- public void StartXunJain()
- {
- UI_go.SetActive(false);
- }
- public void Next()
- {
- ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
- }
- public void back()
- {
- ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
- // BladeServerManager.Instance.isDaoHang = false;
- }
- public void Navigationing()
- {
- // ScenesManager.Instance.showWindow(ScenesManager.SceneType.Navigationing);
- }
- /// <summary>
- /// 初始化数据
- /// </summary>
- private void Init()
- {
- // 初始化搜索面板
- List<MachineParameters> listEquipmentData = UICallManager.Instance.GetMachineRoomData("").listEquipmentData;
- for (int i = 0; i < listEquipmentData.Count;i++)
- {
- GameObject go = Instantiate(InstantiateSystem.Instance.BlueObject.SearchPanel_Item,SearchPanelContent);
- SearchPanel_Item item = go.GetComponent<SearchPanel_Item>();
- item.Init(listEquipmentData[i]);
- go.name = listEquipmentData[i].deviceName;
- if(string.IsNullOrEmpty(listEquipmentData[i].deviceName)) Destroy(go);
- }
- // 初始化故障面板
- List<AlarmData> ListAlarmData = UICallManager.Instance.GetAlarmData();
- for (int i = 0; i < ListAlarmData.Count;i++)
- {
- GameObject go = Instantiate(InstantiateSystem.Instance.BlueObject.FaultPanel_Item,FaultPanelContent);
- FaultPanel_Item item = go.GetComponent<FaultPanel_Item>();
- item.Init(ListAlarmData[i]);
- go.name = ListAlarmData[i].title;
- }
- }
- #region UI监听
- private Color colorBlue = new Color32(25,107,255,255);
- private Color colorWhite = new Color32(255,255,255,255);
- public void SerachChange()
- {
- Serach_Text.fontStyle = (FontStyles)FontStyleB;
- Fault_Text.fontStyle = (FontStyles)FontStyleN;
- Serach_Text.color = colorBlue;
- Fault_Text.color = Color.white;
- IsSerach = true;
- }
- public void FaultChange()
- {
- Serach_Text.fontStyle = (FontStyles)FontStyleN;
- Fault_Text.fontStyle = (FontStyles)FontStyleB;
- Serach_Text.color = Color.white;
- Fault_Text.color = colorBlue;
- IsSerach = false;
- }
- private static MachineParameters mMachineParameter;
- public static MachineParameters MachineParameters
- {
- get => mMachineParameter;
- set => mMachineParameter = value;
- }
- private static AlarmData mAlarmData;
- public static AlarmData AlarmData
- {
- get => mAlarmData;
- set => mAlarmData = value;
- }
- private bool IsSerach = true; // 在Search面板下点击导航
- private void StartNav()
- {
- if(IsSerach)
- {
- MachineObj obj = UICallManager.Instance.QueryMachineObj(MachineParameters.deviceId);
- if (obj != null)
- {
- UICallManager.Instance.NavigatorServer(obj);
- UI_go.SetActive(false);
- Retract_go.SetActive(false);
- Expand_go.SetActive(true);
- }
- else
- Debug.LogError(" 未查找到设备 " + MachineParameters.deviceId + " " + MachineParameters.deviceName);
- }
- else
- {
- MachineObj obj = UICallManager.Instance.QueryMachineObj(AlarmData.deviceId);
- if (obj != null)
- {
- UICallManager.Instance.NavigatorServer(obj);
- UI_go.SetActive(false);
- Retract_go.SetActive(false);
- Expand_go.SetActive(true);
- }
- else
- Debug.LogError(" 未查找到设备 " + AlarmData.deviceId + " " + AlarmData.deviceName);
- }
- }
- public void showRTC()
- {
- LangChaoRTC.Instance.showRTC(0);
- ScenesManager.Instance.showWindow(ScenesManager.SceneType.RoomMain);
- }
- private bool isRetract = false;
- private void ClickTitle()
- {
- isRetract = !isRetract;
- if(isRetract)
- OnRetract?.Invoke();
- else
- OnExpand?.Invoke();
- }
- #endregion
- public void OpenEidotrCanvas()
- {
- SettingMachineRoomData.Instance.EditorOpen();
- }
- private void Update()
- {
- if (Test) return;
- #if UNITY_EDITOR
- return;
- #endif
- OnReset?.Invoke();
- }
- }
- }
|