2015-02-03 03:25:41 +08:00
|
|
|
/// Credit BinaryX
|
|
|
|
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-2#post-1945602
|
|
|
|
/// Updated by ddreaper - removed dependency on a custom ScrollRect script. Now implements drag interfaces and standard Scroll Rect.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
namespace UnityEngine.UI.Extensions
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2016-05-24 03:57:56 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
[RequireComponent(typeof(ScrollRect))]
|
2015-09-20 07:24:17 +08:00
|
|
|
[AddComponentMenu("Layout/Extensions/Horizontal Scroll Snap")]
|
2015-02-03 07:07:31 +08:00
|
|
|
public class HorizontalScrollSnap : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
|
|
|
|
{
|
|
|
|
private Transform _screensContainer;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
private int _screens = 1;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
private bool _fastSwipeTimer = false;
|
|
|
|
private int _fastSwipeCounter = 0;
|
|
|
|
private int _fastSwipeTarget = 30;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
private System.Collections.Generic.List<Vector3> _positions;
|
|
|
|
private ScrollRect _scroll_rect;
|
|
|
|
private Vector3 _lerp_target;
|
|
|
|
private bool _lerp;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
[Tooltip("The gameobject that contains toggles which suggest pagination. (optional)")]
|
|
|
|
public GameObject Pagination;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
[Tooltip("Button to go to the next page. (optional)")]
|
|
|
|
public GameObject NextButton;
|
|
|
|
[Tooltip("Button to go to the previous page. (optional)")]
|
|
|
|
public GameObject PrevButton;
|
2016-05-17 20:26:50 +08:00
|
|
|
[Tooltip("Transition speed between pages. (optional)")]
|
|
|
|
public float transitionSpeed = 7.5f;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
public Boolean UseFastSwipe = true;
|
|
|
|
public int FastSwipeThreshold = 100;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
private bool _startDrag = true;
|
|
|
|
private Vector3 _startPosition = new Vector3();
|
2016-05-24 03:57:56 +08:00
|
|
|
|
|
|
|
[Tooltip("The currently active page")]
|
2015-02-03 07:07:31 +08:00
|
|
|
private int _currentScreen;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2016-05-18 05:46:37 +08:00
|
|
|
[Tooltip("The screen / page to start the control on")]
|
2016-07-22 00:25:34 +08:00
|
|
|
[SerializeField]
|
2016-05-18 05:37:01 +08:00
|
|
|
public int StartingScreen = 1;
|
2016-05-24 03:57:56 +08:00
|
|
|
|
2016-11-15 22:52:34 +08:00
|
|
|
[Tooltip("The distance between two pages based on page height, by default 3 times the width of the control")]
|
2016-07-22 00:25:34 +08:00
|
|
|
[SerializeField]
|
2016-11-15 22:52:34 +08:00
|
|
|
[Range(0, 8)]
|
|
|
|
public float PageStep = 0;
|
2016-05-18 05:37:01 +08:00
|
|
|
|
2016-05-24 03:57:56 +08:00
|
|
|
public int CurrentPage
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return _currentScreen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-18 05:37:01 +08:00
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
// Use this for initialization
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
_scroll_rect = gameObject.GetComponent<ScrollRect>();
|
2016-05-28 07:04:08 +08:00
|
|
|
|
|
|
|
if (_scroll_rect.horizontalScrollbar || _scroll_rect.verticalScrollbar)
|
|
|
|
{
|
|
|
|
Debug.LogWarning("Warning, using scrollbors with the Scroll Snap controls is not advised as it causes unpredictable results");
|
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
_screensContainer = _scroll_rect.content;
|
2016-11-15 22:52:34 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
DistributePages();
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
_lerp = false;
|
2016-11-15 21:36:50 +08:00
|
|
|
_currentScreen = StartingScreen - 1;
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2016-11-15 21:36:50 +08:00
|
|
|
_scroll_rect.horizontalNormalizedPosition = (float)(_currentScreen) / (_screens - 1);
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2016-05-18 05:37:01 +08:00
|
|
|
ChangeBulletsInfo(_currentScreen);
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
if (NextButton)
|
|
|
|
NextButton.GetComponent<Button>().onClick.AddListener(() => { NextScreen(); });
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
if (PrevButton)
|
|
|
|
PrevButton.GetComponent<Button>().onClick.AddListener(() => { PreviousScreen(); });
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
void Update()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (_lerp)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2016-05-17 20:26:50 +08:00
|
|
|
_screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime);
|
2015-02-03 07:07:31 +08:00
|
|
|
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.005f)
|
|
|
|
{
|
|
|
|
_lerp = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//change the info bullets at the bottom of the screen. Just for visual effect
|
|
|
|
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 10f)
|
|
|
|
{
|
|
|
|
ChangeBulletsInfo(CurrentScreen());
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
if (_fastSwipeTimer)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
_fastSwipeCounter++;
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
private bool fastSwipe = false; //to determine if a fast swipe was performed
|
2015-02-03 03:25:41 +08:00
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//Function for switching screens with buttons
|
|
|
|
public void NextScreen()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2016-05-18 05:37:01 +08:00
|
|
|
if (_currentScreen < _screens - 1)
|
2015-02-03 07:07:31 +08:00
|
|
|
{
|
2016-05-18 05:37:01 +08:00
|
|
|
_currentScreen++;
|
2015-02-03 07:07:31 +08:00
|
|
|
_lerp = true;
|
2016-05-18 05:37:01 +08:00
|
|
|
_lerp_target = _positions[_currentScreen];
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2016-05-18 05:37:01 +08:00
|
|
|
ChangeBulletsInfo(_currentScreen);
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//Function for switching screens with buttons
|
|
|
|
public void PreviousScreen()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2016-05-18 05:37:01 +08:00
|
|
|
if (_currentScreen > 0)
|
2015-02-03 07:07:31 +08:00
|
|
|
{
|
2016-05-18 05:37:01 +08:00
|
|
|
_currentScreen--;
|
2015-02-03 07:07:31 +08:00
|
|
|
_lerp = true;
|
2016-05-18 05:37:01 +08:00
|
|
|
_lerp_target = _positions[_currentScreen];
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2016-05-18 05:37:01 +08:00
|
|
|
ChangeBulletsInfo(_currentScreen);
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2016-11-15 21:36:50 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Function for switching to a specific screen
|
|
|
|
/// *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>
|
2016-05-24 04:10:17 +08:00
|
|
|
public void GoToScreen(int screenIndex)
|
|
|
|
{
|
2016-11-15 21:36:50 +08:00
|
|
|
if (screenIndex <= _screens - 1 && screenIndex >= 0)
|
2016-05-24 04:10:17 +08:00
|
|
|
{
|
|
|
|
_lerp = true;
|
|
|
|
_lerp_target = _positions[screenIndex];
|
|
|
|
|
|
|
|
ChangeBulletsInfo(screenIndex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//Because the CurrentScreen function is not so reliable, these are the functions used for swipes
|
|
|
|
private void NextScreenCommand()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (_currentScreen < _screens - 1)
|
|
|
|
{
|
|
|
|
_lerp = true;
|
|
|
|
_lerp_target = _positions[_currentScreen + 1];
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
ChangeBulletsInfo(_currentScreen + 1);
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//Because the CurrentScreen function is not so reliable, these are the functions used for swipes
|
|
|
|
private void PrevScreenCommand()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (_currentScreen > 0)
|
|
|
|
{
|
|
|
|
_lerp = true;
|
|
|
|
_lerp_target = _positions[_currentScreen - 1];
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
ChangeBulletsInfo(_currentScreen - 1);
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//find the closest registered point to the releasing point
|
|
|
|
private Vector3 FindClosestFrom(Vector3 start, System.Collections.Generic.List<Vector3> positions)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
Vector3 closest = Vector3.zero;
|
|
|
|
float distance = Mathf.Infinity;
|
|
|
|
|
|
|
|
foreach (Vector3 position in _positions)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (Vector3.Distance(start, position) < distance)
|
|
|
|
{
|
|
|
|
distance = Vector3.Distance(start, position);
|
|
|
|
closest = position;
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
return closest;
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//returns the current screen that the is seeing
|
|
|
|
public int CurrentScreen()
|
|
|
|
{
|
2016-05-18 05:37:01 +08:00
|
|
|
var pos = FindClosestFrom(_screensContainer.localPosition, _positions);
|
|
|
|
return _currentScreen = GetPageforPosition(pos);
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
//changes the bullets on the bottom of the page - pagination
|
|
|
|
private void ChangeBulletsInfo(int currentScreen)
|
|
|
|
{
|
|
|
|
if (Pagination)
|
|
|
|
for (int i = 0; i < Pagination.transform.childCount; i++)
|
|
|
|
{
|
2015-02-03 03:25:41 +08:00
|
|
|
Pagination.transform.GetChild(i).GetComponent<Toggle>().isOn = (currentScreen == i)
|
|
|
|
? true
|
|
|
|
: false;
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//used for changing between screen resolutions
|
|
|
|
private void DistributePages()
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
int _offset = 0;
|
2016-11-15 22:52:34 +08:00
|
|
|
float _dimension = 0;
|
2016-09-03 05:38:06 +08:00
|
|
|
Rect panelDimensions = gameObject.GetComponent<RectTransform>().rect;
|
2016-11-15 22:52:34 +08:00
|
|
|
float currentXPosition = 0;
|
|
|
|
var pageStepValue = (int)panelDimensions.width * ((PageStep == 0) ? 3 : PageStep);
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < _screensContainer.transform.childCount; i++)
|
|
|
|
{
|
|
|
|
RectTransform child = _screensContainer.transform.GetChild(i).gameObject.GetComponent<RectTransform>();
|
2016-11-15 22:52:34 +08:00
|
|
|
currentXPosition = _offset + (int)(i * pageStepValue);
|
2016-09-03 05:38:06 +08:00
|
|
|
child.sizeDelta = new Vector2(panelDimensions.width, panelDimensions.height);
|
2015-02-03 07:07:31 +08:00
|
|
|
child.anchoredPosition = new Vector2(currentXPosition, 0f);
|
2016-09-03 05:38:06 +08:00
|
|
|
child.anchorMin = new Vector2(0f, child.anchorMin.y);
|
|
|
|
child.anchorMax = new Vector2(0f, child.anchorMax.y);
|
|
|
|
child.pivot = new Vector2(0f, child.pivot.y);
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_dimension = currentXPosition + _offset * -1;
|
|
|
|
|
|
|
|
_screensContainer.GetComponent<RectTransform>().offsetMax = new Vector2(_dimension, 0f);
|
2016-05-24 03:57:56 +08:00
|
|
|
|
|
|
|
_screens = _screensContainer.childCount;
|
|
|
|
|
|
|
|
_positions = new System.Collections.Generic.List<Vector3>();
|
|
|
|
|
|
|
|
if (_screens > 0)
|
|
|
|
{
|
|
|
|
for (float i = 0; i < _screens; ++i)
|
|
|
|
{
|
|
|
|
_scroll_rect.horizontalNormalizedPosition = i / (_screens - 1);
|
|
|
|
_positions.Add(_screensContainer.localPosition);
|
|
|
|
}
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
|
2016-05-18 05:37:01 +08:00
|
|
|
int GetPageforPosition(Vector3 pos)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < _positions.Count; i++)
|
|
|
|
{
|
|
|
|
if (_positions[i] == pos)
|
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
void OnValidate()
|
|
|
|
{
|
|
|
|
var childCount = gameObject.GetComponent<ScrollRect>().content.childCount;
|
2016-07-22 00:25:34 +08:00
|
|
|
if (StartingScreen > childCount - 1)
|
2016-05-18 05:37:01 +08:00
|
|
|
{
|
2016-07-22 00:25:34 +08:00
|
|
|
StartingScreen = childCount - 1;
|
2016-05-18 05:37:01 +08:00
|
|
|
}
|
2016-07-22 00:25:34 +08:00
|
|
|
if (StartingScreen < 0)
|
2016-05-18 05:37:01 +08:00
|
|
|
{
|
2016-07-22 00:25:34 +08:00
|
|
|
StartingScreen = 0;
|
2016-05-18 05:37:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-24 03:57:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Add a new child to this Scroll Snap and recalculate it's children
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="GO">GameObject to add to the ScrollSnap</param>
|
|
|
|
public void AddChild(GameObject GO)
|
|
|
|
{
|
|
|
|
_scroll_rect.horizontalNormalizedPosition = 0;
|
|
|
|
GO.transform.SetParent(_screensContainer);
|
|
|
|
DistributePages();
|
|
|
|
|
|
|
|
_scroll_rect.horizontalNormalizedPosition = (float)(_currentScreen) / (_screens - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Remove a new child to this Scroll Snap and recalculate it's children
|
|
|
|
/// *Note, this is an index address (0-x)
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="index"></param>
|
|
|
|
/// <param name="ChildRemoved"></param>
|
|
|
|
public void RemoveChild(int index, out GameObject ChildRemoved)
|
|
|
|
{
|
|
|
|
ChildRemoved = null;
|
|
|
|
if (index < 0 || index > _screensContainer.childCount)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
_scroll_rect.horizontalNormalizedPosition = 0;
|
|
|
|
var children = _screensContainer.transform;
|
|
|
|
int i = 0;
|
|
|
|
foreach (Transform child in children)
|
|
|
|
{
|
|
|
|
if (i == index)
|
|
|
|
{
|
|
|
|
child.SetParent(null);
|
|
|
|
ChildRemoved = child.gameObject;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
DistributePages();
|
|
|
|
if (_currentScreen > _screens - 1)
|
|
|
|
{
|
|
|
|
_currentScreen = _screens - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
_scroll_rect.horizontalNormalizedPosition = (float)(_currentScreen) / (_screens - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
#region Interfaces
|
|
|
|
public void OnBeginDrag(PointerEventData eventData)
|
|
|
|
{
|
|
|
|
_startPosition = _screensContainer.localPosition;
|
|
|
|
_fastSwipeCounter = 0;
|
|
|
|
_fastSwipeTimer = true;
|
2016-05-24 03:57:56 +08:00
|
|
|
_currentScreen = CurrentScreen();
|
2015-02-03 07:07:31 +08:00
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
public void OnEndDrag(PointerEventData eventData)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
_startDrag = true;
|
|
|
|
if (_scroll_rect.horizontal)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (UseFastSwipe)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
fastSwipe = false;
|
|
|
|
_fastSwipeTimer = false;
|
|
|
|
if (_fastSwipeCounter <= _fastSwipeTarget)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (Math.Abs(_startPosition.x - _screensContainer.localPosition.x) > FastSwipeThreshold)
|
|
|
|
{
|
|
|
|
fastSwipe = true;
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
2015-02-03 07:07:31 +08:00
|
|
|
if (fastSwipe)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
if (_startPosition.x - _screensContainer.localPosition.x > 0)
|
|
|
|
{
|
|
|
|
NextScreenCommand();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PrevScreenCommand();
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
_lerp = true;
|
|
|
|
_lerp_target = FindClosestFrom(_screensContainer.localPosition, _positions);
|
2016-05-18 05:37:01 +08:00
|
|
|
_currentScreen = GetPageforPosition(_lerp_target);
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_lerp = true;
|
|
|
|
_lerp_target = FindClosestFrom(_screensContainer.localPosition, _positions);
|
2016-05-18 05:37:01 +08:00
|
|
|
_currentScreen = GetPageforPosition(_lerp_target);
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-03 07:07:31 +08:00
|
|
|
public void OnDrag(PointerEventData eventData)
|
2015-02-03 03:25:41 +08:00
|
|
|
{
|
2015-02-03 07:07:31 +08:00
|
|
|
_lerp = false;
|
|
|
|
if (_startDrag)
|
|
|
|
{
|
|
|
|
OnBeginDrag(eventData);
|
|
|
|
_startDrag = false;
|
|
|
|
}
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
2015-02-03 07:07:31 +08:00
|
|
|
#endregion
|
2016-05-18 05:37:01 +08:00
|
|
|
|
|
|
|
|
2015-02-03 03:25:41 +08:00
|
|
|
}
|
|
|
|
}
|