1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +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) 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); dropletContainer.Add(h);
base.AddNested(h); base.AddNested(h);
} }

View File

@ -2,6 +2,7 @@
// 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 System;
using System.Globalization;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -17,7 +18,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip, IHasAccentColour public class OsuSliderBar<T> : SliderBar<T>, IHasTooltip, IHasAccentColour
where T : struct, IEquatable<T> where T : struct, IEquatable<T>, IComparable, IConvertible
{ {
private SampleChannel sample; private SampleChannel sample;
private double lastSampleTime; private double lastSampleTime;
@ -32,18 +33,25 @@ namespace osu.Game.Graphics.UserInterface
get get
{ {
var bindableDouble = CurrentNumber as BindableNumber<double>; 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)) var floatMinValue = bindableDouble?.MinValue ?? bindableFloat.MinValue;
return bindableDouble.Value.ToString(@"P0"); var floatMaxValue = bindableDouble?.MaxValue ?? bindableFloat.MaxValue;
return bindableDouble.Value.ToString(@"n1");
if (floatMaxValue == 1 && (floatMinValue == 0 || floatMinValue == -1))
return floatValue.Value.ToString("P0");
return floatValue.Value.ToString("N1");
} }
var bindableInt = CurrentNumber as BindableNumber<int>; var bindableInt = CurrentNumber as BindableNumber<int>;
if (bindableInt != null) 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 System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
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, IEquatable<T> where T : struct, IEquatable<T>, IComparable, IConvertible
{ {
} }
public class SettingsSlider<T, U> : SettingsItem<T> public class SettingsSlider<T, U> : SettingsItem<T>
where T : struct, IEquatable<T> where T : struct, IEquatable<T>, IComparable, IConvertible
where U : SliderBar<T>, new() where U : OsuSliderBar<T>, new()
{ {
protected override Drawable CreateControl() => new U protected override Drawable CreateControl() => new U
{ {

View File

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

View File

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