1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Change GameplaySkinComponentLookup's generic to always be an enum

And document the class better.
This commit is contained in:
Dean Herbert 2023-02-15 18:48:13 +09:00
parent a92e42bb84
commit 08ed174f61

View File

@ -1,12 +1,23 @@
// 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 System;
using System.Linq;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Skinning
{
/// <summary>
/// A lookup typed intended for use for skinnable gameplay components (not HUD level components).
/// </summary>
/// <remarks>
/// The most common usage of this class is for ruleset-specific skinning implementations, but it can also be used directly
/// (see <see cref="DrawableJudgement"/>'s usage for <see cref="HitResult"/>) where ruleset-agnostic elements are required.
/// </remarks>
/// <typeparam name="T">An enum lookup type.</typeparam>
public class GameplaySkinComponentLookup<T> : ISkinComponentLookup
where T : notnull
where T : Enum
{
public readonly T Component;
@ -16,7 +27,7 @@ namespace osu.Game.Skinning
}
protected virtual string RulesetPrefix => string.Empty;
protected virtual string ComponentName => Component.ToString() ?? string.Empty;
protected virtual string ComponentName => Component.ToString();
public string LookupName =>
string.Join('/', new[] { "Gameplay", RulesetPrefix, ComponentName }.Where(s => !string.IsNullOrEmpty(s)));