1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Merge branch 'master' into catch-banana-shower

This commit is contained in:
Dan Balasescu 2018-01-12 20:00:00 +09:00 committed by GitHub
commit d9c47f98a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 15 deletions

@ -1 +1 @@
Subproject commit a6090d3f6f03eaf9a3f643cf1ef3db96384c62ff
Subproject commit 49b563e2cf170eb19006b98dd5b69c2398362d9e

View File

@ -40,7 +40,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
protected override void AddNested(DrawableHitObject h)
{
((DrawableCatchHitObject)h).CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
var catchObject = (DrawableCatchHitObject)h;
catchObject.CheckPosition = o => CheckPosition?.Invoke(o) ?? false;
catchObject.AccentColour = HitObject.ComboColour;
dropletContainer.Add(h);
base.AddNested(h);
}

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Globalization;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
@ -17,7 +18,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface
{
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip, IHasAccentColour
where T : struct, IEquatable<T>
where T : struct, IEquatable<T>, IComparable, IConvertible
{
private SampleChannel sample;
private double lastSampleTime;
@ -32,18 +33,25 @@ namespace osu.Game.Graphics.UserInterface
get
{
var bindableDouble = CurrentNumber as BindableNumber<double>;
if (bindableDouble != null)
var bindableFloat = CurrentNumber as BindableNumber<float>;
var floatValue = bindableDouble?.Value ?? bindableFloat?.Value;
if (floatValue != null)
{
if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1))
return bindableDouble.Value.ToString(@"P0");
return bindableDouble.Value.ToString(@"n1");
var floatMinValue = bindableDouble?.MinValue ?? bindableFloat.MinValue;
var floatMaxValue = bindableDouble?.MaxValue ?? bindableFloat.MaxValue;
if (floatMaxValue == 1 && (floatMinValue == 0 || floatMinValue == -1))
return floatValue.Value.ToString("P0");
return floatValue.Value.ToString("N1");
}
var bindableInt = CurrentNumber as BindableNumber<int>;
if (bindableInt != null)
return bindableInt.Value.ToString(@"n0");
return bindableInt.Value.ToString("N0");
return Current.Value.ToString();
return Current.Value.ToString(CultureInfo.InvariantCulture);
}
}

View File

@ -4,19 +4,18 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>>
where T : struct, IEquatable<T>
where T : struct, IEquatable<T>, IComparable, IConvertible
{
}
public class SettingsSlider<T, U> : SettingsItem<T>
where T : struct, IEquatable<T>
where U : SliderBar<T>, new()
where T : struct, IEquatable<T>, IComparable, IConvertible
where U : OsuSliderBar<T>, new()
{
protected override Drawable CreateControl() => new U
{

View File

@ -155,7 +155,7 @@ namespace osu.Game.Overlays
loading.Hide();
getUsersRequest?.Cancel();
if (api?.IsLoggedIn == false)
if (api?.IsLoggedIn != true)
return;
switch (Header.Tabs.Current.Value)

View File

@ -11,7 +11,7 @@ using osu.Game.Overlays.Settings;
namespace osu.Game.Screens.Play.ReplaySettings
{
public class ReplaySliderBar<T> : SettingsSlider<T>
where T : struct, IEquatable<T>
where T : struct, IEquatable<T>, IComparable, IConvertible
{
protected override Drawable CreateControl() => new Sliderbar
{
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Play.ReplaySettings
private class Sliderbar : OsuSliderBar<T>
{
public override string TooltipText => $"{CurrentNumber.Value}";
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{