1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 23:32:59 +08:00

CA1715: use prefix for generic parameters.

This commit is contained in:
Huo Yaoyuan 2019-12-10 21:04:26 +08:00
parent 61a6106e52
commit 40b43b85f1
11 changed files with 34 additions and 35 deletions

View File

@ -17,7 +17,6 @@
<Rule Id="CA1707" Action="None" /> <Rule Id="CA1707" Action="None" />
<Rule Id="CA1710" Action="None" /> <Rule Id="CA1710" Action="None" />
<Rule Id="CA1714" Action="None" /> <Rule Id="CA1714" Action="None" />
<Rule Id="CA1715" Action="None" />
<Rule Id="CA1716" Action="None" /> <Rule Id="CA1716" Action="None" />
<Rule Id="CA1717" Action="None" /> <Rule Id="CA1717" Action="None" />
<Rule Id="CA1720" Action="None" /> <Rule Id="CA1720" Action="None" />

View File

@ -105,19 +105,19 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
} }
} }
public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableTaikoHitObject public abstract class DrawableTaikoHitObject<TTaikoHit> : DrawableTaikoHitObject
where TaikoHitType : TaikoHitObject where TTaikoHit : TaikoHitObject
{ {
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
public new TaikoHitType HitObject; public new TTaikoHit HitObject;
protected readonly Vector2 BaseSize; protected readonly Vector2 BaseSize;
protected readonly TaikoPiece MainPiece; protected readonly TaikoPiece MainPiece;
private readonly Container<DrawableStrongNestedHit> strongHitContainer; private readonly Container<DrawableStrongNestedHit> strongHitContainer;
protected DrawableTaikoHitObject(TaikoHitType hitObject) protected DrawableTaikoHitObject(TTaikoHit hitObject)
: base(hitObject) : base(hitObject)
{ {
HitObject = hitObject; HitObject = hitObject;

View File

@ -7,9 +7,9 @@ using osu.Framework.Platform;
namespace osu.Game.Database namespace osu.Game.Database
{ {
public abstract class MutableDatabaseBackedStoreWithFileIncludes<T, U> : MutableDatabaseBackedStore<T> public abstract class MutableDatabaseBackedStoreWithFileIncludes<T, TFileInfo> : MutableDatabaseBackedStore<T>
where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles<U> where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles<TFileInfo>
where U : INamedFileInfo where TFileInfo : INamedFileInfo
{ {
protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null) protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null)
: base(contextFactory, storage) : base(contextFactory, storage)

View File

@ -7,15 +7,15 @@ using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterfaceV2 namespace osu.Game.Graphics.UserInterfaceV2
{ {
public abstract class LabelledComponent<T, U> : LabelledDrawable<T>, IHasCurrentValue<U> public abstract class LabelledComponent<TDrawable, TValue> : LabelledDrawable<TDrawable>, IHasCurrentValue<TValue>
where T : Drawable, IHasCurrentValue<U> where TDrawable : Drawable, IHasCurrentValue<TValue>
{ {
protected LabelledComponent(bool padded) protected LabelledComponent(bool padded)
: base(padded) : base(padded)
{ {
} }
public Bindable<U> Current public Bindable<TValue> Current
{ {
get => Component.Current; get => Component.Current;
set => Component.Current = value; set => Component.Current = value;

View File

@ -116,13 +116,13 @@ namespace osu.Game.IO.Legacy
} }
/// <summary> Reads a generic Dictionary from the buffer. </summary> /// <summary> Reads a generic Dictionary from the buffer. </summary>
public IDictionary<T, U> ReadDictionary<T, U>() public IDictionary<TKey, TValue> ReadDictionary<TKey, TValue>()
{ {
int count = ReadInt32(); int count = ReadInt32();
if (count < 0) return null; if (count < 0) return null;
IDictionary<T, U> d = new Dictionary<T, U>(); IDictionary<TKey, TValue> d = new Dictionary<TKey, TValue>();
for (int i = 0; i < count; i++) d[(T)ReadObject()] = (U)ReadObject(); for (int i = 0; i < count; i++) d[(TKey)ReadObject()] = (TValue)ReadObject();
return d; return d;
} }

View File

@ -102,7 +102,7 @@ namespace osu.Game.IO.Legacy
} }
/// <summary> Writes a generic IDictionary to the buffer. </summary> /// <summary> Writes a generic IDictionary to the buffer. </summary>
public void Write<T, U>(IDictionary<T, U> d) public void Write<TKey, TValue>(IDictionary<TKey, TValue> d)
{ {
if (d == null) if (d == null)
{ {
@ -112,7 +112,7 @@ namespace osu.Game.IO.Legacy
{ {
Write(d.Count); Write(d.Count);
foreach (KeyValuePair<T, U> kvp in d) foreach (KeyValuePair<TKey, TValue> kvp in d)
{ {
WriteObject(kvp.Key); WriteObject(kvp.Key);
WriteObject(kvp.Value); WriteObject(kvp.Value);

View File

@ -19,7 +19,7 @@ using osuTK.Graphics;
namespace osu.Game.Online.Leaderboards namespace osu.Game.Online.Leaderboards
{ {
public abstract class Leaderboard<TScope, ScoreInfo> : Container, IOnlineComponent public abstract class Leaderboard<TScope, TScoreInfo> : Container, IOnlineComponent
{ {
private const double fade_duration = 300; private const double fade_duration = 300;
@ -39,9 +39,9 @@ namespace osu.Game.Online.Leaderboards
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private IEnumerable<ScoreInfo> scores; private IEnumerable<TScoreInfo> scores;
public IEnumerable<ScoreInfo> Scores public IEnumerable<TScoreInfo> Scores
{ {
get => scores; get => scores;
set set
@ -288,7 +288,7 @@ namespace osu.Game.Online.Leaderboards
/// </summary> /// </summary>
/// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param> /// <param name="scoresCallback">A callback which should be called when fetching is completed. Scheduling is not required.</param>
/// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns> /// <returns>An <see cref="APIRequest"/> responsible for the fetch operation. This will be queued and performed automatically.</returns>
protected abstract APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback); protected abstract APIRequest FetchScores(Action<IEnumerable<TScoreInfo>> scoresCallback);
private Placeholder currentPlaceholder; private Placeholder currentPlaceholder;
@ -359,6 +359,6 @@ namespace osu.Game.Online.Leaderboards
} }
} }
protected abstract LeaderboardScore CreateDrawableScore(ScoreInfo model, int index); protected abstract LeaderboardScore CreateDrawableScore(TScoreInfo model, int index);
} }
} }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays
AccentColour = AccentColour, AccentColour = AccentColour,
}; };
private class OverlayHeaderTabItem : OverlayTabItem<string> private class OverlayHeaderTabItem : OverlayTabItem
{ {
public OverlayHeaderTabItem(string value) public OverlayHeaderTabItem(string value)
: base(value) : base(value)

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays
foreach (TabItem<T> tabItem in TabContainer) foreach (TabItem<T> tabItem in TabContainer)
{ {
((OverlayTabItem<T>)tabItem).AccentColour = value; ((OverlayTabItem)tabItem).AccentColour = value;
} }
} }
} }
@ -59,9 +59,9 @@ namespace osu.Game.Overlays
protected override Dropdown<T> CreateDropdown() => null; protected override Dropdown<T> CreateDropdown() => null;
protected override TabItem<T> CreateTabItem(T value) => new OverlayTabItem<T>(value); protected override TabItem<T> CreateTabItem(T value) => new OverlayTabItem(value);
protected class OverlayTabItem<U> : TabItem<U> protected class OverlayTabItem : TabItem<T>
{ {
private readonly ExpandingBar bar; private readonly ExpandingBar bar;
@ -84,7 +84,7 @@ namespace osu.Game.Overlays
} }
} }
public OverlayTabItem(U value) public OverlayTabItem(T value)
: base(value) : base(value)
{ {
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;

View File

@ -12,11 +12,11 @@ namespace osu.Game.Overlays.Settings
{ {
} }
public class SettingsSlider<T, U> : SettingsItem<T> public class SettingsSlider<TValue, TSlider> : SettingsItem<TValue>
where T : struct, IEquatable<T>, IComparable<T>, IConvertible where TValue : struct, IEquatable<TValue>, IComparable<TValue>, IConvertible
where U : OsuSliderBar<T>, new() where TSlider : OsuSliderBar<TValue>, new()
{ {
protected override Drawable CreateControl() => new U protected override Drawable CreateControl() => new TSlider
{ {
Margin = new MarginPadding { Top = 5, Bottom = 5 }, Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X RelativeSizeAxes = Axes.X
@ -24,14 +24,14 @@ namespace osu.Game.Overlays.Settings
public bool TransferValueOnCommit public bool TransferValueOnCommit
{ {
get => ((U)Control).TransferValueOnCommit; get => ((TSlider)Control).TransferValueOnCommit;
set => ((U)Control).TransferValueOnCommit = value; set => ((TSlider)Control).TransferValueOnCommit = value;
} }
public float KeyboardStep public float KeyboardStep
{ {
get => ((U)Control).KeyboardStep; get => ((TSlider)Control).KeyboardStep;
set => ((U)Control).KeyboardStep = value; set => ((TSlider)Control).KeyboardStep = value;
} }
} }
} }

View File

@ -165,7 +165,7 @@ namespace osu.Game.Overlays
AccentColour = colours.Seafoam; AccentColour = colours.Seafoam;
} }
private class ProfileTabItem : OverlayTabItem<ProfileSection> private class ProfileTabItem : OverlayTabItem
{ {
public ProfileTabItem(ProfileSection value) public ProfileTabItem(ProfileSection value)
: base(value) : base(value)