public static MenuItem AddKeyBind(this Menu config, string name, string displayName, uint key, KeyBindType type, bool active = false)
 {
     if (config.Items.Any(m => m.Name == name))
     {
         DeBug.Write("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(new KeyBind(key, type, active))));
 }
 public static MenuItem AddCircle(this Menu config, string name, string displayName, bool active = false, Color color = new Color())
 {
     if (config.Items.Any(m => m.Name == name))
     {
         DeBug.Write("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(new Circle(active, color))));
 }
 public static MenuItem AddSlider(this Menu config, string name, string displayName, int Defaults = 0, int min = 0, int max = 100)
 {
     if (config.Items.Any(m => m.Name == name))
     {
         DeBug.Write("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(new Slider(Defaults, min, max))));
 }
 public static MenuItem AddStringList(this Menu config, string name, string displayName, string[] stringList = null, int Index = 0)
 {
     if (config.Items.Any(m => m.Name == name))
     {
         DeBug.Write("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(new StringList(stringList.Select(s => MultiLanguage._(s)).ToArray(), Index))));
 }
        /// <summary>
        /// 添加子菜单
        /// </summary>
        /// <param name="config"></param>
        /// <param name="name"></param>
        /// <param name="displayName"></param>
        /// <returns></returns>
        public static Menu AddMenu(this Menu config, string name, string displayName)
        {
            if (config.Children.Any(m => m.Name == name))
            {
                DeBug.Write("创建菜单错误", $"已经包含了名为{name}的子菜单!", DebugLevel.Warning);
            }

            return(config.AddSubMenu(new Menu(MultiLanguage._(displayName), name)));
        }
Beispiel #6
0
        public static MenuItem AddBool(this Menu config, string name, string displayName, bool Defaults = false)
        {
            if (config.Items.Any(m => m.Name == name))
            {
                DeBug.Write("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
            }

            return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(Defaults)));
        }