using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Blue; namespace GHZLangChao { public class XunJianManager : SingletonMonobehaviour, 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); } /// /// 初始化数据 /// private void Init() { // 初始化搜索面板 List 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(); item.Init(listEquipmentData[i]); go.name = listEquipmentData[i].deviceName; if(string.IsNullOrEmpty(listEquipmentData[i].deviceName)) Destroy(go); } // 初始化故障面板 List 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(); 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(); } } }