public void SetObject(EditorObject ob) { foreach (GUIElement element in elements) { element.Parent = null; } elements.Clear(); if (ob != null) { Visible = true; Title = string.Format("Edit {0}", ob.EditorName); Type type = ob.GetType(); foreach (var prop in type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)) { foreach (var attr in prop.GetCustomAttributes(true)) { EditableField field = attr as EditableField; if (field != null) { TryCreateEditField(ob, prop, field); } } } } else { Visible = false; } }
virtual public void InfoWindow(int windowID) { // SerializedObject sObject = new SerializedObject (_target); // SerializedProperty comment = sObject.FindProperty("Comment"); // string nameForTest = _target.name; // // int nameConflicts = _nameConflictCounts.ContainsKey(_target.name) ? _nameConflictCounts[_target.name] : 0; // Color nameColor = _target.NameConflict == true ? Color.red : Color.white; // GUILayout.BeginVertical(); GUILayout.BeginArea(new Rect(0, 0, _editorWindowWidth, _editorWindowHeight), _target.GetType().ToString(), GrendelCustomStyles.CustomElement(GUI.skin.window, Color.white, Color.yellow, TextAnchor.MiddleCenter, FontStyle.Bold)); GUILayout.BeginHorizontal(); // GUILayout.BeginVertical(); // GUILayout.BeginHorizontal(); // GUILayout.Label(new GUIContent(string.Format("Name: {0}", nameConflicts <= 0 ? "" : nameConflicts.ToString()), // nameConflicts <= 0 ? "" : string.Format("There are {0} name conflicts.", nameConflicts.ToString())), // GrendelCustomStyles.CustomElement(GUI.skin.label, Color.white, nameColor), GUILayout.Width(64) ); // // GUI.skin.textField.focused.textColor = nameColor; // _target.name = GUILayout.TextField(_target.name, GrendelCustomStyles.CustomElement(GUI.skin.textArea, Color.white, nameColor), GUILayout.Width(kTextFieldWidth)); // GUILayout.EndHorizontal(); // // GUILayout.BeginHorizontal(); // GUILayout.Label("Comment: ", GUILayout.Width(64)); // GUI.skin.textField.wordWrap = true; // comment.stringValue = GUILayout.TextField(comment.stringValue, kCommentCharacterLimit, GUI.skin.textField, new GUILayoutOption[]{GUILayout.Width(kTextFieldWidth), GUILayout.Height(64)}); // // GUILayout.EndHorizontal(); // sObject.ApplyModifiedProperties(); // GUILayout.EndVertical(); CustomInspector(); _target.LookingForSubject = GUILayout.Toggle(_target.LookingForSubject, "Add", GrendelCustomStyles.CustomElement(GUI.skin.button, Color.green, Color.white, TextAnchor.MiddleCenter, FontStyle.Bold)); DrawConnectionBoxes(); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndVertical(); // if (_target.name != nameForTest || _nameConflictCounts == null) // { // CheckNameConflicts(); // } }
public void SetSelected(EditorObject selected) { if (selected != _selected) { _selected = selected; if (_selected == null) { IsEnabled = false; Type.Content = ""; ObjectName.Text = ""; } else { Type.Content = selected.GetType().ToString(); ObjectName.Text = selected.Name; IsEnabled = true; } } }