mirror of
https://github.com/4sval/FModel.git
synced 2026-09-25 10:39:14 -05:00
auto resize qDescription + translated reload time + save locres
This commit is contained in:
@@ -349,11 +349,33 @@ namespace FModel
|
||||
|
||||
Image reload = Resources.reload64;
|
||||
myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
|
||||
myGraphic.DrawString(statParsed.ReloadTime + " seconds", new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
myGraphic.DrawString(statParsed.ReloadTime + getSecondsWithLanguage(), new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
|
||||
|
||||
DrawToRight(weaponName, myGraphic);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// manual translation to improve speed and in case the key is deleted
|
||||
/// that's just 1 word so /shrug
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string getSecondsWithLanguage()
|
||||
{
|
||||
switch (Settings.Default.IconLanguage)
|
||||
{
|
||||
case "French":
|
||||
return " secondes";
|
||||
case "German":
|
||||
return " Sekunden";
|
||||
case "Italian":
|
||||
return " secondi";
|
||||
case "Spanish":
|
||||
case "Spanish (LA)":
|
||||
return " segundos";
|
||||
default:
|
||||
return " seconds";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this is only triggered for heroes and defenders
|
||||
|
||||
@@ -40,5 +40,28 @@ namespace FModel
|
||||
centeredStringLine.LineAlignment = StringAlignment.Center;
|
||||
centeredStringLine.Alignment = StringAlignment.Center;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// https://stackoverflow.com/questions/19674743/dynamically-resizing-font-to-fit-space-while-using-graphics-drawstring/19674954
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
/// <param name="longString"></param>
|
||||
/// <param name="Room"></param>
|
||||
/// <param name="PreferedFont"></param>
|
||||
/// <returns></returns>
|
||||
public static Font FindFont(Graphics g, string longString, Size Room, Font PreferedFont)
|
||||
{
|
||||
SizeF RealSize = g.MeasureString(longString, PreferedFont);
|
||||
float HeightScaleRatio = Room.Height / RealSize.Height;
|
||||
float WidthScaleRatio = Room.Width / RealSize.Width;
|
||||
|
||||
float ScaleRatio = (HeightScaleRatio < WidthScaleRatio)
|
||||
? ScaleRatio = HeightScaleRatio
|
||||
: ScaleRatio = WidthScaleRatio;
|
||||
|
||||
float ScaleFontSize = PreferedFont.Size * ScaleRatio;
|
||||
|
||||
return new Font(PreferedFont.FontFamily, ScaleFontSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace FModel
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Icons\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Sounds\\");
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\LocRes\\");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user