예제 #1
0
        private void AddAction()
        {
            if (Event.current.type == EventType.Layout && addAction)
            {
                if (string.IsNullOrEmpty(idbox) || datatable.ContainsKey(idbox))
                {
                    int y = 1;
                    idbox = "NewEntry";
                    while (datatable.ContainsKey(idbox))
                    {
                        idbox = "NewEntry_" + y;
                        y++;
                    }
                }

                //todo CTRL - Z
                T            r   = datatable.CreateStruct();
                DataTableRow uir = new DataTableRow(headers.Count, r, idbox);
                uir.Clicked += OnRowClicked;
                datatable.SetEntry(idbox, r);
                rows.Add(uir);
                EditorUtility.SetDirty((ScriptableObject)datatable);
                GUI.FocusControl("");
                OnSearchUpdated();
                RefreshRowSizes();
                Repaint();
                OnRowClicked(uir, EventArgs.Empty);
            }

            addAction = false;
        }