Esempio n. 1
0
    private void ConfigureGraph(RetiredColonyData.RetiredColonyStatistic statistic, GameObject layoutBlockGameObject)
    {
        GameObject gameObject = Util.KInstantiateUI(lineGraphPrefab, layoutBlockGameObject, true);

        activeColonyWidgets.Add(statistic.name, gameObject);
        GraphBase componentInChildren = gameObject.GetComponentInChildren <GraphBase>();

        componentInChildren.graphName = statistic.name;
        componentInChildren.label_title.SetText(componentInChildren.graphName);
        componentInChildren.axis_x.name = statistic.nameX;
        componentInChildren.axis_y.name = statistic.nameY;
        componentInChildren.label_x.SetText(componentInChildren.axis_x.name);
        componentInChildren.label_y.SetText(componentInChildren.axis_y.name);
        LineLayer componentInChildren2 = gameObject.GetComponentInChildren <LineLayer>();

        componentInChildren.axis_y.min_value       = 0f;
        componentInChildren.axis_y.max_value       = statistic.GetByMaxValue().second * 1.2f;
        componentInChildren.axis_x.min_value       = 0f;
        componentInChildren.axis_x.max_value       = statistic.GetByMaxKey().first;
        componentInChildren.axis_x.guide_frequency = (componentInChildren.axis_x.max_value - componentInChildren.axis_x.min_value) / 10f;
        componentInChildren.axis_y.guide_frequency = (componentInChildren.axis_y.max_value - componentInChildren.axis_y.min_value) / 10f;
        componentInChildren.RefreshGuides();
        Tuple <float, float>[] value       = statistic.value;
        GraphedLine            graphedLine = componentInChildren2.NewLine(value, statistic.id);

        if (statColors.ContainsKey(statistic.id))
        {
            componentInChildren2.line_formatting[componentInChildren2.line_formatting.Length - 1].color = statColors[statistic.id];
        }
        graphedLine.line_renderer.color = componentInChildren2.line_formatting[componentInChildren2.line_formatting.Length - 1].color;
    }