/// <summary>
    /// 设置区域下,边界告警设备的显示和隐藏
    /// </summary>
    /// <param name="dep"></param>
    /// <param name="isEnable"></param>
    private void SetDepBorderDevEnable(DepNode dep, bool isEnable)
    {
        if (dep == null)
        {
            return;
        }
        List <DevNode> dev = RoomFactory.Instance.GetDepDevs(dep);

        if (dev == null || dev.Count == 0)
        {
            return;
        }
        List <DevNode> borderDevList = dev.FindAll(item => TypeCodeHelper.IsBorderAlarmDev(item.Info.TypeCode.ToString()));

        if (borderDevList == null || borderDevList.Count == 0)
        {
            return;
        }
        foreach (var item in borderDevList)
        {
            if (item.isAlarm)
            {
                continue;
            }
            BorderDevController borderDev = item as BorderDevController;
            borderDev.SetRendererEnable(isEnable);
        }
    }
 /// <summary>
 /// 显示设备编辑部分
 /// </summary>
 /// <param name="dev"></param>
 private void ShowEditPart(DevNode dev)
 {
     if (TypeCodeHelper.IsBorderAlarmDev(dev.Info.TypeCode.ToString()))
     {
         EditPart.Close();
         MonitorRangePart.SetDeviceInfo(dev);
     }
     else
     {
         MonitorRangePart.Close();
         EditPart.SetDeviceInfo(dev);
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// 设置设备信息
    /// </summary>
    /// <param name="devList"></param>
    public void SetDevInfo(List <DevNode> devList)
    {
        Window.SetActive(true);
        ClearDevList();
        int normalDev = 0;
        int cameraDev = 0;
        int doorDev   = 0;
        int borderDev = 0;
        int fireDev   = 0;

        foreach (DevNode dev in devList)
        {
            if (dev != null && dev.Info != null)
            {
                string typeCode = dev.Info.TypeCode.ToString();
                if (TypeCodeHelper.IsCamera(typeCode))
                {
                    cameraDev++;
                    cameraDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsDoorAccess(typeCode))
                {
                    doorDev++;
                    doorDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsBorderAlarmDev(typeCode))
                {
                    borderDev++;
                    borderDevTemp.Add(dev.gameObject);
                }
                else if (TypeCodeHelper.IsAlarmDev(typeCode))
                {
                    fireDev++;
                    fireDevTemp.Add(dev.gameObject);
                }
                else
                {
                    normalDev++;
                    normalDevTemp.Add(dev.gameObject);
                }
            }
        }
        SetSelections(normalDev, cameraDev, doorDev, borderDev, fireDev);
        NormalDevText.text  = normalDev.ToString();
        CameraDevText.text  = cameraDev.ToString();
        DoorAccessText.text = doorDev.ToString();
        BorderDevText.text  = borderDev.ToString();
        FireAlarmText.text  = fireDev.ToString();
    }
Exemplo n.º 4
0
        /// <summary>
        /// 获取告警信息
        /// </summary>
        /// <param name="dev"></param>
        /// <returns></returns>
        private string GetAlarmMsg(DevInfo dev)
        {
            string msg      = "设备告警";
            string typecode = dev.TypeCode.ToString();

            if (TypeCodeHelper.IsBorderAlarmDev(typecode))
            {
                msg = string.Format("边界告警 : {0} 检测到非法越界.", dev.Name);
            }
            else if (TypeCodeHelper.IsAlarmDev(typecode))
            {
                msg = string.Format("消防告警 : {0} 消防装置被触发.", dev.Name);
            }
            return(msg);
        }
Exemplo n.º 5
0
    /// <summary>
    /// 添加设备控制脚本
    /// </summary>
    /// <param name="devInfo"></param>
    /// <param name="modelTemp"></param>
    /// <returns></returns>
    private DevNode DevControllerAdd(DevInfo devInfo, GameObject modelTemp, DepNode parentNode)
    {
        string typeCode = devInfo.TypeCode.ToString();

        if (TypeCodeHelper.IsBorderAlarmDev(typeCode))
        {
            BorderDevController borderDev = modelTemp.AddMissingComponent <BorderDevController>();
            InitDevInfo(borderDev, devInfo, parentNode);
            return(borderDev);
        }
        else if (TypeCodeHelper.IsCamera(typeCode))
        {
            CameraDevController cameraDev = modelTemp.AddMissingComponent <CameraDevController>();
            InitDevInfo(cameraDev, devInfo, parentNode);
            return(cameraDev);
        }
        else
        {
            DepDevController controller = modelTemp.AddComponent <DepDevController>();
            InitDevInfo(controller, devInfo, parentNode);
            return(controller);
        }
    }