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()