翻页声音逻辑
This commit is contained in:
parent
aabaecc1d2
commit
5b5c2be9e4
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue