Fix ReplayLoader not being treated as having a replay loaded

Player checks for HasReplayLoaded in Player.load(), but the replay is attached in ReplayPlayer.LoadComplete(), which is too late.
This commit is contained in:
smoogipoo
2018-01-17 17:37:14 +09:00
parent da793d91ea
commit 2ebb3d6e0e
4 changed files with 41 additions and 14 deletions

View File

@ -9,9 +9,12 @@ using System.Collections.Generic;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Timing;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.UI;
namespace osu.Game.Screens.Play
{
public class SongProgress : OverlayContainer
@ -53,6 +56,8 @@ namespace osu.Game.Screens.Play
}
}
private readonly BindableBool replayLoaded = new BindableBool();
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -92,6 +97,8 @@ namespace osu.Game.Screens.Play
OnSeek = position => OnSeek?.Invoke(position),
},
};
replayLoaded.ValueChanged += v => AllowSeeking = v;
}
protected override void LoadComplete()
@ -99,6 +106,12 @@ namespace osu.Game.Screens.Play
State = Visibility.Visible;
}
public void BindRulestContainer(RulesetContainer rulesetContainer)
{
replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
replayLoaded.TriggerChange();
}
private bool allowSeeking;
public bool AllowSeeking