1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 02:32:59 +08:00

Update framework

This commit is contained in:
Thomas Müller 2017-07-16 13:59:26 +03:00
parent 5372b94674
commit 6063219b72
11 changed files with 15 additions and 120 deletions

@ -1 +1 @@
Subproject commit cb2c9dd8b6213cd8f91cc37892da6335ca3bce10
Subproject commit 1b650814183065be20f10d7df7dce2045cad754e

View File

@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.Mania.UI
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None)
{
this.TransformTo(newTimeRange, duration, easing, new TransformTimeSpan(this));
this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing);
}
protected override void Update()
@ -243,15 +243,5 @@ namespace osu.Game.Rulesets.Mania.UI
// While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually
barLineContainer.Width = columns.Width;
}
private class TransformTimeSpan : TransformDouble<ManiaPlayfield>
{
public TransformTimeSpan(ManiaPlayfield target) : base(target)
{
}
public override void Apply(ManiaPlayfield d) => d.visibleTimeRange.Value = CurrentValue;
public override void ReadIntoStartValue(ManiaPlayfield d) => StartValue = d.visibleTimeRange.Value;
}
}
}

View File

@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected sealed override void UpdateState(ArmedState state)
{
Flush();
DelayReset();
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
{

View File

@ -127,7 +127,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
if (Complete && updateCompleteTick())
{
background.Flush(flushType: typeof(TransformAlpha));
background.Flush(false, nameof(Alpha));
background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo);
background.Delay(60);
background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint);

View File

@ -4,7 +4,6 @@
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics.Transforms;
namespace osu.Game.Graphics
{
@ -27,8 +26,8 @@ namespace osu.Game.Graphics
/// <param name="newColour">The new accent colour.</param>
/// <param name="duration">The tween duration.</param>
/// <param name="easing">The tween easing.</param>
public static TransformContinuation<T> FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
public static TransformSequence<T> FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
where T : IHasAccentColour
=> accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent(accentedDrawable));
=> accentedDrawable.TransformTo(nameof(accentedDrawable.AccentColour), newColour, duration, easing);
}
}

View File

@ -1,34 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Framework.MathUtils;
namespace osu.Game.Graphics.Transforms
{
public class TransformAccent : Transform<Color4, IHasAccentColour>
{
public TransformAccent(IHasAccentColour target) : base(target)
{
}
/// <summary>
/// Current value of the transformed colour in linear colour space.
/// </summary>
public virtual Color4 CurrentValue
{
get
{
double time = Time?.Current ?? 0;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
public override void Apply(IHasAccentColour d) => d.AccentColour = CurrentValue;
public override void ReadIntoStartValue(IHasAccentColour d) => StartValue = d.AccentColour;
}
}

View File

@ -127,7 +127,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public virtual void StopRolling()
{
Flush(false, typeof(TransformRollingCounter));
Flush(false, nameof(DisplayedCount));
DisplayedCount = Current;
}
@ -173,44 +173,13 @@ namespace osu.Game.Graphics.UserInterface
/// <param name="newValue">Expected count value after modification-</param>
/// <seealso cref="TransformType"/>
protected virtual void TransformCount(T currentValue, T newValue)
{
TransformCount(new TransformRollingCounter(this), currentValue, newValue);
}
/// <summary>
/// Intended to be used by TransformCount(T currentValue, T newValue).
/// </summary>
protected void TransformCount(TransformRollingCounter transform, T currentValue, T newValue)
{
double rollingTotalDuration =
IsRollingProportional
? GetProportionalDuration(currentValue, newValue)
: RollingDuration;
this.TransformTo(newValue, rollingTotalDuration, RollingEasing, transform);
}
protected class TransformRollingCounter : Transform<T, RollingCounter<T>>
{
public TransformRollingCounter(RollingCounter<T> target) : base(target)
{
}
public T CurrentValue
{
get
{
double time = Time?.Current ?? 0;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
double result = Interpolation.ValueAt(time, Convert.ToDouble(StartValue), Convert.ToDouble(EndValue), StartTime, EndTime, Easing);
return (T)Convert.ChangeType(result, typeof(T), null);
}
}
public override void Apply(RollingCounter<T> d) => d.DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(RollingCounter<T> d) => StartValue = d.DisplayedCount;
this.TransformTo(nameof(DisplayedCount), newValue, rollingTotalDuration, RollingEasing);
}
}
}

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays
private void updatePosition(float position, bool easing = true)
{
position = MathHelper.Clamp(position, 0, 1);
Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek(this));
Fill.ResizeWidthTo(position, easing ? 200 : 0, EasingTypes.OutQuint);
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -97,15 +97,5 @@ namespace osu.Game.Overlays
IsSeeking = false;
return true;
}
private class TransformSeek : TransformFloat<Drawable>
{
public TransformSeek(Drawable target) : base(target)
{
}
public override void Apply(Drawable d) => d.Width = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width;
}
}
}

View File

@ -129,7 +129,7 @@ namespace osu.Game.Screens.Play.HUD
protected virtual void OnCountRolling(int currentValue, int newValue)
{
transformRoll(new TransformComboRoll(this), currentValue, newValue);
transformRoll(currentValue, newValue);
}
protected virtual void OnCountIncrement(int currentValue, int newValue)
@ -169,7 +169,7 @@ namespace osu.Game.Screens.Play.HUD
if (!rolling)
{
Flush(false, typeof(TransformComboRoll));
Flush(false, nameof(DisplayedCount));
IsRolling = false;
DisplayedCount = prev;
@ -185,19 +185,9 @@ namespace osu.Game.Screens.Play.HUD
}
}
private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
private void transformRoll(int currentValue, int newValue)
{
this.TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll(this));
}
protected class TransformComboRoll : TransformInt<ComboCounter>
{
public TransformComboRoll(ComboCounter target) : base(target)
{
}
public override void Apply(ComboCounter d) => d.DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(ComboCounter d) => StartValue = d.DisplayedCount;
this.TransformTo(nameof(DisplayedCount), newValue, getProportionalDuration(currentValue, newValue), RollingEasing);
}
protected abstract void OnDisplayedCountRolling(int currentValue, int newValue);

View File

@ -297,7 +297,8 @@ namespace osu.Game.Screens.Tournament
}
}
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => this.TransformTo(value, duration, easing, new TransformScrollSpeed(this));
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) =>
this.TransformTo(nameof(speed), value, duration, easing);
private enum ScrollState
{
@ -308,16 +309,6 @@ namespace osu.Game.Screens.Tournament
Scrolling
}
public class TransformScrollSpeed : TransformFloat<ScrollingTeamContainer>
{
public TransformScrollSpeed(ScrollingTeamContainer target) : base(target)
{
}
public override void Apply(ScrollingTeamContainer d) => d.speed = CurrentValue;
public override void ReadIntoStartValue(ScrollingTeamContainer d) => StartValue = d.speed;
}
public class ScrollingTeam : Container
{
public const float WIDTH = 58;

View File

@ -119,7 +119,6 @@
<Compile Include="Graphics\Cursor\GameplayCursor.cs" />
<Compile Include="Graphics\IHasAccentColour.cs" />
<Compile Include="Graphics\Sprites\OsuSpriteText.cs" />
<Compile Include="Graphics\Transforms\TransformAccent.cs" />
<Compile Include="Graphics\UserInterface\BackButton.cs" />
<Compile Include="Graphics\UserInterface\Bar.cs" />
<Compile Include="Graphics\UserInterface\FocusedTextBox.cs" />