using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class EquipmentController : MonoBehaviour { public EquipmentType equipmentType; private DateTime t1, t2; // Start is called before the first frame update void Start() { if (equipmentType == EquipmentType.SmokeVent) { if (!GetComponent()) { gameObject.AddComponent(); } GetComponent().BindType = DeviceType.排烟风机; } else if(equipmentType == EquipmentType.ForcedDraftFan) { if (!GetComponent()) { gameObject.AddComponent(); } GetComponent().BindType = DeviceType.送风机; } else if (equipmentType == EquipmentType.OutdoorHydrant) { if (!GetComponent()) { gameObject.AddComponent(); } GetComponent().BindType = DeviceType.消火栓; } else if (equipmentType == EquipmentType.PumpRoomAndWaterTank) { if (!GetComponent()) { gameObject.AddComponent(); } GetComponent().BindType = DeviceType.水箱; } } private void OnMouseDown() { if (!EventSystem.current.IsPointerOverGameObject()) { t2 = DateTime.Now; if (t2 - t1 < new TimeSpan(0, 0, 0, 0, 500)) { ShowAttribute(); } t1 = t2; } } private void ShowAttribute() { switch (equipmentType) { //登高作业面 case EquipmentType.FireClimbingSite: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.FireClimbingSite][name]); break; //危险源 case EquipmentType.HazardSource: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.HazardSource][name]); break; //禁停区 case EquipmentType.NoParking: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.NoParking][name]); break; //重点提示 case EquipmentType.KeyArea: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.KeyArea][name]); break; //图片标注 case EquipmentType.ImageMarked: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.ImageMarked][name]); break; //逃生窗 case EquipmentType.EscapeWin: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.EscapeWin][name]); break; //破拆点 case EquipmentType.BreakPoint: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.BreakPoint][name]); break; //送风机 case EquipmentType.ForcedDraftFan: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.ForcedDraftFan][name]); break; //排烟风机 case EquipmentType.SmokeExtractionFan: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.SmokeExtractionFan][name]); break; //室外消火栓 case EquipmentType.OutdoorHydrant: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.OutdoorHydrant][name]); break; //水泵接合器 case EquipmentType.SiameseConnection: UIManager.Instance.Show(EquipmentManager.SpawObjectsData[EquipmentType.SiameseConnection][name]); break; //消防泵 case EquipmentType.Pump: UIManager.Instance.Show(new FirePump() { Id = name }); break; //安全出口 case EquipmentType.FireEscape: UIManager.Instance.Show(new FireEscape() { Id = name }); break; //疏散楼梯 case EquipmentType.EscapeStair: UIManager.Instance.Show(new EscapeStair() { Id = name }); break; case EquipmentType.FireElevator: UIManager.Instance.Show(new FireElevator() { Id = name }); break; } } }