mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Remove placeholder classes and inline everything
This commit is contained in:
parent
2ae616a88e
commit
4f0f07d55a
14
osu.Game/Graphics/Sprites/SpriteIconWithTooltip.cs
Normal file
14
osu.Game/Graphics/Sprites/SpriteIconWithTooltip.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.Sprites
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="SpriteIcon"/> with a publicly settable tooltip text.
|
||||||
|
/// </summary>
|
||||||
|
public partial class SpriteIconWithTooltip : SpriteIcon, IHasTooltip
|
||||||
|
{
|
||||||
|
public LocalisableString TooltipText { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
osu.Game/Graphics/Sprites/SpriteTextWithTooltip.cs
Normal file
13
osu.Game/Graphics/Sprites/SpriteTextWithTooltip.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.Sprites
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="OsuSpriteText"/> with a publicly settable tooltip text.
|
||||||
|
/// </summary>
|
||||||
|
internal partial class SpriteTextWithTooltip : OsuSpriteText, IHasTooltip
|
||||||
|
{
|
||||||
|
public LocalisableString TooltipText { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -23,9 +23,9 @@ using osuTK.Graphics;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
using osu.Framework.Extensions.LocalisationExtensions;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||||
{
|
{
|
||||||
@ -181,9 +181,23 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
if (showPerformancePoints)
|
if (showPerformancePoints)
|
||||||
{
|
{
|
||||||
if (!score.Ranked)
|
if (!score.Ranked)
|
||||||
content.Add(new UnrankedPerformancePointsPlaceholder(ScoresStrings.StatusNoPp) { Font = OsuFont.GetFont(size: text_size) });
|
{
|
||||||
|
content.Add(new SpriteTextWithTooltip
|
||||||
|
{
|
||||||
|
Text = "-",
|
||||||
|
Font = OsuFont.GetFont(size: text_size),
|
||||||
|
TooltipText = ScoresStrings.StatusNoPp
|
||||||
|
});
|
||||||
|
}
|
||||||
else if (score.PP == null)
|
else if (score.PP == null)
|
||||||
content.Add(new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(text_size) });
|
{
|
||||||
|
content.Add(new SpriteIconWithTooltip
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Sync,
|
||||||
|
Size = new Vector2(text_size),
|
||||||
|
TooltipText = ScoresStrings.StatusProcessing,
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
content.Add(new StatisticText(score.PP, format: @"N0"));
|
content.Add(new StatisticText(score.PP, format: @"N0"));
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ using osu.Game.Resources.Localisation.Web;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Scoring.Drawables;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||||
@ -126,9 +125,23 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
ppColumn.Alpha = value.BeatmapInfo!.Status.GrantsPerformancePoints() ? 1 : 0;
|
ppColumn.Alpha = value.BeatmapInfo!.Status.GrantsPerformancePoints() ? 1 : 0;
|
||||||
|
|
||||||
if (!value.Ranked)
|
if (!value.Ranked)
|
||||||
ppColumn.Drawable = new UnrankedPerformancePointsPlaceholder(ScoresStrings.StatusNoPp) { Font = smallFont };
|
{
|
||||||
|
ppColumn.Drawable = new SpriteTextWithTooltip
|
||||||
|
{
|
||||||
|
Text = "-",
|
||||||
|
Font = smallFont,
|
||||||
|
TooltipText = ScoresStrings.StatusNoPp
|
||||||
|
};
|
||||||
|
}
|
||||||
else if (value.PP is not double pp)
|
else if (value.PP is not double pp)
|
||||||
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
|
{
|
||||||
|
ppColumn.Drawable = new SpriteIconWithTooltip
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Sync,
|
||||||
|
Size = new Vector2(smallFont.Size),
|
||||||
|
TooltipText = ScoresStrings.StatusProcessing,
|
||||||
|
};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Extensions.ObjectExtensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -18,7 +19,6 @@ using osu.Game.Resources.Localisation.Web;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Scoring.Drawables;
|
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -214,6 +214,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
|
|
||||||
private Drawable createDrawablePerformance()
|
private Drawable createDrawablePerformance()
|
||||||
{
|
{
|
||||||
|
var font = OsuFont.GetFont(weight: FontWeight.Bold);
|
||||||
|
|
||||||
if (Score.PP.HasValue)
|
if (Score.PP.HasValue)
|
||||||
{
|
{
|
||||||
return new FillFlowContainer
|
return new FillFlowContainer
|
||||||
@ -226,7 +228,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
Font = font,
|
||||||
Text = $"{Score.PP:0}",
|
Text = $"{Score.PP:0}",
|
||||||
Colour = colourProvider.Highlight1
|
Colour = colourProvider.Highlight1
|
||||||
},
|
},
|
||||||
@ -234,7 +236,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
Font = font.With(size: 12),
|
||||||
Text = "pp",
|
Text = "pp",
|
||||||
Colour = colourProvider.Light3
|
Colour = colourProvider.Light3
|
||||||
}
|
}
|
||||||
@ -244,23 +246,44 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
|
|
||||||
if (Score.Beatmap?.Status.GrantsPerformancePoints() != true)
|
if (Score.Beatmap?.Status.GrantsPerformancePoints() != true)
|
||||||
{
|
{
|
||||||
return new UnrankedPerformancePointsPlaceholder(UsersStrings.ShowExtraTopRanksNotRanked)
|
if (Score.Beatmap?.Status == BeatmapOnlineStatus.Loved)
|
||||||
{
|
{
|
||||||
|
return new SpriteIconWithTooltip
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Heart,
|
||||||
|
Size = new Vector2(font.Size),
|
||||||
|
TooltipText = UsersStrings.ShowExtraTopRanksNotRanked,
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SpriteTextWithTooltip
|
||||||
|
{
|
||||||
|
Text = "-",
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||||
Colour = colourProvider.Highlight1,
|
TooltipText = UsersStrings.ShowExtraTopRanksNotRanked,
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Score.Ranked)
|
if (!Score.Ranked)
|
||||||
{
|
{
|
||||||
return new UnrankedPerformancePointsPlaceholder(ScoresStrings.StatusNoPp)
|
return new SpriteTextWithTooltip
|
||||||
{
|
{
|
||||||
|
Text = "-",
|
||||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||||
Colour = colourProvider.Highlight1,
|
TooltipText = ScoresStrings.StatusNoPp,
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(16), Colour = colourProvider.Highlight1 };
|
return new SpriteIconWithTooltip
|
||||||
|
{
|
||||||
|
Icon = FontAwesome.Solid.Sync,
|
||||||
|
Size = new Vector2(font.Size),
|
||||||
|
TooltipText = ScoresStrings.StatusProcessing,
|
||||||
|
Colour = colourProvider.Highlight1
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
private partial class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Localisation;
|
|
||||||
using osu.Game.Resources.Localisation.Web;
|
|
||||||
|
|
||||||
namespace osu.Game.Scoring.Drawables
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A placeholder used in PP columns for scores with unprocessed PP value.
|
|
||||||
/// </summary>
|
|
||||||
public partial class UnprocessedPerformancePointsPlaceholder : SpriteIcon, IHasTooltip
|
|
||||||
{
|
|
||||||
public LocalisableString TooltipText => ScoresStrings.StatusProcessing;
|
|
||||||
|
|
||||||
public UnprocessedPerformancePointsPlaceholder()
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
Icon = FontAwesome.Solid.Sync;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Localisation;
|
|
||||||
|
|
||||||
namespace osu.Game.Scoring.Drawables
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A placeholder used in PP columns for scores that do not award PP due to a reason specified by <see cref="TooltipText"/>.
|
|
||||||
/// </summary>
|
|
||||||
public partial class UnrankedPerformancePointsPlaceholder : SpriteText, IHasTooltip
|
|
||||||
{
|
|
||||||
public LocalisableString TooltipText { get; }
|
|
||||||
|
|
||||||
public UnrankedPerformancePointsPlaceholder(LocalisableString tooltipText)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
Text = "-";
|
|
||||||
TooltipText = tooltipText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user