1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +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="CA1710" Action="None" />
<Rule Id="CA1714" Action="None" />
<Rule Id="CA1715" Action="None" />
<Rule Id="CA1716" Action="None" />
<Rule Id="CA1717" 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
where TaikoHitType : TaikoHitObject
public abstract class DrawableTaikoHitObject<TTaikoHit> : DrawableTaikoHitObject
where TTaikoHit : TaikoHitObject
{
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
public new TaikoHitType HitObject;
public new TTaikoHit HitObject;
protected readonly Vector2 BaseSize;
protected readonly TaikoPiece MainPiece;
private readonly Container<DrawableStrongNestedHit> strongHitContainer;
protected DrawableTaikoHitObject(TaikoHitType hitObject)
protected DrawableTaikoHitObject(TTaikoHit hitObject)
: base(hitObject)
{
HitObject = hitObject;

View File

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

View File

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

View File

@ -116,13 +116,13 @@ namespace osu.Game.IO.Legacy
}
/// <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();
if (count < 0) return null;
IDictionary<T, U> d = new Dictionary<T, U>();
for (int i = 0; i < count; i++) d[(T)ReadObject()] = (U)ReadObject();
IDictionary<TKey, TValue> d = new Dictionary<TKey, TValue>();
for (int i = 0; i < count; i++) d[(TKey)ReadObject()] = (TValue)ReadObject();
return d;
}

View File

@ -102,7 +102,7 @@ namespace osu.Game.IO.Legacy
}
/// <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)
{
@ -112,7 +112,7 @@ namespace osu.Game.IO.Legacy
{
Write(d.Count);
foreach (KeyValuePair<T, U> kvp in d)
foreach (KeyValuePair<TKey, TValue> kvp in d)
{
WriteObject(kvp.Key);
WriteObject(kvp.Value);

View File

@ -19,7 +19,7 @@ using osuTK.Graphics;
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;
@ -39,9 +39,9 @@ namespace osu.Game.Online.Leaderboards
protected override Container<Drawable> Content => content;
private IEnumerable<ScoreInfo> scores;
private IEnumerable<TScoreInfo> scores;
public IEnumerable<ScoreInfo> Scores
public IEnumerable<TScoreInfo> Scores
{
get => scores;
set
@ -288,7 +288,7 @@ namespace osu.Game.Online.Leaderboards
/// </summary>
/// <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>
protected abstract APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback);
protected abstract APIRequest FetchScores(Action<IEnumerable<TScoreInfo>> scoresCallback);
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,
};
private class OverlayHeaderTabItem : OverlayTabItem<string>
private class OverlayHeaderTabItem : OverlayTabItem
{
public OverlayHeaderTabItem(string value)
: base(value)

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays
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 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;
@ -84,7 +84,7 @@ namespace osu.Game.Overlays
}
}
public OverlayTabItem(U value)
public OverlayTabItem(T value)
: base(value)
{
AutoSizeAxes = Axes.X;

View File

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

View File

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