-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathFunctionTableState.cs
72 lines (65 loc) · 2.11 KB
/
FunctionTableState.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System.Collections.Generic;
#if !UNITY_2019_1_OR_NEWER
using UnityEditorInternal.Profiling;
#endif
using UnityEngine;
namespace ProfilerDataExporter
{
public class FunctionTableState : TableGUILayout.ITableState
{
private SplitterState splitterState;
private IEnumerable<string> columnHeaders;
private string sortHeader;
public FunctionTableState(ProfilerColumn[] columnsToShow, Dictionary<ProfilerColumn, string> columnHeaders, string sortHeader)
{
this.columnHeaders = columnHeaders.Values;
this.sortHeader = sortHeader;
var splitterRelativeSizes = new float[columnsToShow.Length + 1];
var splitterMinWidths = new int[columnsToShow.Length + 1];
for (int i = 0; i < columnsToShow.Length; i++)
{
var column = columnHeaders[columnsToShow[i]];
splitterMinWidths[i] = (int)GUI.skin.GetStyle("OL title").CalcSize(new GUIContent(column)).x;
splitterRelativeSizes[i] = 70f;
}
splitterMinWidths[columnsToShow.Length] = 16;
splitterRelativeSizes[columnsToShow.Length] = 0f;
if (columnsToShow[0] == ProfilerColumn.FunctionName)
{
splitterRelativeSizes[0] = 400f;
splitterMinWidths[0] = 100;
}
splitterState = new SplitterState(splitterRelativeSizes, splitterMinWidths, null);
}
IEnumerable<string> TableGUILayout.ITableState.Headers
{
get
{
return columnHeaders;
}
}
Vector2 TableGUILayout.ITableState.ScrollPosition
{
get;
set;
}
SplitterState TableGUILayout.ITableState.SplitterState
{
get
{
return splitterState;
}
}
string TableGUILayout.ITableState.SortHeader
{
get
{
return sortHeader;
}
set
{
sortHeader = value;
}
}
}
}