示例#1
0
 public override List <ScriptMainMenuItem> GetMainMenuItems(GetMainMenuItemsArgs args)
 {
     if (SupportedMenus.Contains(SupportedMenuMethods.MainMenu))
     {
         var res = InvokeFunction(nameof(Plugin.GetMainMenuItems), new List <object> {
             args
         });
         if (res is ScriptMainMenuItem item)
         {
             return(new List <ScriptMainMenuItem> {
                 item
             });
         }
         else if (res is List <object> items)
         {
             return(items.Cast <ScriptMainMenuItem>().ToList());
         }
         else
         {
             return(base.GetMainMenuItems(args));
         }
     }
     else
     {
         return(base.GetMainMenuItems(args));
     }
 }
示例#2
0
 public override List <ScriptMainMenuItem> GetMainMenuItems(GetMainMenuItemsArgs args)
 {
     if (SupportedMenus.Contains(SupportedMenuMethods.MainMenu))
     {
         var res = InvokeFunction("get_mainmenu_items", new List <object> {
             args
         });
         if (res is ScriptMainMenuItem item)
         {
             return(new List <ScriptMainMenuItem> {
                 item
             });
         }
         else if (res is IEnumerable items)
         {
             return(items.Cast <ScriptMainMenuItem>().ToList());
         }
         else
         {
             return(base.GetMainMenuItems(args));
         }
     }
     else
     {
         return(base.GetMainMenuItems(args));
     }
 }