Exemplo n.º 1
0
        public static void DrawCurve(Rect rect, SimpleCurve curve, SimpleCurveDrawerStyle style = null, List <CurveMark> marks = null, Rect legendScreenRect = default(Rect))
        {
            SimpleCurveDrawInfo simpleCurveDrawInfo = new SimpleCurveDrawInfo();

            simpleCurveDrawInfo.curve = curve;
            DrawCurve(rect, simpleCurveDrawInfo, style, marks, legendScreenRect);
        }
Exemplo n.º 2
0
 public static void DrawCurve(Rect rect, SimpleCurveDrawInfo curve, SimpleCurveDrawerStyle style = null, List <CurveMark> marks = null, Rect legendScreenRect = default(Rect))
 {
     if (curve.curve != null)
     {
         List <SimpleCurveDrawInfo> list = new List <SimpleCurveDrawInfo>();
         list.Add(curve);
         DrawCurves(rect, list, style, marks, legendScreenRect);
     }
 }
 public static void DrawCurve(Rect rect, SimpleCurveDrawInfo curve, SimpleCurveDrawerStyle style = null, List <CurveMark> marks = null, Rect legendScreenRect = default(Rect))
 {
     if (curve.curve != null)
     {
         SimpleCurveDrawer.DrawCurves(rect, new List <SimpleCurveDrawInfo>
         {
             curve
         }, style, marks, legendScreenRect);
     }
 }
Exemplo n.º 4
0
        public static void DrawCurves(Rect rect, List <SimpleCurveDrawInfo> curves, SimpleCurveDrawerStyle style = null, List <CurveMark> marks = null, Rect legendRect = default(Rect))
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            if (style == null)
            {
                style = new SimpleCurveDrawerStyle();
            }
            if (curves.Count == 0)
            {
                return;
            }
            bool flag     = true;
            Rect viewRect = default(Rect);

            for (int i = 0; i < curves.Count; i++)
            {
                SimpleCurveDrawInfo simpleCurveDrawInfo = curves[i];
                if (simpleCurveDrawInfo.curve != null)
                {
                    if (flag)
                    {
                        flag     = false;
                        viewRect = simpleCurveDrawInfo.curve.View.rect;
                        continue;
                    }
                    viewRect.xMin = Mathf.Min(viewRect.xMin, simpleCurveDrawInfo.curve.View.rect.xMin);
                    viewRect.xMax = Mathf.Max(viewRect.xMax, simpleCurveDrawInfo.curve.View.rect.xMax);
                    viewRect.yMin = Mathf.Min(viewRect.yMin, simpleCurveDrawInfo.curve.View.rect.yMin);
                    viewRect.yMax = Mathf.Max(viewRect.yMax, simpleCurveDrawInfo.curve.View.rect.yMax);
                }
            }
            if (style.UseFixedScale)
            {
                viewRect.yMin = style.FixedScale.x;
                viewRect.yMax = style.FixedScale.y;
            }
            if (style.OnlyPositiveValues)
            {
                if (viewRect.xMin < 0f)
                {
                    viewRect.xMin = 0f;
                }
                if (viewRect.yMin < 0f)
                {
                    viewRect.yMin = 0f;
                }
            }
            if (style.UseFixedSection)
            {
                viewRect.xMin = style.FixedSection.min;
                viewRect.xMax = style.FixedSection.max;
            }
            if (!Mathf.Approximately(viewRect.width, 0f) && !Mathf.Approximately(viewRect.height, 0f))
            {
                Rect rect2 = rect;
                if (style.DrawMeasures)
                {
                    rect2.xMin += 60f;
                    rect2.yMax -= 30f;
                }
                if (marks != null)
                {
                    Rect rect3 = rect2;
                    rect3.height = 15f;
                    DrawCurveMarks(rect3, viewRect, marks);
                    rect2.yMin = rect3.yMax;
                }
                if (style.DrawBackground)
                {
                    GUI.color = new Color(0.302f, 0.318f, 0.365f);
                    GUI.DrawTexture(rect2, BaseContent.WhiteTex);
                }
                if (style.DrawBackgroundLines)
                {
                    DrawGraphBackgroundLines(rect2, viewRect);
                }
                if (style.DrawMeasures)
                {
                    DrawCurveMeasures(rect, viewRect, rect2, style.MeasureLabelsXCount, style.MeasureLabelsYCount, style.XIntegersOnly, style.YIntegersOnly);
                }
                foreach (SimpleCurveDrawInfo curf in curves)
                {
                    DrawCurveLines(rect2, curf, style.DrawPoints, viewRect, style.UseAntiAliasedLines, style.PointsRemoveOptimization);
                }
                if (style.DrawLegend)
                {
                    DrawCurvesLegend(legendRect, curves);
                }
                if (style.DrawCurveMousePoint)
                {
                    DrawCurveMousePoint(curves, rect2, viewRect, style.LabelX);
                }
            }
        }