Resolve equals usages.

This commit is contained in:
Huo Yaoyuan 2019-11-13 22:35:50 +08:00
parent f90a9db2b2
commit 87d40cf8d0
6 changed files with 9 additions and 7 deletions

View File

@ -101,7 +101,7 @@ public TScope Scope
get => scope; get => scope;
set set
{ {
if (value.Equals(scope)) if (EqualityComparer<TScope>.Default.Equals(value, scope))
return; return;
scope = value; scope = value;

View File

@ -47,7 +47,7 @@ public IEnumerable<BeatmapSetInfo> BeatmapSets
get => beatmapSets; get => beatmapSets;
set set
{ {
if (beatmapSets?.Equals(value) ?? false) return; if (beatmapSets?.SequenceEqual(value) ?? false) return;
beatmapSets = value?.ToList(); beatmapSets = value?.ToList();

View File

@ -38,7 +38,7 @@ public IEnumerable<User> Users
get => users; get => users;
set set
{ {
if (users?.Equals(value) ?? false) if (users?.SequenceEqual(value) ?? false)
return; return;
users = value?.ToList(); users = value?.ToList();

View File

@ -102,7 +102,7 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,
private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) 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() .Then()
.FadeOut(beatLength, Easing.In); .FadeOut(beatLength, Easing.In);
} }

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
public class KeyCounterAction<T> : KeyCounter public class KeyCounterAction<T> : KeyCounter
@ -16,7 +18,7 @@ public KeyCounterAction(T action)
public bool OnPressed(T action, bool forwards) public bool OnPressed(T action, bool forwards)
{ {
if (!action.Equals(Action)) if (!EqualityComparer<T>.Default.Equals(action, Action))
return false; return false;
IsLit = true; IsLit = true;
@ -27,7 +29,7 @@ public bool OnPressed(T action, bool forwards)
public bool OnReleased(T action, bool forwards) public bool OnReleased(T action, bool forwards)
{ {
if (!action.Equals(Action)) if (!EqualityComparer<T>.Default.Equals(action, Action))
return false; return false;
IsLit = false; IsLit = false;

View File

@ -405,7 +405,7 @@ void run()
// We may be arriving here due to another component changing the bindable Beatmap. // 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. // 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 (!beatmap.Equals(Beatmap.Value.BeatmapInfo))
{ {
Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\""); Logger.Log($"beatmap changed from \"{Beatmap.Value.BeatmapInfo}\" to \"{beatmap}\"");