/// <summary> /// Populates the tree with all enum values. /// </summary> protected override void BuildSelectionTree(OdinMenuTree tree) { tree.Selection.SupportsMultiSelect = isFlagEnum; tree.Config.DrawSearchToolbar = DrawSearchToolbar; foreach (var item in enumVals) { tree.Add(item.niceName, item); } //tree.AddRange(enumValues, x => Enum.GetName(typeof(T), x).SplitPascalCase()); if (isFlagEnum) { tree.DefaultMenuStyle.Offset += 15; if (!enumVals.Where(x => x.value != null).Select(x => Convert.ToInt64(x.value)).Contains(0)) { tree.MenuItems.Insert(0, new OdinMenuItem(tree, GetNoneValueString(), new EnumMember() { value = 0, name = "None", niceName = "None", isObsolete = false, message = "" })); } tree.EnumerateTree().ForEach(x => x.OnDrawItem += DrawEnumFlagItem); this.DrawConfirmSelectionButton = false; } else { tree.EnumerateTree().ForEach(x => x.OnDrawItem += DrawEnumItem); } tree.EnumerateTree().ForEach(x => x.OnDrawItem += DrawEnumInfo); }
protected override void BuildSelectionTree(OdinMenuTree tree) { this.DrawConfirmSelectionButton = false; tree.Config.DrawSearchToolbar = true; tree.DefaultMenuStyle.Height = 25; foreach (var item in typeof(EditorIcons).GetProperties(Flags.StaticPublic).OrderBy(x => x.Name)) { var returnType = item.GetReturnType(); if (typeof(Texture).IsAssignableFrom(returnType)) { tree.Add(item.Name, null, (Texture)item.GetGetMethod().Invoke(null, null)); } else if (typeof(EditorIcon).IsAssignableFrom(returnType)) { tree.Add(item.Name, null, (EditorIcon)item.GetGetMethod().Invoke(null, null)); } } }