Exemplo n.º 1
0
    /// <summary>
    /// 保存其他信息
    /// </summary>
    /// <param name="devInfo"></param>
    /// <param name="service"></param>
    private void SaveDevSubInfo(List <GameObject> copyDevList, CommunicationObject service)
    {
        List <Dev_CameraInfo> cameraInfoList = new List <Dev_CameraInfo>();

        foreach (var devObjT in copyDevList)
        {
            DevNode devInfoT = devObjT.GetComponent <DevNode>();
            if (devInfoT == null)
            {
                continue;
            }
            DevInfo devInfo = devInfoT.Info;
            if (TypeCodeHelper.IsCamera(devInfo.TypeCode.ToString()))
            {
                Dev_CameraInfo cameraInfoT = new Dev_CameraInfo();
                cameraInfoT.Ip          = "127.0.0.1";
                cameraInfoT.DevInfoId   = devInfo.Id;
                cameraInfoT.UserName    = "******";
                cameraInfoT.PassWord    = "******";
                cameraInfoT.Port        = 80;
                cameraInfoT.CameraIndex = 0;
                cameraInfoT.Local_DevID = devInfo.Abutment_DevID;
                cameraInfoT.ParentId    = devInfo.ParentId;
                //CameraDevController camera = devInfoT as CameraDevController;
                //Dev_CameraInfo value = service.AddCameraInfo(cameraInfo);
                cameraInfoList.Add(cameraInfoT);
                //Debug.Log("Add cameraInfo value:" + value == null);
            }
        }
        if (cameraInfoList.Count != 0)
        {
            service.AddCameraInfo(cameraInfoList);
        }
    }
    /// <summary>
    /// 保存其他信息
    /// </summary>
    /// <param name="devInfo"></param>
    /// <param name="service"></param>
    private void SaveDevSubInfo(DevNode devNode, CommunicationObject service)
    {
        DevInfo devInfo = devNode.Info;

        if (devInfo == null)
        {
            return;
        }
        if (TypeCodeHelper.IsLocationDev(devInfo.TypeCode.ToString()))
        {
            Archor archor = new Archor();
            archor.Code       = "";
            archor.DevInfoId  = devInfo.Id;
            archor.ParentId   = (int)devInfo.ParentId;
            archor.X          = 0;
            archor.Y          = 0;
            archor.Z          = 0;
            archor.Name       = devInfo.Name;
            archor.Type       = ArchorTypes.副基站;
            archor.IsAutoIp   = true;
            archor.Ip         = "";
            archor.ServerIp   = "";
            archor.ServerPort = 0;
            archor.Power      = 0;
            archor.AliveTime  = 0;
            archor.Enable     = IsStart.是;
            //archor.DevInfo = devInfo;
            bool value = service.AddArchor(archor);
            Debug.Log("Add archor value:" + value);
        }
        else if (TypeCodeHelper.IsCamera(devInfo.TypeCode.ToString()))
        {
            Dev_CameraInfo cameraInfo = new Dev_CameraInfo();
            cameraInfo.Ip          = "";
            cameraInfo.DevInfoId   = devInfo.Id;
            cameraInfo.UserName    = "";
            cameraInfo.PassWord    = "";
            cameraInfo.Port        = 0;
            cameraInfo.CameraIndex = 0;
            cameraInfo.Local_DevID = devInfo.Abutment_DevID;
            cameraInfo.ParentId    = devInfo.ParentId;
            CameraDevController camera = devNode as CameraDevController;
            //camera.SetCameraInfo(cameraInfo);
            Dev_CameraInfo value = service.AddCameraInfo(cameraInfo);
            if (value != null)
            {
                camera.SetCameraInfo(value);
            }
            Debug.Log("Add cameraInfo value:" + value == null);
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// 初始化房间内设备
 /// </summary>
 /// <param name="room"></param>
 /// <param name="info"></param>
 /// <returns></returns>
 private DevNode InitRoomDevParent(GameObject copyModel, DepNode dep, GameObject devContainer, DevInfo info)
 {
     copyModel.transform.parent = devContainer.transform;
     if (TypeCodeHelper.IsCamera(info.TypeCode.ToString()))
     {
         CameraDevController roomDev = copyModel.AddMissingComponent <CameraDevController>();
         return(InitDevInfo(roomDev, info, dep));
     }
     else
     {
         RoomDevController roomDev = copyModel.AddMissingComponent <RoomDevController>();
         return(InitDevInfo(roomDev, info, dep));
     }
 }
Exemplo n.º 4
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.º 5
0
        /// <summary>
        /// 保存通用设备
        /// </summary>
        private void SaveNormalDev(List <Location.TModel.Location.AreaAndDev.DevInfo> devInfoList, LocationService service)
        {
            DevInfoBackupList backUpList = new DevInfoBackupList();

            backUpList.DevList = new List <DevInfoBackup>();
            foreach (var item in devInfoList)
            {
                string typeCodeT = item.TypeCode.ToString();
                if (TypeCodeHelper.IsLocationDev(typeCodeT) || TypeCodeHelper.IsCamera(typeCodeT) || TypeCodeHelper.IsDoorAccess(item.ModelName) || TypeCodeHelper.IsFireFightDevType(typeCodeT))
                {
                    continue;
                }
                DevInfoBackup dev = new DevInfoBackup();
                dev.DevId          = item.DevID;
                dev.KKSCode        = item.KKSCode;
                dev.Abutment_DevID = item.Abutment_DevID;
                dev.ModelName      = item.ModelName;
                dev.Name           = item.Name;
                dev.ParentName     = GetAreaPath((int)item.ParentId, service);
                dev.TypeCode       = item.TypeCode.ToString();

                DevPos pos = item.Pos;

                dev.RotationX = pos.RotationX.ToString();
                dev.RotationY = pos.RotationY.ToString();
                dev.RotationZ = pos.RotationZ.ToString();

                dev.XPos = pos.PosX.ToString();
                dev.YPos = pos.PosY.ToString();
                dev.ZPos = pos.PosZ.ToString();

                dev.ScaleX = pos.ScaleX.ToString();
                dev.ScaleY = pos.ScaleY.ToString();
                dev.ScaleZ = pos.ScaleZ.ToString();

                backUpList.DevList.Add(dev);
            }
            List <DevInfoBackup> deleteDevs = AddDeleteDev(devInfoList);

            if (devInfoList != null && devInfoList.Count != 0)
            {
                backUpList.DevList.AddRange(deleteDevs);
            }
            //string dirctory = GetSaveDevDirectory();
            //string initFile = dirctory+"DevInfoBackup.xml";
            //XmlSerializeHelper.Save(backUpList, initFile, Encoding.UTF8);
            SaveNormalDevXml("DevInfoBackup.xml", backUpList);
        }
    private DeviceAlarmFollowUI CreateAlarmFollowUI(DevNode alarmDev, DepNode dep, DeviceAlarm alarmInfo)
    {
        try
        {
            string depNodeId = dep is RoomController?dep.ParentNode.NodeID.ToString() : dep.NodeID.ToString();

            string     groupName = string.Format("{0}{1}", AlarmDevUIName, depNodeId);
            string     typeCode  = alarmDev.Info.TypeCode.ToString();
            GameObject followObj = null;
            if (TypeCodeHelper.IsLocationDev(typeCode))
            {
                followObj = CreateFollowTarget(ArchorAlarmUI, alarmDev.gameObject, groupName);
            }
            else if (TypeCodeHelper.IsCamera(typeCode))
            {
                followObj = CreateFollowTarget(CameraAlarmUI, alarmDev.gameObject, groupName);
            }
            else if (TypeCodeHelper.IsDoorAccess(typeCode))
            {
                followObj = CreateFollowTarget(DoorAccessAlarmUI, alarmDev.gameObject, groupName);
            }
            else
            {
                followObj = CreateFollowTarget(BorderDevUIPrefab, alarmDev.gameObject, groupName);
            }
            if (followObj == null)
            {
                return(null);
            }
            DeviceAlarmFollowUI followUI = followObj.GetComponent <DeviceAlarmFollowUI>();
            if (followUI != null)
            {
                followUI.InitInfo(alarmInfo);
            }
            return(followUI);
        }
        catch (Exception ex)
        {
            Log.Error("FollowTargetManage.CreateAlarmDevFollowUI", ex.ToString());
            return(null);
        }
    }
Exemplo n.º 7
0
        /// <summary>
        /// 保存通用设备
        /// </summary>
        private void SaveNormalDev(List <Location.TModel.Location.AreaAndDev.DevInfo> devInfoList, LocationService service)
        {
            DevInfoBackupList backUpList = new DevInfoBackupList();

            backUpList.DevList = new List <DevInfoBackup>();
            foreach (var item in devInfoList)
            {
                string typeCodeT = item.TypeCode.ToString();
                if (TypeCodeHelper.IsLocationDev(typeCodeT) || TypeCodeHelper.IsCamera(typeCodeT) || TypeCodeHelper.IsDoorAccess(item.ModelName))
                {
                    continue;
                }
                DevInfoBackup dev = new DevInfoBackup();
                dev.DevId      = item.DevID;
                dev.KKSCode    = item.KKSCode;
                dev.ModelName  = item.ModelName;
                dev.Name       = item.Name;
                dev.ParentName = GetAreaPath((int)item.ParentId, service);
                dev.TypeCode   = item.TypeCode.ToString();

                DevPos pos = item.Pos;

                dev.RotationX = pos.RotationX.ToString();
                dev.RotationY = pos.RotationY.ToString();
                dev.RotationZ = pos.RotationZ.ToString();

                dev.XPos = pos.PosX.ToString();
                dev.YPos = pos.PosY.ToString();
                dev.ZPos = pos.PosZ.ToString();

                dev.ScaleX = pos.ScaleX.ToString();
                dev.ScaleY = pos.ScaleY.ToString();
                dev.ScaleZ = pos.ScaleZ.ToString();

                backUpList.DevList.Add(dev);
            }
            string initFile = AppDomain.CurrentDomain.BaseDirectory + "Data\\设备信息\\DevInfoBackup.xml";

            XmlSerializeHelper.Save(backUpList, initFile, Encoding.UTF8);
        }
Exemplo n.º 8
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);
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// 创建设备漂浮UI
 /// </summary>
 private void CreateFollowUI()
 {
     if (Info != null && ParentDepNode != null)
     {
         string typeCode = Info.TypeCode.ToString();
         if (TypeCodeHelper.IsDoorAccess(typeCode))
         {
             return;
         }
         if (TypeCodeHelper.IsCamera(typeCode))
         {
             FollowUI = FollowTargetManage.Instance.CreateCameraUI(gameObject, ParentDepNode, this);
         }
         else if (TypeCodeHelper.IsStaticDev(typeCode))
         {
             FollowUI = FollowTargetManage.Instance.CreateDevFollowUI(gameObject, ParentDepNode, this);
         }
         else if (TypeCodeHelper.IsLocationDev(typeCode))
         {
             FollowUI = FollowTargetManage.Instance.CreateArchorFollowUI(gameObject, ParentDepNode, this);
         }
     }
 }