mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 05:23:05 +08:00
Add tooltip to sliderbars. Move interface.
This commit is contained in:
parent
ce5763ed97
commit
c87657707f
@ -19,7 +19,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
TooltipSlider slider;
|
OsuSliderBar<int> slider;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Text = "a box with a tooltip",
|
Text = "a box with a tooltip",
|
||||||
Size = new Vector2(300,30),
|
Size = new Vector2(300,30),
|
||||||
},
|
},
|
||||||
slider = new TooltipSlider
|
slider = new OsuSliderBar<int>
|
||||||
{
|
{
|
||||||
Width = 300,
|
Width = 300,
|
||||||
},
|
},
|
||||||
@ -75,10 +75,5 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
public string TooltipText => Text;
|
public string TooltipText => Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TooltipSlider : OsuSliderBar<int>, IHasTooltip
|
|
||||||
{
|
|
||||||
public string TooltipText => Current.Value.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
namespace osu.Game.Graphics
|
||||||
{
|
{
|
||||||
public interface IHasTooltip : IDrawable
|
public interface IHasTooltip : IDrawable
|
||||||
{
|
{
|
@ -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;
|
||||||
@ -12,7 +13,7 @@ using osu.Framework.Input;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuSliderBar<U> : SliderBar<U> where U : struct
|
public class OsuSliderBar<U> : SliderBar<U>, IHasTooltip where U : struct
|
||||||
{
|
{
|
||||||
private SampleChannel sample;
|
private SampleChannel sample;
|
||||||
private double lastSampleTime;
|
private double lastSampleTime;
|
||||||
@ -21,6 +22,8 @@ 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 OsuSliderBar()
|
public OsuSliderBar()
|
||||||
{
|
{
|
||||||
Height = 12;
|
Height = 12;
|
||||||
|
@ -88,12 +88,12 @@
|
|||||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||||
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
|
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
|
||||||
<Compile Include="Graphics\IHasAccentColour.cs" />
|
<Compile Include="Graphics\IHasAccentColour.cs" />
|
||||||
|
<Compile Include="Graphics\IHasTooltip.cs" />
|
||||||
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
|
||||||
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
|
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Bar.cs" />
|
<Compile Include="Graphics\UserInterface\Bar.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />
|
||||||
<Compile Include="Graphics\Cursor\IHasTooltip.cs" />
|
|
||||||
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
<Compile Include="Graphics\UserInterface\Nub.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuMenu.cs" />
|
<Compile Include="Graphics\UserInterface\OsuMenu.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
|
<Compile Include="Graphics\UserInterface\OsuPasswordTextBox.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user