private UICurveEditorPoint CreatePoint(UICurveLine line, Vector2 position) { var point = line.CreatePoint(position); BindPoint(point); return(point); }
private void BindPoints(UICurveLine line) { foreach (var point in line.points) { BindPoint(point); } }
public UICurveLine AddCurve(IStorableAnimationCurve storable, UICurveLineColors colors = null, float thickness = 4) { var lineContainer = new GameObject(); lineContainer.transform.SetParent(_linesContainer.transform, false); var rectTransform = _linesContainer.GetComponent <RectTransform>(); var line = lineContainer.AddComponent <UILine>(); line.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, rectTransform.sizeDelta.x); line.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y); line.lineThickness = thickness; var scrubberContainer = new GameObject(); scrubberContainer.transform.SetParent(_scrubbersContainer.transform, false); var scrubber = scrubberContainer.AddComponent <UIScrubber>(); scrubber.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 1); scrubber.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, rectTransform.sizeDelta.y * 2); var curveLine = new UICurveLine(storable, line, scrubber, colors); _lines.Add(curveLine); _storableToLineMap.Add(storable, curveLine); _lineToContainerMap.Add(curveLine, lineContainer); BindPoints(curveLine); return(curveLine); }