Exemplo n.º 1
0
 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))));
 }
Exemplo n.º 2
0
 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))));
 }
Exemplo n.º 3
0
        public static Menu CreatMainMenu(string name, string displayName)
        {
            var config = new Menu(MultiLanguage._(displayName), name, true);

            config.AddToMainMenu();

            return(config);
        }
Exemplo n.º 4
0
 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.Debug("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(new Slider(Defaults, min, max))));
 }
Exemplo n.º 5
0
 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))));
 }
Exemplo n.º 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.Debug("创建菜单错误", $"已经包含了名为{name}的菜单!", DebugLevel.Warning);
            }

            return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName)).SetValue(Defaults)));
        }
Exemplo n.º 7
0
        /// <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)));
        }
Exemplo n.º 8
0
 public static MenuItem AddLabel(this Menu config, string name, string displayName)
 {
     if (config.Items.Any(m => m.Name == name))
     {
         config.Item(name).DisplayName = displayName;
         return(config.Item(name));
     }
     return(config.AddItem(new MenuItem(name, MultiLanguage._(displayName))));
 }
Exemplo n.º 9
0
        /// <summary>
        /// 将文字转换为Html输出格式
        /// </summary>
        /// <param name="form">要输出的内容</param>
        /// <param name="FontName">字体名</param>
        /// <param name="FontSize">字体大小</param>
        /// <param name="FontColor">字体颜色</param>
        /// <returns>格式化后的内容</returns>
        public static string ToHtml(this string form, string FontName, int FontSize, Color FontColor)
        {
            string colorhx = "#" + FontColor.ToArgb().ToString("X6");

            form = MultiLanguage._(form);
            form = form.ToUTF8();
            form = $"<font face=\"{FontName}\" size=\"{FontSize}\"  color=\"{colorhx}\">{form}</font>";
            return(form);
        }
Exemplo n.º 10
0
        public static Menu CreatMainMenu(string name, string displayName)
        {
            var config = new Menu(MultiLanguage._(displayName), name, true);

            config.AddToMainMenu();

            var Menu = config.AddMenu("Credits", "脚本信息");

            Menu.AddLabel($"LSFU - {HeroManager.Player.ChampionName}");
            Menu.AddLabel($"www.lsharp.xyz");
            return(config);
        }
Exemplo n.º 11
0
        public static Menu CreatMainMenu(string name, string displayName)
        {
            var config = new Menu(MultiLanguage._(displayName), name, true);

            config.AddToMainMenu();

            var Menu = config.AddMenu("Credits", "脚本信息");

            Menu.AddLabel("作者:晴依");
            Menu.AddLabel("如果你喜欢这个脚本,记得在脚本库中点赞!");
            return(config);
        }
Exemplo n.º 12
0
        public static void Translat(this Menu config)
        {
            foreach (var menu in config.Children)
            {
                menu.DisplayName = MultiLanguage._(menu.DisplayName);
                foreach (var item in menu.Items)
                {
                    item.DisplayName = MultiLanguage._(item.DisplayName);
                }
            }

            foreach (var item in config.Items)
            {
                item.DisplayName = MultiLanguage._(item.DisplayName);
            }
        }
Exemplo n.º 13
0
        public static string ToHtml(this string form, string color, FontStlye fontStlye = FontStlye.Null)
        {
            form = MultiLanguage._(form);
            form = form.ToUTF8();
            form = $"<font color=\"{color}\">{form}</font>";

            switch (fontStlye)
            {
            case FontStlye.Bold:
                form = string.Format("<b>{0}</b>", form);
                break;

            case FontStlye.Cite:
                form = string.Format("<i>{0}</i>", form);
                break;
            }
            return(form);
        }
Exemplo n.º 14
0
 public static MenuItem AddLabel(this Menu config, string displayName)
 {
     ItemIndex++;
     return(config.AddItem(new MenuItem(ItemIndex.ToString(), MultiLanguage._(displayName))));
 }
Exemplo n.º 15
0
 public static void DrawText(this Font font, string text, Color color, Vector2 position)
 {
     font.DrawText(null, MultiLanguage._(text), (int)position.X, (int)position.Y, new ColorBGRA(color.B, color.G, color.R, color.A));
 }
Exemplo n.º 16
0
 /// <summary>
 /// 显示在屏幕上指定位置文字
 /// </summary>
 /// <param name="font">字体</param>
 /// <param name="text">要显示的内容</param>
 /// <param name="color">显示颜色</param>
 /// <param name="x">显示在屏幕X轴%</param>
 /// <param name="y">显示在屏幕Y轴%</param>
 public static void DrawText(this Font font, string text, Color color, int x, int y)
 {
     font.DrawText(null, MultiLanguage._(text), (int)((float)(Drawing.Width) * x / 100), (int)((float)(Drawing.Height) * y / 100), new ColorBGRA(color.B, color.G, color.R, color.A));
 }
Exemplo n.º 17
0
 public static void DrawTextCentered(this Font font, string text, int x, int y, Color color)
 {
     DrawTextCentered(font, MultiLanguage._(text), new Vector2(x, y), new XDColor(color.R, color.G, color.B, color.A));
 }
Exemplo n.º 18
0
 /// <summary>
 /// 显示在屏幕上指定位置文字
 /// </summary>
 /// <param name="font">字体</param>
 /// <param name="text">要显示的内容</param>
 /// <param name="color">显示颜色</param>
 /// <param name="x">显示在屏幕X轴%</param>
 /// <param name="y">显示在屏幕Y轴%</param>
 public static void DrawScreenPercent(this Font font, string text, Color color, int x, int y)
 {
     DrawTextCentered(font, MultiLanguage._(text), new Vector2((float)(Drawing.Width) * x / 100, (float)(Drawing.Height) * y / 100), new XDColor(color.R, color.G, color.B, color.A));
 }