예제 #1
0
 private void OnGUI()
 {
     if (GUILayout.Button("NextScene"))
     {
         SceneManager.LoadScene((int)Mathf.Repeat(SceneManager.GetActiveScene().buildIndex + 1, SceneManager.sceneCountInBuildSettings));
     }
     if (GUILayout.Button("Add 100 Random Height Cell"))
     {
         for (int i = 0; i < 100; i++)
         {
             var data = new DemoVerticalData(Random.Range(50, 300));
             infiniteScrollView.Add(data);
         }
     }
     GUILayout.Label("Add New Cell Height");
     dataHeight = GUILayout.TextField(dataHeight);
     if (GUILayout.Button("Add"))
     {
         var data = new DemoVerticalData(int.Parse(dataHeight));
         infiniteScrollView.Add(data);
     }
     GUILayout.Label("Remove Index");
     removeIndex = GUILayout.TextField(removeIndex);
     if (GUILayout.Button("Remove"))
     {
         infiniteScrollView.Remove(int.Parse(removeIndex));
     }
     GUILayout.Label("Snap Index");
     snapIndex = GUILayout.TextField(snapIndex);
     if (GUILayout.Button("Snap"))
     {
         infiniteScrollView.Snap(int.Parse(snapIndex), 0.1f);
     }
 }
예제 #2
0
 private void OnGUI()
 {
     if (GUILayout.Button("NextScene"))
     {
         SceneManager.LoadScene((int)Mathf.Repeat(SceneManager.GetActiveScene().buildIndex + 1, SceneManager.sceneCountInBuildSettings));
     }
     if (GUILayout.Button("Add 1000 Cell"))
     {
         for (int i = 0; i < 1000; i++)
         {
             var data = new DemoVerticalGridData(new Vector2(100, 100));
             infiniteScrollView.Add(data);
         }
     }
     if (GUILayout.Button("Add"))
     {
         var data = new DemoVerticalGridData(new Vector2(100, 100));
         infiniteScrollView.Add(data);
     }
     GUILayout.Label("Remove Index");
     removeIndex = GUILayout.TextField(removeIndex);
     if (GUILayout.Button("Remove"))
     {
         infiniteScrollView.Remove(int.Parse(removeIndex));
     }
     GUILayout.Label("Snap Index");
     snapIndex = GUILayout.TextField(snapIndex);
     if (GUILayout.Button("Snap"))
     {
         infiniteScrollView.Snap(int.Parse(snapIndex), 0.1f);
     }
 }