From 2b0c2d805a73ad329cb93802cbdfaa4c80e25513 Mon Sep 17 00:00:00 2001 From: "Simon (darkside) Jackson" Date: Mon, 23 May 2016 21:10:17 +0100 Subject: [PATCH] Added "Go to Screen" option for HSS and VSS by request --HG-- branch : develop_5.3 --- Scripts/Layout/HorizontalScrollSnap.cs | 12 ++++++++++++ Scripts/Layout/VerticalScrollSnap.cs | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index daf84d8..8c10a26 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -139,6 +139,18 @@ namespace UnityEngine.UI.Extensions } } + //Function for switching to a specific screen + public void GoToScreen(int screenIndex) + { + if (screenIndex <= _screens && screenIndex >= 0) + { + _lerp = true; + _lerp_target = _positions[screenIndex]; + + ChangeBulletsInfo(screenIndex); + } + } + //Because the CurrentScreen function is not so reliable, these are the functions used for swipes private void NextScreenCommand() { diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index 27b9c9d..81dd390 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -137,6 +137,18 @@ namespace UnityEngine.UI.Extensions } } + //Function for switching to a specific screen + public void GoToScreen(int screenIndex) + { + if (screenIndex <= _screens && screenIndex >= 0) + { + _lerp = true; + _lerp_target = _positions[screenIndex]; + + ChangeBulletsInfo(screenIndex); + } + } + //Because the CurrentScreen function is not so reliable, these are the functions used for swipes private void NextScreenCommand() {