/// <summary> /// (Re)creates all row GUI elements. /// </summary> internal protected void BuildGUI() { contentLayout.Clear(); GUILayoutX externalTitleLayout = CreateGUI(contentLayout); if (localTitleLayout || (titleLayout != null && titleLayout == externalTitleLayout)) { return; } if (externalTitleLayout != null) { localTitleLayout = false; titleLayout = externalTitleLayout; } else { GUILayoutY buttonCenter = rowLayout.AddLayoutY(); buttonCenter.AddFlexibleSpace(); titleLayout = buttonCenter.AddLayoutX(); buttonCenter.AddFlexibleSpace(); localTitleLayout = true; } GUIContent cloneIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clone), new LocEdString("Clone")); GUIContent deleteIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Delete), new LocEdString("Delete")); GUIContent moveUp = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveUp), new LocEdString("Move up")); GUIContent moveDown = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.MoveDown), new LocEdString("Move down")); GUIButton cloneBtn = new GUIButton(cloneIcon, GUIOption.FixedWidth(30)); GUIButton deleteBtn = new GUIButton(deleteIcon, GUIOption.FixedWidth(30)); GUIButton moveUpBtn = new GUIButton(moveUp, GUIOption.FixedWidth(30)); GUIButton moveDownBtn = new GUIButton(moveDown, GUIOption.FixedWidth(30)); cloneBtn.OnClick += () => parent.OnCloneButtonClicked(seqIndex); deleteBtn.OnClick += () => parent.OnDeleteButtonClicked(seqIndex); moveUpBtn.OnClick += () => parent.OnMoveUpButtonClicked(seqIndex); moveDownBtn.OnClick += () => parent.OnMoveDownButtonClicked(seqIndex); titleLayout.AddElement(cloneBtn); titleLayout.AddElement(deleteBtn); titleLayout.AddElement(moveUpBtn); titleLayout.AddElement(moveDownBtn); }
/// <summary> /// (Re)creates all row GUI elements. /// </summary> internal protected void BuildGUI() { keyLayout.Clear(); valueLayout.Clear(); GUILayoutX externalTitleLayout = CreateKeyGUI(keyLayout); CreateValueGUI(valueLayout); if (localTitleLayout || (titleLayout != null && titleLayout == externalTitleLayout)) { return; } if (externalTitleLayout != null) { localTitleLayout = false; titleLayout = externalTitleLayout; } else { GUILayoutY buttonCenter = keyRowLayout.AddLayoutY(); buttonCenter.AddFlexibleSpace(); titleLayout = buttonCenter.AddLayoutX(); buttonCenter.AddFlexibleSpace(); localTitleLayout = true; } GUIContent cloneIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Clone), new LocEdString("Clone")); GUIContent deleteIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Delete), new LocEdString("Delete")); GUIContent editIcon = new GUIContent(EditorBuiltin.GetInspectorWindowIcon(InspectorWindowIcon.Edit), new LocEdString("Edit")); cloneBtn = new GUIButton(cloneIcon, GUIOption.FixedWidth(30)); deleteBtn = new GUIButton(deleteIcon, GUIOption.FixedWidth(30)); editBtn = new GUIButton(editIcon, GUIOption.FixedWidth(30)); cloneBtn.OnClick += () => parent.OnCloneButtonClicked(rowIdx); deleteBtn.OnClick += () => parent.OnDeleteButtonClicked(rowIdx); editBtn.OnClick += () => parent.OnEditButtonClicked(rowIdx); titleLayout.AddElement(cloneBtn); titleLayout.AddElement(deleteBtn); titleLayout.AddSpace(10); titleLayout.AddElement(editBtn); EditMode = editMode; }