| | |
| | | |
| | | public void AddListener(Action _callBack) |
| | | { |
| | | m_ClickOtherEvent = null; |
| | | m_ClickOtherEvent += _callBack; |
| | | } |
| | | |
| | |
| | | m_ClickOtherEvent = null; |
| | | } |
| | | |
| | | |
| | | private void LateUpdate() |
| | | { |
| | | if (Input.GetMouseButtonDown(0)) { |
| | | if (Input.GetMouseButtonDown(0)) |
| | | { |
| | | var sp = Input.mousePosition; |
| | | switch (m_RespondType) { |
| | | switch (m_RespondType) |
| | | { |
| | | case RespondType.In: |
| | | if (RectTransformUtility.RectangleContainsScreenPoint(this.transform as RectTransform, sp, CameraManager.uiCamera)) { |
| | | if (RectTransformUtility.RectangleContainsScreenPoint(this.transform as RectTransform, sp, CameraManager.uiCamera)) |
| | | { |
| | | m_ClickOtherEvent?.Invoke(); |
| | | this.SetActive(!m_DeActiveSelf); |
| | | } |
| | | break; |
| | | case RespondType.Out: |
| | | if (!RectTransformUtility.RectangleContainsScreenPoint(this.transform as RectTransform, sp, CameraManager.uiCamera)) { |
| | | if (!RectTransformUtility.RectangleContainsScreenPoint(this.transform as RectTransform, sp, CameraManager.uiCamera)) |
| | | { |
| | | m_ClickOtherEvent?.Invoke(); |
| | | this.SetActive(!m_DeActiveSelf); |
| | | } |
| | | break; |
| | | case RespondType.InOut: |
| | | m_ClickOtherEvent?.Invoke(); |
| | | this.SetActive(!m_DeActiveSelf); |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | In, |
| | | Out, |
| | | InOut |
| | | |
| | | } |
| | | } |