private void OnDuplicateContextMenu(object arg) { switch ((int)arg) { case 1: if (EditorUtility.DisplayDialog("Duplicate Meta Properties", "Duplicate properties from " + this.copiedMetaOwner.ident + " to all entries in this group. This will make sure the other entries all have the same meta properties in the same order as this one. Are you sure?", "Yes", "Cancel")) { for (int k = 0; k < ((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items.Count; k++) { GroupedDataItem groupedDataItem2 = (GroupedDataItem)(object)((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items[k]; this.copiedMetaOwner.meta.DuplicateTo(groupedDataItem2.meta); this.Save(); this.editorWindow.Repaint(); } } break; case 2: if (EditorUtility.DisplayDialog("Duplicate Meta Properties", "Duplicate properties from " + this.copiedMetaOwner.ident + " to all entries in all groups. This will make sure the other entries all have the same meta properties in the same order as this one. Are you sure?", "Yes", "Cancel")) { for (int i = 0; i < this.groupedData.groups.Count; i++) { for (int j = 0; j < ((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[i]).items.Count; j++) { GroupedDataItem groupedDataItem = (GroupedDataItem)(object)((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[i]).items[j]; this.copiedMetaOwner.meta.DuplicateTo(groupedDataItem.meta); this.Save(); this.editorWindow.Repaint(); } } } break; } }
private void Meta_Duplicate() { if (this.listEd.index >= 0 && this.listEd.index < ((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items.Count) { this.copiedMetaOwner = (GroupedDataItem)(object)((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items[this.listEd.index]; GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(new GUIContent("to Group"), false, this.OnDuplicateContextMenu, 1); genericMenu.AddItem(new GUIContent("to All"), false, this.OnDuplicateContextMenu, 2); genericMenu.ShowAsContext(); } }
private void DrawSelected() { if (this.listEd.currGroupIdx >= 0 && this.listEd.index >= 0 && this.listEd.currGroupIdx < this.groupedData.groups.Count && this.listEd.index < ((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items.Count) { GroupedDataItem groupedDataItem = (GroupedDataItem)(object)((GroupedDataGroup <ItemT>)(object) this.groupedData.groups[this.listEd.currGroupIdx]).items[this.listEd.index]; if (groupedDataItem != null) { EditorGUIUtility.labelWidth = 115f; if (this.DrawMetaInNextColumn()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(GUILayout.Width(this.DrawSelectedWidth())); this.DrawSelected((ItemT)groupedDataItem); EditorGUILayout.EndVertical(); GUILayout.Space(5f); EditorGUILayout.BeginVertical(GUILayout.Width(GroupedDataEd <GroupT, ItemT> .ColumnWidth)); this.metaEd.SetTarget(groupedDataItem.meta, null); this.metaEd.DoLayout(); EditorGUILayout.EndVertical(); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.BeginVertical(GUILayout.Width(this.DrawSelectedWidth())); this.DrawSelected((ItemT)groupedDataItem); this.metaEd.SetTarget(groupedDataItem.meta, null); this.metaEd.DoLayout(); EditorGUILayout.EndVertical(); } if (GUI.changed) { this.Save(); } } } }