From 5b5c2be9e4d02119398a0164f2c58d70c46b8330 Mon Sep 17 00:00:00 2001 From: yangjing Date: Tue, 15 Feb 2022 15:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E5=A3=B0=E9=9F=B3=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/CustomControl/LevelList/LevelPage.cs | 4 ++-- Assets/Scripts/UI/CustomControl/PageView.cs | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/UI/CustomControl/LevelList/LevelPage.cs b/Assets/Scripts/UI/CustomControl/LevelList/LevelPage.cs index 58bbf924..e877129e 100644 --- a/Assets/Scripts/UI/CustomControl/LevelList/LevelPage.cs +++ b/Assets/Scripts/UI/CustomControl/LevelList/LevelPage.cs @@ -81,11 +81,11 @@ public class LevelPage : PageView private void PlayScrollPage() { - AudioManager.Instance.PlaySound(AudioType.TurnPage); + AudioManager.Instance.PlaySound(AudioType.TurnPage, 0.7f); } private void PlayReachEdge() { - AudioManager.Instance.PlaySound(AudioType.ReachEdge); + AudioManager.Instance.PlaySound(AudioType.ReachEdge, 0.7f); } } \ No newline at end of file diff --git a/Assets/Scripts/UI/CustomControl/PageView.cs b/Assets/Scripts/UI/CustomControl/PageView.cs index 6191015b..f7b7c41f 100644 --- a/Assets/Scripts/UI/CustomControl/PageView.cs +++ b/Assets/Scripts/UI/CustomControl/PageView.cs @@ -65,6 +65,11 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl if (currentPageIndex != index) { currentPageIndex = index; + + if (pWithScroll) + { + OnScrollPage?.Invoke(); + } } if (pWithScroll) @@ -73,8 +78,6 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl isDrag = false; startTime = 0; stopMove = false; - - OnScrollPage?.Invoke(); } else { @@ -85,7 +88,6 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl } else { - OnReachEdge?.Invoke(); //Debug.LogError("页码不存在"); } } @@ -110,6 +112,7 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl { float posX = rect.horizontalNormalizedPosition; posX += ((posX - startDragHorizontal) * sensitivity); + float tTempPosX = posX; posX = posX < 1 ? posX : 1; posX = posX > 0 ? posX : 0; int index = 0; @@ -124,6 +127,11 @@ public abstract class PageView : MonoBehaviour, IBeginDragHandler, IEndDragHandl } } PageTo(index); + + if (tTempPosX > 1 || tTempPosX < 0) + { + OnReachEdge?.Invoke(); + } } private void NotifyPageChange()