DrawDetailedLegend() public method

public DrawDetailedLegend ( Rect canvas, Vector2 &scrollPos, int max, bool positiveOnly = false, bool negativeOnly = false ) : void
canvas UnityEngine.Rect
scrollPos Vector2
max int
positiveOnly bool
negativeOnly bool
return void
コード例 #1
0
        private void DrawConsumption(Rect canvas)
        {
            // setup rects
            var plotRect   = new Rect(canvas.xMin, canvas.yMin, canvas.width, (canvas.height - Utilities.Margin) / 2f);
            var legendRect = new Rect(canvas.xMin, plotRect.yMax + Utilities.Margin, canvas.width,
                                      (canvas.height - Utilities.Margin) / 2f);

            // draw the plot
            tradingHistory.DrawPlot(plotRect, negativeOnly: true);

            // draw the detailed legend
            tradingHistory.DrawDetailedLegend(legendRect, ref _consumptionScrollPos, null, false, true);
        }
コード例 #2
0
        private void DrawOverview(Rect canvas)
        {
            // setup rects
            var legendRect = new Rect(canvas.xMin, canvas.yMin, (canvas.width - Utilities.Margin) / 2f,
                                      canvas.height - Utilities.ButtonSize.y - Utilities.Margin);
            var plotRect = new Rect(legendRect.xMax + Utilities.Margin, canvas.yMin,
                                    (canvas.width - Utilities.Margin) / 2f, canvas.height);
            var buttonsRect = new Rect(canvas.xMin, legendRect.yMax + Utilities.Margin,
                                       (canvas.width - Utilities.Margin) / 2f, Utilities.ButtonSize.y);

            // draw the plot
            overallHistory.DrawPlot(plotRect);

            // draw the detailed legend
            overallHistory.DrawDetailedLegend(legendRect, ref _overallScrollPos, null);

            // draw period switcher
            Rect periodRect = buttonsRect;

            periodRect.width /= 2f;

            // label
            Utilities.Label(periodRect, "FME.PeriodShown".Translate(tradingHistory.periodShown.ToString()),
                            "FME.PeriodShownTooltip".Translate(tradingHistory.periodShown.ToString()));

            // mark interactivity
            Rect searchIconRect = periodRect;

            searchIconRect.xMin = searchIconRect.xMax - searchIconRect.height;
            if (searchIconRect.height > Utilities.SmallIconSize)
            {
                // center it.
                searchIconRect = searchIconRect.ContractedBy((searchIconRect.height - Utilities.SmallIconSize) / 2);
            }
            GUI.DrawTexture(searchIconRect, Resources.Search);
            Widgets.DrawHighlightIfMouseover(periodRect);
            if (Widgets.ButtonInvisible(periodRect))
            {
                var periodOptions = new List <FloatMenuOption>();
                for (var i = 0; i < History.periods.Length; i++)
                {
                    History.Period period = History.periods[i];
                    periodOptions.Add(new FloatMenuOption(period.ToString(), delegate
                    {
                        tradingHistory.periodShown =
                            period;
                        overallHistory.periodShown =
                            period;
                    }));
                }

                Find.WindowStack.Add(new FloatMenu(periodOptions));
            }
        }