Use generic IEqutable to avoid typeless Equals.

This commit is contained in:
Huo Yaoyuan 2017-05-16 21:49:38 +08:00
parent aaaee5ed10
commit f1d5a92950
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK; using OpenTK;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
@ -13,7 +14,8 @@
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip where T : struct public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip
where T : struct, IEquatable<T>
{ {
private SampleChannel sample; private SampleChannel sample;
private double lastSampleTime; private double lastSampleTime;

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -8,12 +9,12 @@
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>> public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>>
where T : struct where T : struct, IEquatable<T>
{ {
} }
public class SettingsSlider<T, U> : SettingsItem<T> public class SettingsSlider<T, U> : SettingsItem<T>
where T : struct where T : struct, IEquatable<T>
where U : SliderBar<T>, new() where U : SliderBar<T>, new()
{ {
protected override Drawable CreateControl() => new U() protected override Drawable CreateControl() => new U()