mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Merge pull request #7050 from huoyaoyuan/equals
Remove some remaining untyped boxing calls
This commit is contained in:
commit
5e56e91fe2
@ -1,5 +1,6 @@
|
|||||||
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
|
||||||
|
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
|
||||||
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
|
||||||
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.
|
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.
|
||||||
|
@ -37,12 +37,12 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
{
|
{
|
||||||
mods = Score.Mods;
|
mods = Score.Mods;
|
||||||
scaledScore = Score.TotalScore;
|
scaledScore = Score.TotalScore;
|
||||||
countPerfect = Convert.ToInt32(Score.Statistics[HitResult.Perfect]);
|
countPerfect = Score.Statistics[HitResult.Perfect];
|
||||||
countGreat = Convert.ToInt32(Score.Statistics[HitResult.Great]);
|
countGreat = Score.Statistics[HitResult.Great];
|
||||||
countGood = Convert.ToInt32(Score.Statistics[HitResult.Good]);
|
countGood = Score.Statistics[HitResult.Good];
|
||||||
countOk = Convert.ToInt32(Score.Statistics[HitResult.Ok]);
|
countOk = Score.Statistics[HitResult.Ok];
|
||||||
countMeh = Convert.ToInt32(Score.Statistics[HitResult.Meh]);
|
countMeh = Score.Statistics[HitResult.Meh];
|
||||||
countMiss = Convert.ToInt32(Score.Statistics[HitResult.Miss]);
|
countMiss = Score.Statistics[HitResult.Miss];
|
||||||
|
|
||||||
if (mods.Any(m => !m.Ranked))
|
if (mods.Any(m => !m.Ranked))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -45,10 +45,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
mods = Score.Mods;
|
mods = Score.Mods;
|
||||||
accuracy = Score.Accuracy;
|
accuracy = Score.Accuracy;
|
||||||
scoreMaxCombo = Score.MaxCombo;
|
scoreMaxCombo = Score.MaxCombo;
|
||||||
countGreat = Convert.ToInt32(Score.Statistics[HitResult.Great]);
|
countGreat = Score.Statistics[HitResult.Great];
|
||||||
countGood = Convert.ToInt32(Score.Statistics[HitResult.Good]);
|
countGood = Score.Statistics[HitResult.Good];
|
||||||
countMeh = Convert.ToInt32(Score.Statistics[HitResult.Meh]);
|
countMeh = Score.Statistics[HitResult.Meh];
|
||||||
countMiss = Convert.ToInt32(Score.Statistics[HitResult.Miss]);
|
countMiss = Score.Statistics[HitResult.Miss];
|
||||||
|
|
||||||
// Don't count scores made with supposedly unranked mods
|
// Don't count scores made with supposedly unranked mods
|
||||||
if (mods.Any(m => !m.Ranked))
|
if (mods.Any(m => !m.Ranked))
|
||||||
|
@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
public override double Calculate(Dictionary<string, double> categoryDifficulty = null)
|
public override double Calculate(Dictionary<string, double> categoryDifficulty = null)
|
||||||
{
|
{
|
||||||
mods = Score.Mods;
|
mods = Score.Mods;
|
||||||
countGreat = Convert.ToInt32(Score.Statistics[HitResult.Great]);
|
countGreat = Score.Statistics[HitResult.Great];
|
||||||
countGood = Convert.ToInt32(Score.Statistics[HitResult.Good]);
|
countGood = Score.Statistics[HitResult.Good];
|
||||||
countMeh = Convert.ToInt32(Score.Statistics[HitResult.Meh]);
|
countMeh = Score.Statistics[HitResult.Meh];
|
||||||
countMiss = Convert.ToInt32(Score.Statistics[HitResult.Miss]);
|
countMiss = Score.Statistics[HitResult.Miss];
|
||||||
|
|
||||||
// Don't count scores made with supposedly unranked mods
|
// Don't count scores made with supposedly unranked mods
|
||||||
if (mods.Any(m => !m.Ranked))
|
if (mods.Any(m => !m.Ranked))
|
||||||
|
@ -25,6 +25,6 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// <returns>Whether equivalent.</returns>
|
/// <returns>Whether equivalent.</returns>
|
||||||
public abstract bool EquivalentTo(ControlPoint other);
|
public abstract bool EquivalentTo(ControlPoint other);
|
||||||
|
|
||||||
public bool Equals(ControlPoint other) => Time.Equals(other?.Time) && EquivalentTo(other);
|
public bool Equals(ControlPoint other) => Time == other?.Time && EquivalentTo(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,18 +151,18 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private void updateTooltipText(T value)
|
private void updateTooltipText(T value)
|
||||||
{
|
{
|
||||||
if (CurrentNumber.IsInteger)
|
if (CurrentNumber.IsInteger)
|
||||||
TooltipText = ((int)Convert.ChangeType(value, typeof(int))).ToString("N0");
|
TooltipText = value.ToInt32(NumberFormatInfo.InvariantInfo).ToString("N0");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double floatValue = (double)Convert.ChangeType(value, typeof(double));
|
double floatValue = value.ToDouble(NumberFormatInfo.InvariantInfo);
|
||||||
double floatMinValue = (double)Convert.ChangeType(CurrentNumber.MinValue, typeof(double));
|
double floatMinValue = CurrentNumber.MinValue.ToDouble(NumberFormatInfo.InvariantInfo);
|
||||||
double floatMaxValue = (double)Convert.ChangeType(CurrentNumber.MaxValue, typeof(double));
|
double floatMaxValue = CurrentNumber.MaxValue.ToDouble(NumberFormatInfo.InvariantInfo);
|
||||||
|
|
||||||
if (floatMaxValue == 1 && floatMinValue >= -1)
|
if (floatMaxValue == 1 && floatMinValue >= -1)
|
||||||
TooltipText = floatValue.ToString("P0");
|
TooltipText = floatValue.ToString("P0");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var decimalPrecision = normalise((decimal)Convert.ChangeType(CurrentNumber.Precision, typeof(decimal)), max_decimal_digits);
|
var decimalPrecision = normalise(CurrentNumber.Precision.ToDecimal(NumberFormatInfo.InvariantInfo), max_decimal_digits);
|
||||||
|
|
||||||
// Find the number of significant digits (we could have less than 5 after normalize())
|
// Find the number of significant digits (we could have less than 5 after normalize())
|
||||||
var significantDigits = findPrecision(decimalPrecision);
|
var significantDigits = findPrecision(decimalPrecision);
|
||||||
|
@ -273,14 +273,6 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
return p0 + (p1 - p0) * (float)w;
|
return p0 + (p1 - p0) * (float)w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(SliderPath other)
|
public bool Equals(SliderPath other) => ControlPoints.SequenceEqual(other.ControlPoints) && ExpectedDistance == other.ExpectedDistance && Type == other.Type;
|
||||||
{
|
|
||||||
if (ControlPoints == null && other.ControlPoints != null)
|
|
||||||
return false;
|
|
||||||
if (other.ControlPoints == null && ControlPoints != null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return ControlPoints.SequenceEqual(other.ControlPoints) && ExpectedDistance.Equals(other.ExpectedDistance) && Type == other.Type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,8 +79,8 @@ namespace osu.Game.Screens.Select
|
|||||||
public bool IsUpperInclusive;
|
public bool IsUpperInclusive;
|
||||||
|
|
||||||
public bool Equals(OptionalRange<T> other)
|
public bool Equals(OptionalRange<T> other)
|
||||||
=> Min.Equals(other.Min)
|
=> EqualityComparer<T?>.Default.Equals(Min, other.Min)
|
||||||
&& Max.Equals(other.Max)
|
&& EqualityComparer<T?>.Default.Equals(Max, other.Max)
|
||||||
&& IsLowerInclusive.Equals(other.IsLowerInclusive)
|
&& IsLowerInclusive.Equals(other.IsLowerInclusive)
|
||||||
&& IsUpperInclusive.Equals(other.IsUpperInclusive);
|
&& IsUpperInclusive.Equals(other.IsUpperInclusive);
|
||||||
}
|
}
|
||||||
|
@ -240,6 +240,6 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
set => Objects = value;
|
set => Objects = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Equals(ConvertMapping<TConvertValue> other) => StartTime.Equals(other?.StartTime);
|
public virtual bool Equals(ConvertMapping<TConvertValue> other) => StartTime == other?.StartTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user