Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency caching according to framework #1048

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c73a1ae
Use TransformTo in rolling counters
Tom94 Jul 14, 2017
b5fbb26
Merge branch 'master' of https://github.com/ppy/osu into better-trans…
Tom94 Jul 14, 2017
fd58c6e
Nicer generic rolling counters
Tom94 Jul 14, 2017
a5e610a
Update framework and fix compilation
Tom94 Jul 14, 2017
5372b94
Remove some unnecessary usings
Tom94 Jul 14, 2017
6063219
Update framework
Tom94 Jul 16, 2017
71105bb
Delay -> ApplyDelay; DelayReset -> ResetDelay
Tom94 Jul 16, 2017
9922126
Replace several usages of BeginDelayedSequence with LINQ-style
Tom94 Jul 16, 2017
032e9df
ApplyDelay -> AddDelay
Tom94 Jul 16, 2017
e6916ec
Update framework
Tom94 Jul 16, 2017
19fb03e
Try different formatting style
Tom94 Jul 16, 2017
87bcd52
Get rid of raw AddDelay calls within osu.Game
Tom94 Jul 17, 2017
546efc0
Get rid of AddDelay & ResetDelay in osu.Game.Rulesets.Osu
Tom94 Jul 17, 2017
4408789
Remove remaining usages of AddDelay
Tom94 Jul 17, 2017
4d8261f
Merge branch 'master' of https://github.com/ppy/osu into better-trans…
Tom94 Jul 18, 2017
ed79332
Update framework
Tom94 Jul 18, 2017
b40c897
Fix osu logo shockwave playing when transition is aborted
Tom94 Jul 18, 2017
3ba119c
Ensure toolbar disappears when osu logo transition is cancelled
Tom94 Jul 18, 2017
c4619f6
Merge branch 'master' of github.com:ppy/osu into better-transforms
Tom94 Jul 19, 2017
2cd8f6b
Merge branch 'master' of github.com:ppy/osu into better-transforms
Tom94 Jul 21, 2017
a7dc8a8
Update framework
Tom94 Jul 21, 2017
0f2bcb2
Update framework
Tom94 Jul 21, 2017
e469a11
Update dependency caching according to framework
Tom94 Jul 21, 2017
4755529
Minor refactor of TestCaseBeatSyncedContainer
Tom94 Jul 22, 2017
e36b65b
Merge branch 'master' into better-transforms
Tom94 Jul 22, 2017
95684f7
Merge branch 'master' of github.com:ppy/osu into prevent-dependency-p…
Tom94 Jul 22, 2017
a4dfe3f
Update framework
Tom94 Jul 22, 2017
dae0f61
Don't obtain DependencyContainer via DI
Tom94 Jul 22, 2017
598b3f0
Address CI concerns and update framework
Tom94 Jul 22, 2017
750fc0d
Merge branch 'prevent-dependency-pollution' of github.com:Tom94/osu i…
Tom94 Jul 22, 2017
7e895f6
Don't obtain DependencyContainer via DI
Tom94 Jul 22, 2017
9667596
Fix broken test case
Tom94 Jul 22, 2017
a7c6dec
Merge branch 'better-transforms' of github.com:Tom94/osu into prevent…
Tom94 Jul 22, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu-framework
Submodule osu-framework updated 58 files
+8 −8 osu.Framework.VisualTests/Tests/TestCaseBufferedContainer.cs
+1 −1 osu.Framework.VisualTests/Tests/TestCaseCheckboxes.cs
+10 −18 osu.Framework.VisualTests/Tests/TestCaseContextMenu.cs
+2 −2 osu.Framework.VisualTests/Tests/TestCaseMasking.cs
+5 −7 osu.Framework.VisualTests/Tests/TestCaseScrollableFlow.cs
+2 −2 osu.Framework.VisualTests/Tests/TestCaseSearchContainer.cs
+11 −56 osu.Framework.VisualTests/Tests/TestCaseSizing.cs
+112 −28 osu.Framework.VisualTests/Tests/TestCaseTransformSequence.cs
+25 −23 osu.Framework/Allocation/DependencyContainer.cs
+42 −0 osu.Framework/Allocation/IReadOnlyDependencyContainer.cs
+15 −0 osu.Framework/Allocation/InvokeOnDisposal.cs
+5 −0 osu.Framework/Audio/Track/TrackVirtual.cs
+1 −1 osu.Framework/Configuration/BindableNumber.cs
+9 −4 osu.Framework/Game.cs
+2 −17 osu.Framework/Graphics/Containers/BufferedContainer.cs
+75 −131 osu.Framework/Graphics/Containers/CompositeDrawable.cs
+1 −40 osu.Framework/Graphics/Containers/Container.cs
+1 −13 osu.Framework/Graphics/Containers/FillFlowContainer.cs
+4 −1 osu.Framework/Graphics/Containers/IBufferedContainer.cs
+12 −2 osu.Framework/Graphics/Containers/IContainer.cs
+12 −0 osu.Framework/Graphics/Containers/IFillFlowContainer.cs
+4 −4 osu.Framework/Graphics/Containers/ScrollContainer.cs
+1 −1 osu.Framework/Graphics/Containers/VisibilityContainer.cs
+2 −2 osu.Framework/Graphics/Cursor/TooltipContainer.cs
+24 −136 osu.Framework/Graphics/Drawable.cs
+2 −1 osu.Framework/Graphics/IDrawable.cs
+2 −7 osu.Framework/Graphics/Performance/FpsDisplay.cs
+3 −3 osu.Framework/Graphics/Performance/FrameStatisticsDisplay.cs
+2 −2 osu.Framework/Graphics/Performance/PerformanceOverlay.cs
+4 −0 osu.Framework/Graphics/Textures/TextureAtlas.cs
+236 −0 osu.Framework/Graphics/TransformSequenceExtensions.cs
+323 −0 osu.Framework/Graphics/TransformableExtensions.cs
+0 −47 osu.Framework/Graphics/Transforms/ITransform.cs
+20 −0 osu.Framework/Graphics/Transforms/ITransformable.cs
+50 −42 osu.Framework/Graphics/Transforms/Transform.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformAlpha.cs
+0 −32 osu.Framework/Graphics/Transforms/TransformColour.cs
+185 −0 osu.Framework/Graphics/Transforms/TransformCustom.cs
+34 −0 osu.Framework/Graphics/Transforms/TransformEdgeEffectColour.cs
+0 −22 osu.Framework/Graphics/Transforms/TransformFloat.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformPosition.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformPositionX.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformPositionY.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformRotation.cs
+0 −11 osu.Framework/Graphics/Transforms/TransformScale.cs
+420 −0 osu.Framework/Graphics/Transforms/TransformSequence.cs
+0 −23 osu.Framework/Graphics/Transforms/TransformSize.cs
+0 −23 osu.Framework/Graphics/Transforms/TransformVector.cs
+185 −155 osu.Framework/Graphics/Transforms/Transformable.cs
+6 −10 osu.Framework/Graphics/UserInterface/TextBox.cs
+2 −2 osu.Framework/Graphics/Visualisation/DrawVisualiser.cs
+3 −5 osu.Framework/Graphics/Visualisation/LogOverlay.cs
+2 −2 osu.Framework/Graphics/Visualisation/PropertyDisplay.cs
+2 −3 osu.Framework/Graphics/Visualisation/TreeContainer.cs
+0 −1 osu.Framework/Lists/SortedList.cs
+34 −0 osu.Framework/MathUtils/Interpolation.cs
+3 −3 osu.Framework/Threading/Scheduler.cs
+8 −11 osu.Framework/osu.Framework.csproj
4 changes: 1 addition & 3 deletions osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint,
beatsPerMinute.Value = 60000 / timingPoint.BeatLength;
adjustedBeatLength.Value = timingPoint.BeatLength;

flashLayer.ClearTransforms();
flashLayer.FadeTo(1);
flashLayer.FadeTo(0, timingPoint.BeatLength);
flashLayer.FadeOutFromOne(timingPoint.BeatLength);
}
}

Expand Down
29 changes: 11 additions & 18 deletions osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,13 @@ protected override void LoadComplete()
{
base.LoadComplete();

using (container.BeginLoopedSequence())
{
container.MoveTo(new Vector2(0, 100), duration);
using (container.BeginDelayedSequence(duration))
{
container.MoveTo(new Vector2(100, 100), duration);
using (container.BeginDelayedSequence(duration))
{
container.MoveTo(new Vector2(100, 0), duration);
using (container.BeginDelayedSequence(duration))
container.MoveTo(Vector2.Zero, duration);
}
}
}
// Move box along a square trajectory
container.Loop(c => c
.MoveTo(new Vector2(0, 100), duration).Then()
.MoveTo(new Vector2(100, 100), duration).Then()
.MoveTo(new Vector2(100, 0), duration).Then()
.MoveTo(Vector2.Zero, duration)
);
}

private class MyContextMenuContainer : Container, IHasContextMenu
Expand All @@ -95,10 +88,10 @@ private class AnotherContextMenuContainer : Container, IHasContextMenu
{
new OsuContextMenuItem(@"Simple option"),
new OsuContextMenuItem(@"Simple very very long option"),
new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted) { Action = () => this.ResizeWidthTo(Width * 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted) { Action = () => this.ResizeHeightTo(Height * 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive) { Action = () => this.ResizeWidthTo(Width / 2, 100, EasingTypes.OutQuint) },
new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive) { Action = () => this.ResizeHeightTo(Height / 2, 100, EasingTypes.OutQuint) },
};
}
}
Expand Down
5 changes: 1 addition & 4 deletions osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ private void sendBarrage(int remaining = 100)
}

if (remaining > 0)
{
Delay(80);
Schedule(() => sendBarrage(remaining - 1));
}
Scheduler.AddDelayed(() => sendBarrage(remaining - 1), 80);
}

protected override void Update()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public TestDrawableHitObject(HitObject hitObject)
protected override void LoadComplete()
{
base.LoadComplete();
FadeInFromZero(250, EasingTypes.OutQuint);
this.FadeInFromZero(250, EasingTypes.OutQuint);
}

protected override void Update()
Expand Down
8 changes: 5 additions & 3 deletions osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public TestCaseTaikoPlayfield()

private void changePlayfieldSize(int step)
{
double delay = 0;

// Add new hits
switch (step)
{
Expand All @@ -84,18 +86,18 @@ private void changePlayfieldSize(int step)
break;
case 5:
addSwell(1000);
playfieldContainer.Delay(scroll_time - 100);
delay = scroll_time - 100;
break;
}

// Tween playfield height
switch (step)
{
default:
playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500);
playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, rng.Next(25, 400)), 500);
break;
case 6:
playfieldContainer.ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500);
playfieldContainer.Delay(delay).ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Desktop/Overlays/VersionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgr

protected override void PopIn()
{
FadeIn(1000);
this.FadeIn(1000);
}

protected override void PopOut()
Expand Down
22 changes: 1 addition & 21 deletions osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using System.Collections.Generic;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Input;
using osu.Framework.Graphics.Transforms;
using osu.Framework.MathUtils;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Timing;
using osu.Framework.Configuration;
Expand Down Expand Up @@ -235,7 +233,7 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

private void transformVisibleTimeRangeTo(double newTimeRange, double duration = 0, EasingTypes easing = EasingTypes.None)
{
TransformTo(newTimeRange, duration, easing, new TransformTimeSpan());
this.TransformTo(nameof(visibleTimeRange), newTimeRange, duration, easing);
}

protected override void Update()
Expand All @@ -244,23 +242,5 @@ protected override void Update()
// 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 : Transform<double, Drawable>
{
public double 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(Drawable d) => ((ManiaPlayfield)d).visibleTimeRange.Value = (float)CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ManiaPlayfield)d).visibleTimeRange.Value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ private void update()

fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out);

fp.Delay(fadeOutTime - fadeInTime);
fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN);
fp.Delay(fadeOutTime - fadeInTime).FadeOut(DrawableOsuHitObject.TIME_FADEIN);
}

fp.Expire(true);
Expand Down
19 changes: 8 additions & 11 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,26 @@ protected override void UpdateCurrentState(ArmedState state)
{
double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime;

using (glow.BeginDelayedSequence(duration))
glow.FadeOut(400);
glow.Delay(duration).FadeOut(400);

switch (state)
{
case ArmedState.Idle:
using (BeginDelayedSequence(duration + TIME_PREEMPT))
FadeOut(TIME_FADEOUT);
this.Delay(duration + TIME_PREEMPT).FadeOut(TIME_FADEOUT);
Expire(true);
break;
case ArmedState.Miss:
ApproachCircle.FadeOut(50);
FadeOut(TIME_FADEOUT / 5);
this.FadeOut(TIME_FADEOUT / 5);
Expire();
break;
case ArmedState.Hit:
ApproachCircle.FadeOut(50);

const double flash_in = 40;

flash.FadeTo(0.8f, flash_in);
using (flash.BeginDelayedSequence(flash_in))
flash.FadeOut(100);
flash.FadeTo(0.8f, flash_in)
.Then()
.FadeOut(100);

explode.FadeIn(flash_in);

Expand All @@ -145,8 +142,8 @@ protected override void UpdateCurrentState(ArmedState state)
circle.FadeOut();
number.FadeOut();

FadeOut(800);
ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
this.FadeOut(800)
.ScaleTo(Scale * 1.5f, 400, EasingTypes.OutQuad);
}

Expire();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.ComponentModel;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Framework.Graphics;

namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
Expand All @@ -24,7 +25,7 @@ protected DrawableOsuHitObject(OsuHitObject hitObject)

protected sealed override void UpdateState(ArmedState state)
{
Flush();
FinishTransforms();

using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true))
{
Expand All @@ -44,7 +45,7 @@ protected virtual void UpdateInitialState()

protected virtual void UpdatePreemptState()
{
FadeIn(TIME_FADEIN);
this.FadeIn(TIME_FADEIN);
}

protected virtual void UpdateCurrentState(ArmedState state)
Expand Down
14 changes: 7 additions & 7 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ protected override void UpdateCurrentState(ArmedState state)
{
ball.FadeIn();

Delay(slider.Duration, true);

body.FadeOut(160);
ball.FadeOut(160);

FadeOut(800);
using (BeginDelayedSequence(slider.Duration, true))
{
body.FadeOut(160);
ball.FadeOut(160);

Expire();
this.FadeOut(800)
.Expire();
}
}

public Drawable ProxiedLayer => initialCircle.ApproachCircle;
Expand Down
25 changes: 11 additions & 14 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,28 @@ protected override void UpdatePreemptState()
{
var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime);

ScaleTo(0.5f);
ScaleTo(1.2f, animIn);
FadeIn(animIn);

Delay(animIn);
ScaleTo(1, 150, EasingTypes.Out);

Delay(-animIn);
this.Animate(
d => d.FadeIn(animIn),
d => d.ScaleTo(0.5f).ScaleTo(1.2f, animIn)
).Then(
d => d.ScaleTo(1, 150, EasingTypes.Out)
);
}

protected override void UpdateCurrentState(ArmedState state)
{
switch (state)
{
case ArmedState.Idle:
Delay(FadeOutTime - sliderTick.StartTime);
FadeOut();
this.Delay(FadeOutTime - sliderTick.StartTime).FadeOut();
break;
case ArmedState.Miss:
FadeOut(160);
FadeColour(Color4.Red, 80);
this.FadeOut(160)
.FadeColour(Color4.Red, 80);
break;
case ArmedState.Hit:
FadeOut(120, EasingTypes.OutQuint);
ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint);
this.FadeOut(120, EasingTypes.OutQuint)
.ScaleTo(Scale * 1.5f, 120, EasingTypes.OutQuint);
break;
}
}
Expand Down
22 changes: 10 additions & 12 deletions osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,30 +189,28 @@ protected override void UpdatePreemptState()
disc.RotateTo(-720);
symbol.RotateTo(-720);

mainContainer.ScaleTo(0);
mainContainer.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint);

mainContainer.Delay(TIME_PREEMPT - 150);
mainContainer.ScaleTo(1, 500, EasingTypes.OutQuint);
mainContainer
.ScaleTo(0)
.ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, EasingTypes.OutQuint)
.Then()
.ScaleTo(1, 500, EasingTypes.OutQuint);
}

protected override void UpdateCurrentState(ArmedState state)
{
Delay(spinner.Duration, true);

FadeOut(160);
var sequence = this.Delay(spinner.Duration).FadeOut(160);

switch (state)
{
case ArmedState.Hit:
ScaleTo(Scale * 1.2f, 320, EasingTypes.Out);
Expire();
sequence.ScaleTo(Scale * 1.2f, 320, EasingTypes.Out);
break;
case ArmedState.Miss:
ScaleTo(Scale * 0.8f, 320, EasingTypes.In);
Expire();
sequence.ScaleTo(Scale * 0.8f, 320, EasingTypes.In);
break;
}

Expire();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public SliderBouncer(Slider slider, bool isEnd)
protected override void LoadComplete()
{
base.LoadComplete();
using (icon.BeginLoopedSequence())
icon.RotateTo(360, 1000);
icon.Spin(1000, RotationDirection.Clockwise);
}

public void UpdateProgress(double progress, int repeat)
Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Input;
using osu.Game.Graphics;
using OpenTK;
Expand Down Expand Up @@ -127,13 +126,14 @@ protected override void Update()

if (Complete && updateCompleteTick())
{
background.Flush(flushType: typeof(TransformAlpha));
background.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo);
background.Delay(60);
background.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint);
background.FinishTransforms(false, nameof(Alpha));
background
.FadeTo(tracking_alpha + 0.2f, 60, EasingTypes.OutExpo)
.Then()
.FadeTo(tracking_alpha, 250, EasingTypes.OutQuint);
}

RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo);
this.RotateTo(currentRotation / 2, validAndTracking ? 500 : 1500, EasingTypes.OutExpo);
}
}
}
Loading