Cache ManiaPlayfield instead

This commit is contained in:
Dean Herbert 2020-04-13 13:42:21 +09:00
parent cdff6060d3
commit c51bad0e35
3 changed files with 5 additions and 7 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
@ -27,18 +26,16 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>(); protected readonly IBindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private Playfield playfield { get; set; } private ManiaPlayfield playfield { get; set; }
protected override float SamplePlaybackPosition protected override float SamplePlaybackPosition
{ {
get get
{ {
var columns = (playfield as ManiaPlayfield)?.TotalColumns; if (playfield == null)
if (columns == null)
return base.SamplePlaybackPosition; return base.SamplePlaybackPosition;
return (float)HitObject.Column / columns.Value; return (float)HitObject.Column / playfield.TotalColumns;
} }
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -14,6 +15,7 @@ using osuTK;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
[Cached]
public class ManiaPlayfield : ScrollingPlayfield public class ManiaPlayfield : ScrollingPlayfield
{ {
private readonly List<Stage> stages = new List<Stage>(); private readonly List<Stage> stages = new List<Stage>();

View File

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