public static DrawCountOnGraphics ( Graphics gr, int itemCount, int offset_x, int offset_y ) : void | ||
gr | Graphics | |
itemCount | int | |
offset_x | int | |
offset_y | int | |
return | void |
public static void DrawCountOnGraphics(Graphics gr, int itemCount, int offset_x, int offset_y)
{
int numbers = (int)Math.Floor(Math.Log(itemCount, 10)) + 1;
int xoffset = 1, logamount = itemCount;
for (int i = 0; i < numbers; i++) {
int imagenr = logamount % 10;
Image imageNumber = StyleManager.GetImage(imagenr + ".png");
xoffset = xoffset + imageNumber.Width + (itemCount >= 1000 ? 0 : 1);
lock (imageNumber) {
gr.DrawImage(imageNumber, new Point(offset_x - xoffset, offset_y - imageNumber.Height - 3));
}
logamount /= 10;
}
}
private static void RenderItemCount(Graphics gr, Tuple <Item, int> item, Rectangle region) { if (region.Width > 28) { RenderImageResized(gr, item.Item1.GetImage(), region); if (item.Item1.stackable || item.Item2 > 1) { LootDropForm.DrawCountOnGraphics(gr, item.Item2, region.X + region.Width - 1, region.Y + region.Height - 1); } } else { RenderImageResized(gr, (item.Item1.stackable || item.Item2 > 1) ? LootDropForm.DrawCountOnItem(item.Item1, item.Item2) : item.Item1.GetImage(), region); } }