上海虹口龙之梦项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
5.0 KiB

10 months ago
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<DeviceObj>())
{
gameObject.AddComponent<DeviceObj>();
}
GetComponent<DeviceObj>().BindType = DeviceType.;
}
else if(equipmentType == EquipmentType.ForcedDraftFan)
{
if (!GetComponent<DeviceObj>())
{
gameObject.AddComponent<DeviceObj>();
}
GetComponent<DeviceObj>().BindType = DeviceType.;
}
else if (equipmentType == EquipmentType.OutdoorHydrant)
{
if (!GetComponent<DeviceObj>())
{
gameObject.AddComponent<DeviceObj>();
}
GetComponent<DeviceObj>().BindType = DeviceType.;
}
else if (equipmentType == EquipmentType.PumpRoomAndWaterTank)
{
if (!GetComponent<DeviceObj>())
{
gameObject.AddComponent<DeviceObj>();
}
GetComponent<DeviceObj>().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<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.FireClimbingSite][name]);
break;
//危险源
case EquipmentType.HazardSource:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.HazardSource][name]);
break;
//禁停区
case EquipmentType.NoParking:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.NoParking][name]);
break;
//重点提示
case EquipmentType.KeyArea:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.KeyArea][name]);
break;
//图片标注
case EquipmentType.ImageMarked:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.ImageMarked][name]);
break;
//逃生窗
case EquipmentType.EscapeWin:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.EscapeWin][name]);
break;
//破拆点
case EquipmentType.BreakPoint:
UIManager.Instance.Show<EquipmentAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.BreakPoint][name]);
break;
//送风机
case EquipmentType.ForcedDraftFan:
UIManager.Instance.Show<SmokeFanPanel>(EquipmentManager.SpawObjectsData[EquipmentType.ForcedDraftFan][name]);
break;
//排烟风机
case EquipmentType.SmokeExtractionFan:
UIManager.Instance.Show<SmokeFanPanel>(EquipmentManager.SpawObjectsData[EquipmentType.SmokeExtractionFan][name]);
break;
//室外消火栓
case EquipmentType.OutdoorHydrant:
UIManager.Instance.Show<OutdoorHydranrAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.OutdoorHydrant][name]);
break;
//水泵接合器
case EquipmentType.SiameseConnection:
UIManager.Instance.Show<SiameseConnectionAttributePanel>(EquipmentManager.SpawObjectsData[EquipmentType.SiameseConnection][name]);
break;
//消防泵
case EquipmentType.Pump:
UIManager.Instance.Show<FirePumpAttributePanel>(new FirePump() { Id = name });
break;
//安全出口
case EquipmentType.FireEscape:
UIManager.Instance.Show<FireEscapeAttributePanel>(new FireEscape() { Id = name });
break;
//疏散楼梯
case EquipmentType.EscapeStair:
UIManager.Instance.Show<EscapeStairAttributePanel>(new EscapeStair() { Id = name });
break;
case EquipmentType.FireElevator:
UIManager.Instance.Show<FireElevatorAttributePanel>(new FireElevator() { Id = name });
break;
}
}
}