Ejemplo n.º 1
0
    /// <summary>
    /// 聚焦设备
    /// </summary>
    public void FocusOn()
    {
        bool sameArea = IsSameArea();

        if (CurrentFocusDev != null)
        {
            CurrentFocusDev.FocusOff(false);
        }
        IsFocus = true;
        CameraSceneManager manager = CameraSceneManager.Instance;

        if (manager)
        {
            if (sameArea)
            {
                AlignTarget target = GetTargetInfo(gameObject);
                manager.FocusTarget(target, () =>
                {
                    ChangeBackButtonState(true);
                });
                HighlightOn();
            }
            else
            {
                RoomFactory.Instance.FocusNode(ParentDepNode, () =>
                {
                    AlignTarget target = GetTargetInfo(gameObject);
                    manager.FocusTarget(target, () =>
                    {
                        ChangeBackButtonState(true);
                    });
                    HighlightOn();
                });
            }
            CurrentFocusDev = this;
        }
    }
 /// <summary>
 /// 删除设备信息
 /// </summary>
 /// <param name="dev"></param>
 private void RemoveDevCache(DevNode dev)
 {
     if (RoomFactory.Instance)
     {
         RoomFactory.Instance.RemoveDevInfo(dev);
     }
     if (dev is DoorAccessDevController)
     {
         DoorAccessDevController doorAccess = dev as DoorAccessDevController;
         if (doorAccess.DoorItem)
         {
             doorAccess.DoorItem.RemoveDoorAccess(doorAccess);
         }
     }
     if (CameraSceneManager.Instance)
     {
         if (CameraSceneManager.Instance.alignCamera.GetTarget() == dev.gameObject.transform)
         {
             //FactoryDepManager.currentDep.FocusOn();
             dev.FocusOff();
         }
     }
 }