1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +08:00

Merge branch 'master' into patch-1

This commit is contained in:
Dan Balasescu 2019-11-15 08:13:01 +09:00 committed by GitHub
commit a52aa88141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 7 deletions

View File

@ -0,0 +1,4 @@
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.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.

View File

@ -14,6 +14,10 @@
<ItemGroup Label="Resources">
<EmbeddedResource Include="Resources\**\*.*" />
</ItemGroup>
<ItemGroup Label="Code Analysis">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="2.9.7" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\BannedSymbols.txt" />
</ItemGroup>
<PropertyGroup Label="Project">
<!-- DeepEqual is not netstandard-compatible. This is fine since we run tests with .NET Framework anyway.
This is required due to https://github.com/NuGet/Home/issues/5740 -->

View File

@ -101,7 +101,7 @@ namespace osu.Game.Online.Leaderboards
get => scope;
set
{
if (value.Equals(scope))
if (EqualityComparer<TScope>.Default.Equals(value, scope))
return;
scope = value;

View File

@ -47,7 +47,7 @@ namespace osu.Game.Overlays
get => beatmapSets;
set
{
if (beatmapSets?.Equals(value) ?? false) return;
if (ReferenceEquals(beatmapSets, value)) return;
beatmapSets = value?.ToList();

View File

@ -38,7 +38,7 @@ namespace osu.Game.Overlays
get => users;
set
{
if (users?.Equals(value) ?? false)
if (ReferenceEquals(users, value))
return;
users = value?.ToList();

View File

@ -102,7 +102,7 @@ namespace osu.Game.Screens.Menu
private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes)
{
d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
d.FadeTo(Math.Max(0, ((ReferenceEquals(d, leftBox) ? amplitudes.LeftChannel : amplitudes.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time)
.Then()
.FadeOut(beatLength, Easing.In);
}

View File

@ -1,6 +1,8 @@
// 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.Collections.Generic;
namespace osu.Game.Screens.Play
{
public class KeyCounterAction<T> : KeyCounter
@ -16,7 +18,7 @@ namespace osu.Game.Screens.Play
public bool OnPressed(T action, bool forwards)
{
if (!action.Equals(Action))
if (!EqualityComparer<T>.Default.Equals(action, Action))
return false;
IsLit = true;
@ -27,7 +29,7 @@ namespace osu.Game.Screens.Play
public bool OnReleased(T action, bool forwards)
{
if (!action.Equals(Action))
if (!EqualityComparer<T>.Default.Equals(action, Action))
return false;
IsLit = false;

View File

@ -405,7 +405,7 @@ namespace osu.Game.Screens.Select
// We may be arriving here due to another component changing the bindable Beatmap.
// In these cases, the other component has already loaded the beatmap, so we don't need to do so again.
if (!Equals(beatmap, Beatmap.Value.BeatmapInfo))
if (!EqualityComparer<BeatmapInfo>.Default.Equals(beatmap, Beatmap.Value.BeatmapInfo))
{
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");