1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Remove recursive hierarchy traversal for mania sample balance

This commit is contained in:
Dean Herbert 2020-04-13 13:01:27 +09:00
parent 65b96079a0
commit cdff6060d3
2 changed files with 10 additions and 7 deletions

View File

@ -5,10 +5,10 @@ using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
@ -26,17 +26,19 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
[Resolved(canBeNull: true)]
private Playfield playfield { get; set; }
protected override float SamplePlaybackPosition
{
get
{
CompositeDrawable stage = this;
while (!(stage is Stage))
stage = stage.Parent;
var columns = (playfield as ManiaPlayfield)?.TotalColumns;
var columnCount = ((Stage)stage).Columns.Count;
var columnIndex = HitObject.Column;
return 0.8f * columnIndex / (columnCount - 1) - 0.4f;
if (columns == null)
return base.SamplePlaybackPosition;
return (float)HitObject.Column / columns.Value;
}
}

View File

@ -15,6 +15,7 @@ using osuTK;
namespace osu.Game.Rulesets.UI
{
[Cached]
public abstract class Playfield : CompositeDrawable
{
/// <summary>