Exemplo n.º 1
0
        void DrawProfileVarTable(object tableKey, IEnumerable <KeyValuePair <string, string> > data)
        {
            HostingServicesProfileVarsTreeView table;

            if (!m_ProfileVarTables.TryGetValue(tableKey, out table))
            {
                table = new HostingServicesProfileVarsTreeView(new TreeViewState(),
                                                               HostingServicesProfileVarsTreeView.CreateHeader());
                m_ProfileVarTables[tableKey] = table;
            }

            var rowHeight   = table.RowHeight;
            var tableHeight = table.multiColumnHeader.height + rowHeight; // header + 1 extra line

            table.ClearItems();

            var manager = m_Settings.HostingServicesManager;

            foreach (var globalVar in manager.GlobalProfileVariables)
            {
                table.AddOrUpdateItem(globalVar.Key, globalVar.Value);
                tableHeight += rowHeight;
            }
            foreach (var kvp in data)
            {
                table.AddOrUpdateItem(kvp.Key, kvp.Value);
                tableHeight += rowHeight;
            }

            table.OnGUI(EditorGUILayout.GetControlRect(false, tableHeight));
        }
Exemplo n.º 2
0
        void DrawProfileVarTable(IHostingService tableKey)
        {
            var manager = m_Settings.HostingServicesManager;
            var data    = tableKey.ProfileVariables;

            HostingServicesProfileVarsTreeView table;

            if (!m_ProfileVarTables.TryGetValue(tableKey, out table))
            {
                table = new HostingServicesProfileVarsTreeView(new TreeViewState(),
                                                               HostingServicesProfileVarsTreeView.CreateHeader());
                m_ProfileVarTables[tableKey]          = table;
                m_TablePrevData[tableKey]             = new Dictionary <string, string>(data);
                m_TablePrevManagerVariables[tableKey] = new Dictionary <string, string>(manager.GlobalProfileVariables);
            }

            else if (!DictsAreEqual(data, m_TablePrevData[tableKey]) || !DictsAreEqual(manager.GlobalProfileVariables, m_TablePrevManagerVariables[tableKey]))
            {
                table.ClearItems();
                m_TablePrevData[tableKey]             = new Dictionary <string, string>(data);
                m_TablePrevManagerVariables[tableKey] = new Dictionary <string, string>(manager.GlobalProfileVariables);
            }

            if (table.Count == 0)
            {
                foreach (var globalVar in manager.GlobalProfileVariables)
                {
                    table.AddOrUpdateItem(globalVar.Key, globalVar.Value);
                }

                foreach (var kvp in data)
                {
                    table.AddOrUpdateItem(kvp.Key, kvp.Value);
                }
            }

            var rowHeight   = table.RowHeight;
            var tableHeight = table.multiColumnHeader.height + rowHeight + (rowHeight * (data.Count() + manager.GlobalProfileVariables.Count)); // header + 1 extra line

            table.OnGUI(EditorGUILayout.GetControlRect(false, tableHeight));
        }