/// <summary> /// Method that created a tree for editor window that is just a list. /// </summary> /// <returns>returns a OdingMneuTree that is created in this window</returns> protected override OdinMenuTree BuildMenuTree() { OdinMenuTree tree = new OdinMenuTree(true); tree.DefaultMenuStyle.IconSize = 28.00f; tree.Config.DrawSearchToolbar = true; tree.DefaultMenuStyle = OdinMenuStyle.TreeViewStyle; OdinMenuStyle style = new OdinMenuStyle() { Height = 23, Offset = 20.00f, IndentAmount = 15.00f, IconSize = 16.00f, IconOffset = 0.00f, NotSelectedIconAlpha = 0.85f, IconPadding = 0.1f, TriangleSize = 16.00f, TrianglePadding = 0.00f, AlignTriangleLeft = true, Borders = true, BorderPadding = 0.00f, BorderAlpha = 0.32f, SelectedColorDarkSkin = new Color(0.736f, 0.101f, 0.038f, 1.000f), SelectedColorLightSkin = new Color(0.736f, 0.101f, 0.038f, 1.000f) }; tree.DefaultMenuStyle = style; tree.Add("Android Parameters", new AndroidParameter()); tree.Add("iOS Parameters", new IOSParameter()); tree.Add("Windows Parameters", new WindowsParameter()); return(tree); }
protected override OdinMenuTree BuildMenuTree() { var tree = new OdinMenuTree(true); var customMenuStyle = new OdinMenuStyle { BorderPadding = 0f, AlignTriangleLeft = true, TriangleSize = 16f, TrianglePadding = 0f, Offset = 20f, Height = 23, IconPadding = 0f, BorderAlpha = 0.323f }; tree.DefaultMenuStyle = customMenuStyle; tree.Config.DrawSearchToolbar = true; // Adds the custom menu style to the tree, so that you can play around with it. // Once you are happy, you can press Copy C# Snippet copy its settings and paste it in code. // And remove the "Menu Style" menu item from the tree. tree.AddObjectAtPath("Menu Style", tree.DefaultMenuStyle) .AddThumbnailIcons(); for (int i = 0; i < 5; i++) { var customObject = new SomeCustomClass() { Name = i.ToString() }; var customMenuItem = new MyCustomMenuItem(tree, customObject); tree.AddMenuItemAtPath("Custom Menu Items", customMenuItem); } tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Tree", "Plugins", typeof(ScriptableObject), true, false) .AddThumbnailIcons() .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Scriptable Objects in Plugins Flat", "Plugins", typeof(ScriptableObject), true, true) .AddThumbnailIcons(true) .SortMenuItemsByName(); tree.AddAllAssetsAtPath("Only Configs has Icons", "Plugins/Sirenix", true, false) .Where(x => x.ObjectInstance as ScriptableObject) .AddThumbnailIcons(); return(tree); }
private OdinMenuTree FirstInit() { OdinMenuTree tree = new OdinMenuTree(true); OdinMenuStyle customMenuStyle = new OdinMenuStyle { BorderPadding = 0f, AlignTriangleLeft = true, TriangleSize = 16f, TrianglePadding = 0f, Offset = 20f, Height = 30, IconPadding = 0f, BorderAlpha = 0.323f }; tree.DefaultMenuStyle = customMenuStyle; return(tree); }
public OdinMenuStyle ReturnOdinMenuStyle() { OdinMenuStyle odinMenuStyle = new OdinMenuStyle() { Height = 50, Offset = 20.00f, IndentAmount = 15.00f, IconSize = 35, IconOffset = 0.00f, NotSelectedIconAlpha = 0.85f, IconPadding = 0.00f, TriangleSize = 16.00f, TrianglePadding = 0.00f, AlignTriangleLeft = true, Borders = true, BorderPadding = 0.00f, BorderAlpha = 0.32f, SelectedColorDarkSkin = new Color(0.243f, 0.373f, 0.588f, 1.000f), SelectedColorLightSkin = new Color(0.243f, 0.490f, 0.900f, 1.000f) }; return(odinMenuStyle); }
protected override void BuildSelectionTree(OdinMenuTree tree) { // Setup tree.Config.DrawSearchToolbar = true; tree.Config.UseCachedExpandedStates = false; tree.Selection.SupportsMultiSelect = false; tree.Config.DefaultMenuStyle.IndentAmount += 13; this.staticMethodMenuItemStyle = tree.Config.DefaultMenuStyle.Clone(); this.staticMethodMenuItemStyle.IconPadding = 0; this.staticMethodMenuItemStyle.Offset -= this.staticMethodMenuItemStyle.IconSize; // Add methods if (this.gameObjectTarget) { this.AddMethods(tree, typeof(GameObject), this.gameObjectTarget, Flags.InstancePublic); this.AddMethods(tree, typeof(GameObject), null, Flags.StaticAnyVisibility); var components = this.gameObjectTarget.GetComponents(typeof(Component)); foreach (var c in components) { this.AddMethods(tree, c.GetType(), c, Flags.InstancePublic); this.AddMethods(tree, c.GetType(), null, Flags.StaticAnyVisibility); } } else if (this.target) { this.AddMethods(tree, this.target.GetType(), this.target, Flags.InstancePublic); this.AddMethods(tree, this.target.GetType(), null, Flags.StaticAnyVisibility); } else { // If there is no target provided then just show static methods from UnityEngine.Object? this.AddMethods(tree, typeof(UnityEngine.Object), null, Flags.StaticPublic); // Include others? // this.AddMethods(tree, typeof(UnityEngine.SceneManagement.SceneManager), null, Flags.StaticPublic); } // Add icons foreach (var item in tree.EnumerateTree()) { if (item.Value is DelegateInfo) { continue; } if (item.ChildMenuItems.Count == 0) { continue; } var child = item.ChildMenuItems[0]; if (child.Value is DelegateInfo) { var del = (DelegateInfo)child.Value; item.IconGetter = () => GUIHelper.GetAssetThumbnail(null, del.Method.DeclaringType, true); } } // Expand first, if there is only one root menu item. if (tree.MenuItems.Count == 1) { tree.MenuItems[0].Toggled = true; } }