mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add basic tooltip support to OsuSliderBar.
This commit is contained in:
@ -7,8 +7,8 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Graphics.Cursor;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
// 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;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
@ -22,7 +22,25 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
private readonly Box rightBox;
|
private readonly Box rightBox;
|
||||||
|
|
||||||
public string TooltipText => Current.Value.ToString();
|
public string TooltipText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var bindableDouble = CurrentNumber as BindableNumber<double>;
|
||||||
|
if (bindableDouble != null)
|
||||||
|
{
|
||||||
|
if (bindableDouble.MaxValue == 1 && bindableDouble.MinValue == 0)
|
||||||
|
return bindableDouble.Value.ToString(@"P0");
|
||||||
|
return bindableDouble.Value.ToString(@"n1");
|
||||||
|
}
|
||||||
|
|
||||||
|
var bindableInt = CurrentNumber as BindableNumber<int>;
|
||||||
|
if (bindableInt != null)
|
||||||
|
return bindableInt.Value.ToString(@"n0");
|
||||||
|
|
||||||
|
return Current.Value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public OsuSliderBar()
|
public OsuSliderBar()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user