mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Convert to readonly struct
and replace with constructor temporarily
This commit is contained in:
parent
208f66cc76
commit
3969350c9a
@ -64,12 +64,10 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
var days = ranked_days - index + 1;
|
var days = ranked_days - index + 1;
|
||||||
|
|
||||||
return new UserGraphTooltipContent
|
return new UserGraphTooltipContent(
|
||||||
{
|
UsersStrings.ShowRankGlobalSimple,
|
||||||
Name = UsersStrings.ShowRankGlobalSimple,
|
rank.ToLocalisableString("\\##,##0"),
|
||||||
Count = rank.ToLocalisableString("\\##,##0"),
|
days == 0 ? "now" : $"{"day".ToQuantity(days)} ago");
|
||||||
Time = days == 0 ? "now" : $"{"day".ToQuantity(days)} ago"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,12 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
|
|
||||||
protected override float GetDataPointHeight(long playCount) => playCount;
|
protected override float GetDataPointHeight(long playCount) => playCount;
|
||||||
|
|
||||||
protected override UserGraphTooltipContent GetTooltipContent(DateTime date, long playCount) => new UserGraphTooltipContent
|
protected override UserGraphTooltipContent GetTooltipContent(DateTime date, long playCount)
|
||||||
{
|
{
|
||||||
Name = tooltipCounterName,
|
return new UserGraphTooltipContent(
|
||||||
Count = playCount.ToLocalisableString("N0"),
|
tooltipCounterName,
|
||||||
Time = date.ToLocalisableString("MMMM yyyy")
|
playCount.ToLocalisableString("N0"),
|
||||||
};
|
date.ToLocalisableString("MMMM yyyy"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,11 +295,18 @@ namespace osu.Game.Overlays.Profile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserGraphTooltipContent
|
public readonly struct UserGraphTooltipContent
|
||||||
{
|
{
|
||||||
// todo: change to init-only on C# 9
|
// todo: could use init-only properties on C# 9 which read better than a constructor.
|
||||||
public LocalisableString Name { get; set; }
|
public LocalisableString Name { get; }
|
||||||
public LocalisableString Count { get; set; }
|
public LocalisableString Count { get; }
|
||||||
public LocalisableString Time { get; set; }
|
public LocalisableString Time { get; }
|
||||||
|
|
||||||
|
public UserGraphTooltipContent(LocalisableString name, LocalisableString count, LocalisableString time)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Count = count;
|
||||||
|
Time = time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user