Skip to content

Commit

Permalink
[+] Play Count in SelectionDetail
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Nov 15, 2024
1 parent 6c5791b commit 0455a83
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions AquaMai/Resources/Locale.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions AquaMai/Resources/Locale.resx
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,7 @@
<data name="CiBuildAlertContent" xml:space="preserve">
<value>You are using AquaMai CI build version. This version is built from the latest mainline code and may contain undocumented configuration changes or potential issues.</value>
</data>
<data name="PlayCount" xml:space="preserve">
<value>游玩次数:{0}</value>
</data>
</root>
3 changes: 3 additions & 0 deletions AquaMai/Resources/Locale.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@
<data name="CiBuildAlertContent" xml:space="preserve">
<value>您正在使用的是 AquaMai CI 构建版本。由于该版本基于最新的主线代码构建,可能包含未通知的配置文件变更或潜在问题。</value>
</data>
<data name="PlayCount" xml:space="preserve">
<value>Play Count: {0}</value>
</data>
</root>
10 changes: 8 additions & 2 deletions AquaMai/Utils/SelectionDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private class P2Window : Window
private abstract class Window : MonoBehaviour
{
protected abstract int player { get; }
private UserData userData => Singleton<UserDataManager>.Instance.GetUserData(player);

public void OnGUI()
{
Expand All @@ -88,6 +89,12 @@ public void OnGUI()
dataToShow.Add(string.Format(Locale.RatingUpWhenSSSp, rate));
}

var playCount = Shim.GetUserScoreList(userData)[difficulty[player]].FirstOrDefault(it => it.id == SelectData.MusicData.name.id)?.playcount ?? 0;
if (playCount > 0)
{
dataToShow.Add(string.Format(Locale.PlayCount, playCount));
}


var width = GuiSizes.FontSize * 15f;
var x = GuiSizes.PlayerCenter - width / 2f + GuiSizes.PlayerWidth * player;
Expand All @@ -107,8 +114,7 @@ public void OnGUI()
private uint CalcB50(MusicData musicData, int difficulty)
{
var newRate = new UserRate(musicData.name.id, difficulty, 1010000, (uint)musicData.version);
var user = Singleton<UserDataManager>.Instance.GetUserData(player);
var userLowRate = (newRate.OldFlag ? user.RatingList.RatingList : user.RatingList.NewRatingList).Last();
var userLowRate = (newRate.OldFlag ? userData.RatingList.RatingList : userData.RatingList.NewRatingList).Last();

if (newRate.SingleRate > userLowRate.SingleRate)
{
Expand Down

0 comments on commit 0455a83

Please sign in to comment.