Archived
1
0

shorten credits with K/M suffixes

This commit is contained in:
2021-08-01 15:01:33 +02:00
parent 64fe83a0db
commit 9f3632650f
6 changed files with 26 additions and 4 deletions

21
Journal/Credits.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NonaBGS.Journal {
public class Credits {
public static string FormatCredits(int amount) {
if ((amount % 1000000) == 0) {
amount /= 1000000;
return string.Format("{0}M CR", amount);
} else if ((amount % 1000) == 0) {
amount /= 1000;
return string.Format("{0}K CR", amount);
}
return string.Format("{0} CR", amount);
}
}
}

View File

@@ -101,7 +101,7 @@ namespace NonaBGS.Journal {
}
if (donated > 0) {
builder.AppendFormat(" ({0} CR)", donated);
builder.AppendFormat(" ({0})", Credits.FormatCredits(donated));
}
readable_name = builder.ToString().Trim();