/// <summary>
    /// 进入截图模式
    /// </summary>
    public void SwitchOn(bool isFullScreen)
    {
        if (isFullScreen)
        {
            _defaultCaptureType = CaptureType.FullScreen;
            _bgRawImage.gameObject.SetActive(false);
            _bgRawImage.material.SetVector("_Rect", new Vector4(0, 0, 1, 1));

            _leftDownConnerPoint       = Vector2.zero;
            _leftUpConnerPoint         = new Vector2(0, _screenHeight);
            _rightUpConnerPoint        = new Vector2(_screenWidth, _screenHeight);
            _rightDownConnerPoint      = new Vector2(_screenWidth, 0);
            _drawRegionRect            = true;
            _haveCirmformRectStarPoint = true;
            _haveRegion = true;
            _lastPoint  = Vector2.zero;
            //涂鸦选项UI初始化
            FinishedRegionEvent.Invoke();
        }
        else
        {
            _defaultCaptureType = CaptureType.FreeRegion;
            _bgRawImage.gameObject.SetActive(true);
            _bgRawImage.material.SetVector("_Rect", new Vector4(0, 0, 0, 0));
        }
        _paintCanvasImg.gameObject.SetActive(true);
        _enterCaptureModeEvent.Invoke();
        _enabled = true;
    }
    void Update()
    {
        if (_enabled)
        {
            switch (_defaultCaptureType)
            {
            case CaptureType.FullScreen:
                break;

            case CaptureType.FreeRegion:
                //已经选了区域,可以开始涂鸦了
                if (_haveRegion)
                {
                    //如果按下右键,表示重新选择区域,清除掉之前的记录
                    if (Input.GetMouseButtonUp(1))
                    {
                        _defaultCaptureType        = CaptureType.FreeRegion;
                        _haveRegion                = false;
                        _haveCirmformRectStarPoint = false;
                        _startPoint                = Vector2.zero;
                        _endPoint             = Vector2.zero;
                        _drawRegionRect       = false;
                        _leftUpConnerPoint    = Vector2.zero;
                        _leftDownConnerPoint  = Vector2.zero;
                        _rightUpConnerPoint   = Vector2.zero;
                        _rightDownConnerPoint = Vector2.zero;
                        _blitRenderTexture.Release();
                        _bgRawImage.material.SetVector("_Rect", new Vector4(0, 0, 0, 0));
                        _eraserFlag = false;
                        //Graphics.Blit(_blitRenderTexture, _blitRenderTexture, _clearBrushMat); //清除一下
                        CannelRegionEvent.Invoke();
                        return;
                    }
                    //涂鸦的侦听逻辑
                }
                //未选择区域,要先选区域
                else
                {
                    //switch (_defaultCaptureType)
                    //{
                    //    case CaptureType.FullScreen:
                    //        break;
                    //    case CaptureType.FreeRegion:
                    //        //如果没有点下选择起点
                    if (!_haveCirmformRectStarPoint)
                    {
                        if (Input.GetMouseButtonDown(0))
                        {
                            //超出屏幕外
                            if (Input.mousePosition.x < 0 || Input.mousePosition.x > Screen.width ||
                                Input.mousePosition.y < 0 || Input.mousePosition.y > Screen.height)
                            {
                                return;
                            }
                            _startPoint = Input.mousePosition;
                            _haveCirmformRectStarPoint = true;
                        }
                    }
                    //如果选下了起点,刷新鼠标位置
                    else
                    {
                        _drawRegionRect = true;
                        if (Input.GetMouseButton(0))
                        {
                            _endPoint = Input.mousePosition;
                            //限制坐标在屏幕内
                            _endPoint.x = Mathf.Clamp(_endPoint.x, 0f, Screen.width);
                            _endPoint.y = Mathf.Clamp(_endPoint.y, 0f, Screen.height);
                            //设置灰化区域
                            Vector4 rect = new Vector4(Mathf.Min(_startPoint.x, _endPoint.x) / Screen.width,
                                                       Mathf.Min(_startPoint.y, _endPoint.y) / Screen.height,
                                                       Mathf.Max(_startPoint.x, _endPoint.x) / Screen.width,
                                                       Mathf.Max(_startPoint.y, _endPoint.y) / Screen.height);
                            _bgRawImage.material.SetVector("_Rect", rect);
                        }
                        //鼠标抬起,截图框选区域确定
                        if (Input.GetMouseButtonUp(0))
                        {
                            _endPoint = Input.mousePosition;
                            //限制坐标在屏幕内
                            _endPoint.x = Mathf.Clamp(_endPoint.x, 0f, Screen.width);
                            _endPoint.y = Mathf.Clamp(_endPoint.y, 0f, Screen.height);

                            _haveRegion           = true;
                            _leftUpConnerPoint    = GetCaptureViewLeftUpConnerPoint();
                            _rightUpConnerPoint   = GetCaptureViewRightUpConnerPoint();
                            _rightDownConnerPoint = GetCaptureViewRightDownConnerPoint();
                            _leftDownConnerPoint  = GetCaptureViewLeftDownConnerPoint();
                            FinishedRegionEvent.Invoke();
                        }
                    }

                    //        break;
                    //    default:
                    //        throw new ArgumentOutOfRangeException();
                    //}
                }
                ////侦听截图事件
                //if (Input.GetKeyUp(KeyCode.Space))
                //{
                //    _CaptureFlag = true;
                //}
                //全屏截图
                if (Input.GetKeyUp(KeyCode.F) && _defaultCaptureType == CaptureType.FreeRegion && !_haveRegion)
                {
                    _defaultCaptureType        = CaptureType.FullScreen;
                    _leftDownConnerPoint       = Vector2.zero;
                    _leftUpConnerPoint         = new Vector2(0, _screenHeight);
                    _rightUpConnerPoint        = new Vector2(_screenWidth, _screenHeight);
                    _rightDownConnerPoint      = new Vector2(_screenWidth, 0);
                    _drawRegionRect            = true;
                    _haveCirmformRectStarPoint = true;
                    _haveRegion = true;

                    _bgRawImage.gameObject.SetActive(false);
                    _bgRawImage.material.SetVector("_Rect", new Vector4(0, 0, 1, 1));
                    //涂鸦选项UI初始化
                    FinishedRegionEvent.Invoke();
                }
                break;

            default:
                break;
            }


            _eraserModeUpdateEvent.Invoke(_eraserFlag);


            //退出截图
            if (Input.GetKeyUp(KeyCode.Escape))
            {
                ResetData();
                _enabled = false;

                _escapeCaptureEvent.Invoke();
                return;
            }
        }
    }