コード例 #1
0
        void GraphGUI(GraphItem graph, float width)
        {
            var foldoutHeader = new GUIStyle(EditorStyles.foldoutHeader);
            // foldoutHeader.fixedWidth = width - 10;
            // foldoutHeader.fixedWidth = Screen.width / EditorGUIUtility.pixelsPerPoint - 25;

            var graphContianerLayout = GUILayout.MaxWidth(Screen.width);

            var group = new List <GraphItem> {
                graph
            };

            using (new GUILayout.VerticalScope(GUILayout.MaxWidth(width)))
            {
                var header = graph._.title;

                if (data.showValues)
                {
                    header += " " + graph._GetLastValues();
                }
                if (data.showCounts)
                {
                    header += " " + graph._GetCounts();
                }

                graph._.visible = EditorGUILayout.BeginFoldoutHeaderGroup(graph._.visible, header, foldoutHeader);
                EditorGUILayout.EndFoldoutHeaderGroup();

                if (graph._.visible)  // using( new GUILayout.HorizontalScope( graphContianerLayout ) )

                {
                    GraphRenderer.RenderGUI(group);
                }

                else
                {
                    GUILayout.Space(4);
                }
            }
        }
コード例 #2
0
 public static void RenderGraphData(Rect area, GraphItem data)
 {
     RenderGraphGroup(area, new List <GraphItem> {
         data
     });
 }
コード例 #3
0
 public static string _GetCounts(this GraphItem graph)
 {
     return("(" + graph._.points.Count + ")");
 }
コード例 #4
0
 public static string _GetLastValues(this GraphItem graph)
 {
     return("(" + graph._.points.LastOrDefault().ToString("N2") + ")");
 }