mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
Re-namespace Counter
This commit is contained in:
@@ -80,38 +80,4 @@ namespace osu.Framework.Tests.Visual
|
||||
|
||||
protected override void OnCountChanged() => text.Text = resultFunction(Count);
|
||||
}
|
||||
|
||||
public class Counter : CompositeDrawable
|
||||
{
|
||||
private double count;
|
||||
/// <summary>
|
||||
/// The current count.
|
||||
/// </summary>
|
||||
protected double Count
|
||||
{
|
||||
get { return count; }
|
||||
private set
|
||||
{
|
||||
if (count == value)
|
||||
return;
|
||||
count = value;
|
||||
|
||||
OnCountChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when <see cref="Count"/> has changed.
|
||||
/// </summary>
|
||||
protected virtual void OnCountChanged() { }
|
||||
|
||||
public TransformSequence<Counter> CountTo(double endCount, double duration = 0, Easing easing = Easing.None)
|
||||
=> this.TransformTo(nameof(Count), endCount, duration, easing);
|
||||
}
|
||||
|
||||
public static class CounterTransformSequenceExtensions
|
||||
{
|
||||
public static TransformSequence<Counter> CountTo(this TransformSequence<Counter> t, double endCount, double duration = 0, Easing easing = Easing.None)
|
||||
=> t.Append(o => o.CountTo(endCount, duration, easing));
|
||||
}
|
||||
}
|
||||
|
||||
45
osu.Framework/Graphics/UserInterface/Counter.cs
Normal file
45
osu.Framework/Graphics/UserInterface/Counter.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Framework.Graphics.UserInterface
|
||||
{
|
||||
/// <summary>
|
||||
/// A drawable object that supports counting to values.
|
||||
/// </summary>
|
||||
public class Counter : CompositeDrawable
|
||||
{
|
||||
private double count;
|
||||
/// <summary>
|
||||
/// The current count.
|
||||
/// </summary>
|
||||
protected double Count
|
||||
{
|
||||
get { return count; }
|
||||
private set
|
||||
{
|
||||
if (count == value)
|
||||
return;
|
||||
count = value;
|
||||
|
||||
OnCountChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when <see cref="Count"/> has changed.
|
||||
/// </summary>
|
||||
protected virtual void OnCountChanged() { }
|
||||
|
||||
public TransformSequence<Counter> CountTo(double endCount, double duration = 0, Easing easing = Easing.None)
|
||||
=> this.TransformTo(nameof(Count), endCount, duration, easing);
|
||||
}
|
||||
|
||||
public static class CounterTransformSequenceExtensions
|
||||
{
|
||||
public static TransformSequence<Counter> CountTo(this TransformSequence<Counter> t, double endCount, double duration = 0, Easing easing = Easing.None)
|
||||
=> t.Append(o => o.CountTo(endCount, duration, easing));
|
||||
}
|
||||
}
|
||||
@@ -472,6 +472,7 @@
|
||||
<Compile Include="Allocation\BackgroundDependencyLoader.cs" />
|
||||
<Compile Include="Configuration\BindableNumber.cs" />
|
||||
<Compile Include="Graphics\UserInterface\CircularProgressDrawNode.cs" />
|
||||
<Compile Include="Graphics\UserInterface\Counter.cs" />
|
||||
<Compile Include="Graphics\Containers\TextFlowContainer.cs" />
|
||||
<Compile Include="Graphics\UserInterface\CircularProgress.cs" />
|
||||
<Compile Include="Threading\AudioThread.cs" />
|
||||
|
||||
Reference in New Issue
Block a user