// Use this for initialization void Start() { state = State.Idle; content = GetComponentInChildren <SwipeScrollerContent>(); GetComponent <InputDetector>().OnTouchAnywhere += OnTouchAnywhere; GetComponent <InputDetector>().OnTouchReleaseAnywhere += OnTouchReleaseAnywhere; }
public void AlignContentToBounds() { if (content == null) { content = GetComponentInChildren <SwipeScrollerContent>(); } float distanceToTop = collider.bounds.max.y - content.collider.bounds.max.y; float distanceToBottom = collider.bounds.min.y - content.collider.bounds.min.y; if (distanceToTop > 0f) { Vector3 newPos = content.transform.localPosition; newPos.y += distanceToTop; content.transform.localPosition = newPos; speed = 0f; } else if (distanceToBottom < 0f) { Vector3 newPos = content.transform.localPosition; newPos.y += distanceToBottom; content.transform.localPosition = newPos; speed = 0f; } }
void Start() { listItems = new List <QuizListItem>(); scrollerContent = GetComponentInChildren <SwipeScrollerContent>(); quizManager = FindObjectOfType(typeof(QuizzesManager)) as QuizzesManager; quizzes = new List <Quiz>(quizManager.GetQuizList()); CreateQuizzesList(); ShowAdBanner(); }