public void ScrollUpVoice() { float cellSizeY = DirectoriesParent.GetComponent <GridLayoutGroup>().cellSize.y; if (DirectoriesParent.GetComponent <RectTransform>().offsetMax.y > 0) { DirectoriesParent.GetComponent <RectTransform>().offsetMax = new Vector2(DirectoriesParent.GetComponent <RectTransform>().offsetMax.x, DirectoriesParent.GetComponent <RectTransform>().offsetMax.y - cellSizeY * 4); } }
public void ScrollDownVoice() { float cellSizeY = DirectoriesParent.GetComponent <GridLayoutGroup>().cellSize.y; float totalSize = DirectoriesParent.transform.childCount * cellSizeY; if (DirectoriesParent.GetComponent <RectTransform>().offsetMax.y < totalSize) { DirectoriesParent.GetComponent <RectTransform>().offsetMax = new Vector2(DirectoriesParent.GetComponent <RectTransform>().offsetMax.x, DirectoriesParent.GetComponent <RectTransform>().offsetMax.y + cellSizeY * 4); } }
IEnumerator ScrollUp() { yield return(new WaitForSeconds(2f)); float cellSizeY = DirectoriesParent.GetComponent <GridLayoutGroup>().cellSize.y; do { if (DirectoriesParent.GetComponent <RectTransform>().offsetMax.y > 0) { DirectoriesParent.GetComponent <RectTransform>().offsetMax = new Vector2(DirectoriesParent.GetComponent <RectTransform>().offsetMax.x, DirectoriesParent.GetComponent <RectTransform>().offsetMax.y - cellSizeY * 4); } yield return(new WaitForSeconds(2f)); }while (scrollUp_Gazed); }
IEnumerator ScrollDown() { yield return(new WaitForSeconds(2f)); float cellSizeY = DirectoriesParent.GetComponent <GridLayoutGroup>().cellSize.y; float totalSize = DirectoriesParent.transform.childCount * cellSizeY; do { if (DirectoriesParent.GetComponent <RectTransform>().offsetMax.y < totalSize) { DirectoriesParent.GetComponent <RectTransform>().offsetMax = new Vector2(DirectoriesParent.GetComponent <RectTransform>().offsetMax.x, DirectoriesParent.GetComponent <RectTransform>().offsetMax.y + cellSizeY * 4); } yield return(new WaitForSeconds(2f)); }while (scrollDown_Gazed); }