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