void CreateGestureGalleryGrid(List <GestureExample> withExamples, List <int> lineNumbers) { if (withExamples != null && withExamples.Count > 0) { GameObject newGridGO = Instantiate(gridPrefab.gameObject); VRGestureGalleryGrid newGrid = newGridGO.GetComponent <VRGestureGalleryGrid>(); newGridGO.transform.parent = transform; newGridGO.transform.position = transform.position; newGridGO.transform.rotation = transform.rotation; newGridGO.transform.localScale = Vector3.one; newGrid.Init(this, withExamples, lineNumbers); grids.Add(newGrid); } }
public void Init(VRGestureGalleryGrid _grid, GestureExample _example, int _lineNumber) { grid = _grid; example = _example; lineNumber = _lineNumber; // draw the line lineDrawing = DrawGesture(example.data, _lineNumber); transform.localPosition = Vector3.zero; transform.localScale = Vector3.one; // set the trash icon position RectTransform trashTF = (RectTransform)trash.transform; trashTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 20); trashTF.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 25); // add the button listener function button.onClick.AddListener(() => grid.gallery.DeleteGestureExample(example, lineNumber)); }