1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

More changes in-line with framework changes.

This commit is contained in:
Dean Herbert 2017-07-10 07:01:25 +09:00
parent f856e89b58
commit 0e2dc9388a
15 changed files with 68 additions and 98 deletions

View File

@ -34,9 +34,9 @@ namespace osu.Desktop.VisualTests.Tests
AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle));
AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider));
AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner));
//AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner));
AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); });
//AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); });
BasicSliderBar<double> sliderBar;
Add(new Container
@ -87,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests
switch (mode)
{
case HitObjectType.Circle:
const int count = 10;
const int count = 1;
for (int i = 0; i < count; i++)
{

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using OpenTK;
namespace osu.Game.Rulesets.Catch.Objects.Drawable
@ -29,10 +28,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{
Texture = textures.Get(@"Menu/logo");
const double duration = 0;
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
//Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
//Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });
Expire(true);
}
}

View File

@ -235,7 +235,7 @@ namespace osu.Game.Rulesets.Mania.UI
private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None)
{
TransformTo(() => visibleTimeRange.Value, newTimeRange, duration, easing, new TransformTimeSpan());
TransformTo(newTimeRange, duration, easing, new TransformTimeSpan());
}
protected override void Update()
@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.Mania.UI
private class TransformTimeSpan : Transform<double, Drawable>
{
public override double CurrentValue
public virtual double CurrentValue
{
get
{
@ -259,13 +259,8 @@ namespace osu.Game.Rulesets.Mania.UI
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
var p = (ManiaPlayfield)d;
p.visibleTimeRange.Value = (float)CurrentValue;
}
public override void Apply(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value;
}
}
}

View File

@ -89,11 +89,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
base.UpdateInitialState();
//sane defaults
ring.Alpha = circle.Alpha = number.Alpha = glow.Alpha = 1;
ApproachCircle.Alpha = 0;
ApproachCircle.Scale = new Vector2(4);
explode.Alpha = 0;
// sane defaults
ring.Show();
circle.Show();
number.Show();
glow.Show();
ApproachCircle.Hide();
ApproachCircle.ScaleTo(new Vector2(4));
explode.Hide();
}
protected override void UpdatePreemptState()
@ -106,43 +110,45 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateCurrentState(ArmedState state)
{
ApproachCircle.FadeOut();
double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime;
double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
double duration = endTime - HitObject.StartTime;
glow.Delay(duration);
glow.FadeOut(400);
using (glow.BeginDelayedSequence(duration))
glow.FadeOut(400);
switch (state)
{
case ArmedState.Idle:
Delay(duration + TIME_PREEMPT);
FadeOut(TIME_FADEOUT);
using (BeginDelayedSequence(duration + TIME_PREEMPT))
FadeOut(TIME_FADEOUT);
Expire(true);
break;
case ArmedState.Miss:
ApproachCircle.FadeOut(50);
FadeOut(TIME_FADEOUT / 5);
Expire();
break;
case ArmedState.Hit:
ApproachCircle.FadeOut(50);
const double flash_in = 40;
flash.FadeTo(0.8f, flash_in);
flash.Delay(flash_in);
flash.FadeOut(100);
using (flash.BeginDelayedSequence(flash_in))
flash.FadeOut(100);
explode.FadeIn(flash_in);
Delay(flash_in, true);
using (BeginDelayedSequence(flash_in, true))
{
//after the flash, we can hide some elements that were behind it
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
//after the flash, we can hide some elements that were behind it
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
FadeOut(800);
ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
}
FadeOut(800);
ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
Expire();
break;
}

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
: base(hitObject)
{
AccentColour = HitObject.ComboColour;
Alpha = 0;
}
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 };
@ -25,10 +26,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
Flush();
UpdateInitialState();
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
{
UpdateInitialState();
UpdatePreemptState();
using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true))
@ -36,8 +37,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
protected virtual void UpdateCurrentState(ArmedState state)
protected virtual void UpdateInitialState()
{
Hide();
}
protected virtual void UpdatePreemptState()
@ -45,9 +47,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
FadeIn(TIME_FADEIN);
}
protected virtual void UpdateInitialState()
protected virtual void UpdateCurrentState(ArmedState state)
{
Alpha = 0;
}
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Graphics
public static void FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
where T : Transformable<Drawable>, IHasAccentColour
{
accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent());
accentedDrawable.TransformTo(newColour, duration, easing, new TransformAccent());
}
}
}

View File

@ -13,7 +13,7 @@ namespace osu.Game.Graphics.Transforms
/// <summary>
/// Current value of the transformed colour in linear colour space.
/// </summary>
public override Color4 CurrentValue
public virtual Color4 CurrentValue
{
get
{
@ -25,13 +25,7 @@ namespace osu.Game.Graphics.Transforms
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
var accented = d as IHasAccentColour;
if (accented != null)
accented.AccentColour = CurrentValue;
}
public override void Apply(Drawable d) => ((IHasAccentColour)d).AccentColour = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((IHasAccentColour)d).AccentColour;
}
}

View File

@ -47,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface
protected class TransformAccuracy : Transform<double, Drawable>
{
public override double CurrentValue
public virtual double CurrentValue
{
get
{
@ -59,11 +59,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
((PercentageCounter)d).DisplayedCount = CurrentValue;
}
public override void Apply(Drawable d) => ((PercentageCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((PercentageCounter)d).DisplayedCount;
}
}
}

View File

@ -210,7 +210,6 @@ namespace osu.Game.Graphics.UserInterface
transform.StartTime = TransformStartTime;
transform.EndTime = TransformStartTime + rollingTotalDuration;
transform.StartValue = currentValue;
transform.EndValue = newValue;
transform.Easing = RollingEasing;

View File

@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface
protected class TransformScore : Transform<double, Drawable>
{
public override double CurrentValue
public virtual double CurrentValue
{
get
{
@ -70,11 +70,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
((ScoreCounter)d).DisplayedCount = CurrentValue;
}
public override void Apply(Drawable d) => ((ScoreCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScoreCounter)d).DisplayedCount;
}
}
}

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
private class TransformCounterCount : Transform<int, Drawable>
{
public override int CurrentValue
public virtual int CurrentValue
{
get
{
@ -51,11 +51,8 @@ namespace osu.Game.Graphics.UserInterface
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
((SimpleComboCounter)d).DisplayedCount = CurrentValue;
}
public override void Apply(Drawable d) => ((SimpleComboCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((SimpleComboCounter)d).DisplayedCount;
}
}
}

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(() => Fill.Width, position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek());
Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek());
}
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -100,11 +100,8 @@ namespace osu.Game.Overlays
private class TransformSeek : TransformFloat<Drawable>
{
public override void Apply(Drawable d)
{
base.Apply(d);
d.Width = CurrentValue;
}
public override void Apply(Drawable d) => d.Width = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width;
}
}
}

View File

@ -198,7 +198,6 @@ namespace osu.Game.Screens.Play.HUD
transform.StartTime = Time.Current;
transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue);
transform.StartValue = currentValue;
transform.EndValue = newValue;
transform.Easing = RollingEasing;
@ -207,7 +206,7 @@ namespace osu.Game.Screens.Play.HUD
protected class TransformComboRoll : Transform<int, Drawable>
{
public override int CurrentValue
public virtual int CurrentValue
{
get
{
@ -219,11 +218,8 @@ namespace osu.Game.Screens.Play.HUD
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
((ComboCounter)d).DisplayedCount = CurrentValue;
}
public override void Apply(Drawable d) => ((ComboCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboCounter)d).DisplayedCount;
}
protected abstract void OnDisplayedCountRolling(int currentValue, int newValue);

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Play.HUD
protected class TransformComboResult : Transform<ulong, Drawable>
{
public override ulong CurrentValue
public virtual ulong CurrentValue
{
get
{
@ -48,11 +48,8 @@ namespace osu.Game.Screens.Play.HUD
}
}
public override void Apply(Drawable d)
{
base.Apply(d);
((ComboResultCounter)d).DisplayedCount = CurrentValue;
}
public override void Apply(Drawable d) => ((ComboResultCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ComboResultCounter)d).DisplayedCount;
}
}
}

View File

@ -297,7 +297,7 @@ namespace osu.Game.Screens.Tournament
}
}
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed());
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(value, duration, easing, new TransformScrollSpeed());
private enum ScrollState
{
@ -310,11 +310,8 @@ namespace osu.Game.Screens.Tournament
public class TransformScrollSpeed : TransformFloat<Drawable>
{
public override void Apply(Drawable d)
{
base.Apply(d);
((ScrollingTeamContainer)d).speed = CurrentValue;
}
public override void Apply(Drawable d) => ((ScrollingTeamContainer)d).speed = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScrollingTeamContainer)d).speed;
}
public class ScrollingTeam : Container