1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Update Cached usage according to framework

This commit is contained in:
Thomas Müller 2017-07-02 13:00:02 +03:00
parent 2ba3c4b87a
commit 2d7eefa6fe
4 changed files with 21 additions and 12 deletions

@ -1 +1 @@
Subproject commit bb8c723ad135a2935a499c45f23c45bd14f3daa4 Subproject commit 85541286b805120b8fa371eea60b15a4bcaff867

View File

@ -113,8 +113,11 @@ namespace osu.Game.Overlays.Toolbar
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();
if (!activeMode.EnsureValid()) if (!activeMode.IsValid)
activeMode.Refresh(() => modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, EasingTypes.OutQuint)); {
modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, EasingTypes.OutQuint);
activeMode.Validate();
}
} }
} }
} }

View File

@ -81,13 +81,8 @@ namespace osu.Game.Rulesets.Timing
} }
private Cached<double> durationBacking = new Cached<double>(); private Cached<double> durationBacking = new Cached<double>();
/// <summary>
/// The maximum duration of any one hit object inside this <see cref="DrawableTimingSection"/>. This is calculated as the maximum private double computeDuration()
/// end time between all hit objects relative to this <see cref="DrawableTimingSection"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
/// </summary>
public double Duration => durationBacking.EnsureValid()
? durationBacking.Value
: durationBacking.Refresh(() =>
{ {
if (!Children.Any()) if (!Children.Any())
return 0; return 0;
@ -117,7 +112,13 @@ namespace osu.Game.Rulesets.Timing
baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize; baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize;
return baseDuration; return baseDuration;
}); }
/// <summary>
/// The maximum duration of any one hit object inside this <see cref="DrawableTimingSection"/>. This is calculated as the maximum
/// end time between all hit objects relative to this <see cref="DrawableTimingSection"/>'s <see cref="MultiplierControlPoint.StartTime"/>.
/// </summary>
public double Duration => durationBacking.IsValid ? durationBacking : (durationBacking.Value = computeDuration());
protected override void Update() protected override void Update()
{ {

View File

@ -77,7 +77,12 @@ namespace osu.Game.Screens.Play
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
layout.Refresh(recreateGraph);
if (!layout.IsValid)
{
recreateGraph();
layout.Validate();
}
} }
/// <summary> /// <summary>