Esempio n. 1
0
    /// <summary>
    /// 设置批量复制按钮
    /// </summary>
    /// <param name="devList"></param>
    private void SetBatchCopyState(List <DevNode> devList)
    {
        SurroundEditMenu_BatchCopy copyPart = SurroundEditMenu_BatchCopy.Instacne;

        if (copyPart)
        {
            if (devList.Count > 1)
            {
                copyPart.CloseUI();
            }
            else if (devList.Count == 1)
            {
                DevNode dev = devList[0];
                if (dev is RoomDevController || dev is DepDevController || !TypeCodeHelper.IsLocationDev(dev.Info.TypeCode.ToString()))
                {
                    if (ObjectAddListManage.IsEditMode)
                    {
                        copyPart.Open(dev);
                    }
                }
                else
                {
                    copyPart.CloseUI();
                }
            }
        }
    }
 /// <summary>
 /// 显示定位修改工具
 /// </summary>
 /// <param name="dev"></param>
 private void ShowArchorPart(DevNode dev)
 {
     if (TypeCodeHelper.IsLocationDev(dev.Info.TypeCode.ToString()))
     {
         ArchorToolManage.Instance.Show(dev);
     }
 }
    /// <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);
        }
    }
Esempio n. 4
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);
        }
    /// <summary>
    /// 设置窗口显示
    /// </summary>
    /// <param name="dev"></param>
    private void SetWindowState(DevNode dev)
    {
        bool isLoctaionDev = (dev.Info != null && TypeCodeHelper.IsLocationDev(dev.Info.TypeCode.ToString()));

        if ((dev is RoomDevController || dev is DepDevController) && !isLoctaionDev)
        {
            IsCopyDev = true;
            CopyPart.SetActive(true);
            NormalPart.SetActive(false);
        }
        else
        {
            IsCopyDev = false;
            CopyPart.SetActive(false);
            NormalPart.SetActive(true);
        }
    }
    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);
        }
    }
 /// <summary>
 /// 删除子设备(门禁、基站等)
 /// </summary>
 /// <param name="dev"></param>
 /// <returns></returns>
 private bool ClearSubDev(DevNode dev)
 {
     if (dev as DoorAccessDevController)
     {
         DoorAccessDevController controller     = dev as DoorAccessDevController;
         List <Dev_DoorAccess>   doorAccessList = new List <Dev_DoorAccess>();
         doorAccessList.Add(controller.DoorAccessInfo);
         bool value = CommunicationObject.Instance.DeleteDoorAccess(doorAccessList);
         return(true);
     }
     else if (TypeCodeHelper.IsLocationDev(dev.Info.TypeCode.ToString()))
     {
         bool value = CommunicationObject.Instance.DeleteArchor(dev.Info.Id);
         //print("DeleteArchor:"+value);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 8
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);
        }
Esempio 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);
         }
     }
 }