mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:23:00 +08:00
Merge pull request #22568 from Joehuu/address-init-only-todo
Address todos relating to init-only usages
This commit is contained in:
commit
240a5f9c85
@ -66,10 +66,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
int days = ranked_days - index + 1;
|
||||
|
||||
return new UserGraphTooltipContent(
|
||||
UsersStrings.ShowRankGlobalSimple,
|
||||
rank.ToLocalisableString("\\##,##0"),
|
||||
days == 0 ? "now" : $"{"day".ToQuantity(days)} ago");
|
||||
return new UserGraphTooltipContent
|
||||
{
|
||||
Name = UsersStrings.ShowRankGlobalSimple,
|
||||
Count = rank.ToLocalisableString("\\##,##0"),
|
||||
Time = days == 0 ? "now" : $"{"day".ToQuantity(days)} ago",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,11 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
protected override float GetDataPointHeight(long playCount) => playCount;
|
||||
|
||||
protected override UserGraphTooltipContent GetTooltipContent(DateTime date, long playCount) =>
|
||||
new UserGraphTooltipContent(
|
||||
tooltipCounterName,
|
||||
playCount.ToLocalisableString("N0"),
|
||||
date.ToLocalisableString("MMMM yyyy"));
|
||||
new UserGraphTooltipContent
|
||||
{
|
||||
Name = tooltipCounterName,
|
||||
Count = playCount.ToLocalisableString("N0"),
|
||||
Time = date.ToLocalisableString("MMMM yyyy")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -298,16 +298,8 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
public class UserGraphTooltipContent
|
||||
{
|
||||
// todo: could use init-only properties on C# 9 which read better than a constructor.
|
||||
public LocalisableString Name { get; }
|
||||
public LocalisableString Count { get; }
|
||||
public LocalisableString Time { get; }
|
||||
|
||||
public UserGraphTooltipContent(LocalisableString name, LocalisableString count, LocalisableString time)
|
||||
{
|
||||
Name = name;
|
||||
Count = count;
|
||||
Time = time;
|
||||
}
|
||||
public LocalisableString Name { get; init; }
|
||||
public LocalisableString Count { get; init; }
|
||||
public LocalisableString Time { get; init; }
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,7 @@ namespace osu.Game.Tests.Visual
|
||||
/// <summary>
|
||||
/// The dependencies provided to the children.
|
||||
/// </summary>
|
||||
// TODO: should be an init-only property when C# 9
|
||||
public (Type, object)[] CachedDependencies { get; set; } = Array.Empty<(Type, object)>();
|
||||
public (Type, object)[] CachedDependencies { get; init; } = Array.Empty<(Type, object)>();
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user