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);
            }
        }
Beispiel #2
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);
        }
 public static MenuItem AddLabel(this Menu config, string displayName)
 {
     ItemIndex++;
     return(config.AddItem(new MenuItem(ItemIndex.ToString(), MultiLanguage._(displayName))));
 }
 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))));
 }
Beispiel #5
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));
 }
Beispiel #6
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));
 }
Beispiel #7
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));
 }
Beispiel #8
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));
 }