Re-namespace Counter

This commit is contained in:
smoogipoo
2017-11-06 14:26:38 +09:00
parent 397e0b12c8
commit 9dc798b980
3 changed files with 46 additions and 34 deletions

View File

@@ -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));
}
}

View 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));
}
}

View File

@@ -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" />