예제 #1
0
        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);
        }
예제 #2
0
        public CurveLine(IStorableAnimationCurve storable, UICurveLineColors colors = null)
        {
            points = new List <CurveEditorPoint>();

            _storable = storable;
            _colors   = colors ?? new UICurveLineColors();

            SetPointsFromCurve();
        }
예제 #3
0
        public void CreateCurve(IStorableAnimationCurve storable, UICurveLineColors colors, float thickness)
        {
            var line = new CurveLine(storable, colors);

            line.thickness = thickness;
            _lines.Add(line);
            _scrubberPositions.Add(line, line.curve.keys.First().time);
            _storableToLineMap.Add(storable, line);
            SetVerticesDirty();
        }
예제 #4
0
        public CurveEditorPoint(CurveLine parent, UICurveLineColors colors = null)
        {
            this.parent = parent;
            _colors     = colors ?? new UICurveLineColors();

            pointColor     = _colors.pointColor;
            inHandleColor  = _colors.inHandleColor;
            outHandleColor = _colors.outHandleColor;
            lineColor      = _colors.handleLineColor;
        }
예제 #5
0
        public UICurveLine(IStorableAnimationCurve storable, UILine line, UIScrubber scrubber, UICurveLineColors colors = null)
        {
            points = new List <UICurveEditorPoint>();

            _storable      = storable;
            _line          = line;
            _scrubber      = scrubber;
            _colors        = colors ?? new UICurveLineColors();
            _evaluateCount = 200;

            _line.color     = _colors.lineColor;
            _scrubber.color = _colors.scrubberColor;

            SetPointsFromCurve();
            SetScrubber(0);
        }
예제 #6
0
 //TODO: meh...
 public void AddCurve(IStorableAnimationCurve storable, UICurveLineColors colors = null, float thickness = 0.04f) => _canvas.CreateCurve(storable, colors, thickness);