Details

Last Updated
7 months ago
First Uploaded
7 months ago
Downloads
193
Likes
0
Size
31KB
Dependency string
LordAshes-DeepMenusPlugin-1.0.0
Dependants

Deep Menus Plugin

This unofficial TaleSpire plugin that ends Radial UI Plugin allowing sub-menus beyond one level.

This plugin, like all others, is free but if you want to donate, use: http://198.91.243.185/TalespireDonate/Donate.php

Change Log

1.0.0: Initial release

Install

Use R2ModMan or similar installer to install this plugin.

Usage

This is a dependency plugin so there is no user usage. Developers can integrate the functionality of this plugin into their own plugins using the below information.

The plugin has 3 levels of hand holding ranging from taking care of most of the functionality for the user to handling only the essential functionality and letting the user handle the details him/herself.

Simplest Solultion

  1. Create the top level menu using the usual RadialUI plugin code, such as:

RadialUI.RadialSubmenu.EnsureMainMenuItem(Guid, RadialUI.RadialSubmenu.MenuType.character, "Create", FileAccessPlugin.Image.LoadSprite("option.png"));

  1. Add submenu entries using the provided CreateSubMenu and MakeSubMenuEntry functions.
CreateSubMenu("", MakeSubMenuEntry("Male", icon));
CreateSubMenu("", MakeSubMenuEntry("Female", icon));

or if you want to add a checker:

CreateSubMenu("", MakeSubMenuEntry("Male", icon), () => { return DateTime.UtcNow.ToString("s").Contains("5"); } );
CreateSubMenu("", MakeSubMenuEntry("Female", icon), () => { return !DateTime.UtcNow.ToString("s").Contains("5"); } );
  1. Add menu ietms using the provided CreateSubMenuItem and MakeItemEntry functions.
CreateSubMenuItem("/Male/Male Artificer", MakeItemEntry("Good", (s,m) => SystemMessage.DisplayInfoText(s+" in "+m), icon));
CreateSubMenuItem("/Male/Male Artificer", MakeItemEntry("Evil", (s,m) => SystemMessage.DisplayInfoText(s+" in "+m), icon));

or

CreateSubMenuItem("/Male/Male Artificer", MakeItemEntry("Good", (s,m) => SystemMessage.DisplayInfoText(s+" in "+m), icon),() => { return DateTime.UtcNow.ToString("s").Contains("5"); } );
CreateSubMenuItem("/Male/Male Artificer", MakeItemEntry("Evil", (s,m) => SystemMessage.DisplayInfoText(s+" in "+m), icon),() => { return !DateTime.UtcNow.ToString("s").Contains("5"); });

The MakeSubMenuEntry and MakeItemEntry create the necessary RadialUI MapMenu.ItemArgs and the CreateSubMenuItem and CreateSubMenuItem automatically setup the Submenu objects as well as the NagivateTo action for submenu entries so the user does not need to set the Action property for submenu entries. The results are then passed to the RadialUI CreateSubMenuItem function which handles the rest of the process.

This usage is the easiest to use but it also does not provide access to all of the RadialUI MapMenu.ItemArgs properties like fadeName.

Assisted Solution

  1. Create the top level menu using the usual RadialUI plugin code, such as:

RadialUI.RadialSubmenu.EnsureMainMenuItem(Guid, RadialUI.RadialSubmenu.MenuType.character, "Create", FileAccessPlugin.Image.LoadSprite("option.png"));

  1. Add submenu entries using the provided CreateSubMenu function.
CreateSubMenu("", new MapMenu.ItemArgs() { Title = "Male", Icon = icon, FadeName = false, CloseMenuOnActivate = true });
CreateSubMenu("", new MapMenu.ItemArgs() { Title = "Female", Icon = icon, FadeName = false, CloseMenuOnActivate = true });

or if you want to add a checker:

CreateSubMenu("", new MapMenu.ItemArgs() { Title = "Male", Icon = icon, FadeName = false, CloseMenuOnActivate = true }, () => { return DateTime.UtcNow.ToString("s").Contains("5"); });
CreateSubMenu("", new MapMenu.ItemArgs() { Title = "Female", Icon = icon, FadeName = false, CloseMenuOnActivate = true }, () => { return !DateTime.UtcNow.ToString("s").Contains("5"); });
  1. Add menu ietms using the provided CreateSubMenuItem function.
CreateSubMenuItem("/Male/Male Artificer", new MapMenu.ItemArgs() { Title = "Good", Action = (mmi, s) => SystemMessage.DisplayInfoText("Good from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true });
CreateSubMenuItem("/Male/Male Artificer", new MapMenu.ItemArgs() { Title = "Evil", Action = (mmi, s) => SystemMessage.DisplayInfoText("Evil from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true });

or

CreateSubMenuItem("/Male/Male Artificer", new MapMenu.ItemArgs() { Title = "Good", Action = (mmi, s) => SystemMessage.DisplayInfoText("Good from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return DateTime.UtcNow.ToString("s").Contains("5"); });
CreateSubMenuItem("/Male/Male Artificer", new MapMenu.ItemArgs() { Title = "Evil", Action = (mmi, s) => SystemMessage.DisplayInfoText("Evil from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return !DateTime.UtcNow.ToString("s").Contains("5"); });

The sub-menu entries automatically use the provided NavigateTo function in order to cause the menu selection to navigate to the corresponding sub-menu. The user does not need to specify an Action. The sub-menu item entries require an Action entry indicating what should be done when the item is selected. Typically this is a callback into the parent plugin.

This usage is slightly more complex but it provides access to the full set of RadialUI MapMenu.ItemArgs properties like fadeName.

Detailed Oriented Solution

This solution uses the existing RadialUI.RadialSubmenu.CreateSubMenuItem function along with the newly provided NavigateTo

  1. Create the top level menu using the usual RadialUI plugin code, such as:

RadialUI.RadialSubmenu.EnsureMainMenuItem(Guid, RadialUI.RadialSubmenu.MenuType.character, "Create", FileAccessPlugin.Image.LoadSprite("option.png"));

  1. Use the RadialUI.RadialSubmenu's existing CreateSubMenuItem function to add the sub-menus and menu items.
RadialUI.RadialSubmenu.CreateSubMenuItem(Guid, new MapMenu.ItemArgs() { Obj=Guid, Title = "Male", Action = (mmi, s) => NavigateTo("Male"), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return DateTime.UtcNow.ToString("s").Contains("5"); });
RadialUI.RadialSubmenu.CreateSubMenuItem(Guid, new MapMenu.ItemArgs() { Obj=Guid, Title = "Female", Action = (mmi, s) => NavigateTo("Female"), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return DateTime.UtcNow.ToString("s").Contains("5"); });
RadialUI.RadialSubmenu.CreateSubMenuItem(Guid+"/Male/Male Artificer", new MapMenu.ItemArgs() { Obj=Guid+"/Male/Male Artificer", Title = "Good", Action = (mmi, s) => SystemMessage.DisplayInfoText("Good from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return DateTime.UtcNow.ToString("s").Contains("5"); });
RadialUI.RadialSubmenu.CreateSubMenuItem(Guid+"/Male/Male Artificer", new MapMenu.ItemArgs() { Obj=Guid+"/Male/Male Artificer", Title = "Evil", Action = (mmi, s) => SystemMessage.DisplayInfoText("Evil from "+currentMenu), Icon = icon, FadeName = false, CloseMenuOnActivate = true },() => { return !DateTime.UtcNow.ToString("s").Contains("5"); });

As can be seen this usage requires more work and some of the parameters are repeated. The sub-menu entries make use of the provided NavigateTo function which navigates to the corresponding sub-menu. Sub-menu items, as before, trigger the provided function when selected.

The key to making the sub-menus work is the menu id and the Obj property on the menu items need to match.

The NavigateTo will take care of opening the sub-menu without a need to call the OpenSubMenu function. However, if a sub-menu needs to be opened programatically, it can be by using the following code:

OpenSubMenu(menuLocation)

Where menuLocation is a string of the menu location (without the Guid prefix).

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.