1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 05:23:05 +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(@"circles", () => loadHitobjects(HitObjectType.Circle));
AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); 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; BasicSliderBar<double> sliderBar;
Add(new Container Add(new Container
@ -87,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests
switch (mode) switch (mode)
{ {
case HitObjectType.Circle: case HitObjectType.Circle:
const int count = 10; const int count = 1;
for (int i = 0; i < count; i++) 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;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using OpenTK; using OpenTK;
namespace osu.Game.Rulesets.Catch.Objects.Drawable namespace osu.Game.Rulesets.Catch.Objects.Drawable
@ -29,10 +28,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
Texture = textures.Get(@"Menu/logo"); 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); 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) 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() protected override void Update()
@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.Mania.UI
private class TransformTimeSpan : Transform<double, Drawable> private class TransformTimeSpan : Transform<double, Drawable>
{ {
public override double CurrentValue public virtual double CurrentValue
{ {
get get
{ {
@ -259,13 +259,8 @@ namespace osu.Game.Rulesets.Mania.UI
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value;
base.Apply(d);
var p = (ManiaPlayfield)d;
p.visibleTimeRange.Value = (float)CurrentValue;
}
} }
} }
} }

View File

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

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
: base(hitObject) : base(hitObject)
{ {
AccentColour = HitObject.ComboColour; AccentColour = HitObject.ComboColour;
Alpha = 0;
} }
protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 };
@ -25,10 +26,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
Flush(); Flush();
UpdateInitialState();
using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
{ {
UpdateInitialState();
UpdatePreemptState(); UpdatePreemptState();
using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true)) 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() protected virtual void UpdatePreemptState()
@ -45,9 +47,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
FadeIn(TIME_FADEIN); 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) public static void FadeAccent<T>(this T accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None)
where T : Transformable<Drawable>, IHasAccentColour 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> /// <summary>
/// Current value of the transformed colour in linear colour space. /// Current value of the transformed colour in linear colour space.
/// </summary> /// </summary>
public override Color4 CurrentValue public virtual Color4 CurrentValue
{ {
get get
{ {
@ -25,13 +25,7 @@ namespace osu.Game.Graphics.Transforms
} }
} }
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((IHasAccentColour)d).AccentColour = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((IHasAccentColour)d).AccentColour;
base.Apply(d);
var accented = d as IHasAccentColour;
if (accented != null)
accented.AccentColour = CurrentValue;
}
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays
private void updatePosition(float position, bool easing = true) private void updatePosition(float position, bool easing = true)
{ {
position = MathHelper.Clamp(position, 0, 1); 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) protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
@ -100,11 +100,8 @@ namespace osu.Game.Overlays
private class TransformSeek : TransformFloat<Drawable> private class TransformSeek : TransformFloat<Drawable>
{ {
public override void Apply(Drawable d) public override void Apply(Drawable d) => d.Width = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width;
base.Apply(d);
d.Width = CurrentValue;
}
} }
} }
} }

View File

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

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 private enum ScrollState
{ {
@ -310,11 +310,8 @@ namespace osu.Game.Screens.Tournament
public class TransformScrollSpeed : TransformFloat<Drawable> public class TransformScrollSpeed : TransformFloat<Drawable>
{ {
public override void Apply(Drawable d) public override void Apply(Drawable d) => ((ScrollingTeamContainer)d).speed = CurrentValue;
{ public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScrollingTeamContainer)d).speed;
base.Apply(d);
((ScrollingTeamContainer)d).speed = CurrentValue;
}
} }
public class ScrollingTeam : Container public class ScrollingTeam : Container