Class MenuTree<T>
A menu tree that is used by editor scripts to display nested menu options
Inherited Members
Namespace: LobsterFramework
Assembly: LobsterFramework.dll
Syntax
public class MenuTree<T>
Type Parameters
Name | Description |
---|---|
T | The type of the items to be stored in the menu tree |
Constructors
| Improve this Doc View SourceMenuTree(string)
Declaration
public MenuTree(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Fields
| Improve this Doc View SourcemenuName
Name of this node
Declaration
public string menuName
Field Value
Type | Description |
---|---|
string |
options
Declaration
public List<T> options
Field Value
Type | Description |
---|---|
List<T> |
parentMenu
Declaration
public MenuTree<T> parentMenu
Field Value
Type | Description |
---|---|
MenuTree<T> |
path
Path to this node
Declaration
public string path
Field Value
Type | Description |
---|---|
string |
subMenus
Declaration
public Dictionary<string, MenuTree<T>> subMenus
Field Value
Type | Description |
---|---|
Dictionary<string, MenuTree<T>> |
Methods
| Improve this Doc View SourceAddChild(MenuTree<T>)
Add a child node to the tree. Circular reference is not allowed. Attempting to add ancestor nodes or nodes that already has a parent will have no effect.
Declaration
public void AddChild(MenuTree<T> child)
Parameters
Type | Name | Description |
---|---|---|
MenuTree<T> | child | The child to be added |
AddItem(MenuTree<T>, string, T)
Add the item to the menu tree
Declaration
public static MenuTree<T> AddItem(MenuTree<T> root, string itemPath, T item)
Parameters
Type | Name | Description |
---|---|---|
MenuTree<T> | root | The root of the menu tree |
string | itemPath | The location of this item in the tree |
T | item | The item to be added |
Returns
Type | Description |
---|---|
MenuTree<T> | The menu tree that directly holds the item |
IsAncestor(MenuTree<T>)
Check if the given tree is an ancestor of this menu tree.
Declaration
public bool IsAncestor(MenuTree<T> tree)
Parameters
Type | Name | Description |
---|---|---|
MenuTree<T> | tree | The tree to be examined |
Returns
Type | Description |
---|---|
bool | true if the tree is an ancestor, otherwise false |