Fixed public GoToScreen call to only raise events internally (not multiple)

pull/413/head
Simon (darkside) Jackson 2020-09-28 18:12:35 +01:00
parent 56391827d6
commit 263368ba8d
3 changed files with 10 additions and 7 deletions

View File

@ -238,7 +238,7 @@ namespace UnityEngine.UI.Extensions
if (JumpOnEnable || !RestartOnEnable)
SetScrollContainerPosition();
if (RestartOnEnable)
GoToScreen(StartingScreen);
GoToScreen(StartingScreen, true);
}
/// <summary>

View File

@ -357,7 +357,7 @@ namespace UnityEngine.UI.Extensions
/// *Note, this is based on a 0 starting index - 0 to x
/// </summary>
/// <param name="screenIndex">0 starting index of page to jump to</param>
public void GoToScreen(int screenIndex)
public void GoToScreen(int screenIndex, bool local = false)
{
if (screenIndex <= _screens - 1 && screenIndex >= 0)
{
@ -366,7 +366,7 @@ namespace UnityEngine.UI.Extensions
_lerp = true;
CurrentPage = screenIndex;
GetPositionforPage(_currentPage, ref _lerp_target);
ScreenChange();
if(local) ScreenChange();
}
}
@ -623,7 +623,7 @@ namespace UnityEngine.UI.Extensions
/// </summary>
public void ChangePage(int page)
{
GoToScreen(page);
GoToScreen(page, true);
}
public void OnPointerClick(PointerEventData eventData)

View File

@ -228,10 +228,13 @@ namespace UnityEngine.UI.Extensions
{
InitialiseChildObjectsFromScene();
DistributePages();
if (MaskArea) UpdateVisible();
if (MaskArea)
UpdateVisible();
if (JumpOnEnable || !RestartOnEnable) SetScrollContainerPosition();
if(RestartOnEnable) GoToScreen(StartingScreen);
if (JumpOnEnable || !RestartOnEnable)
SetScrollContainerPosition();
if (RestartOnEnable)
GoToScreen(StartingScreen, true);
}
/// <summary>