mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 07:23:20 +08:00
Fix crashes when presenting replays
This commit is contained in:
parent
1ec8790ad2
commit
7c5a227fc5
@ -9,18 +9,25 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class FooterButtonMods : FooterButton
|
public class FooterButtonMods : FooterButton, IHasCurrentValue<IReadOnlyList<Mod>>
|
||||||
{
|
{
|
||||||
public FooterButtonMods(Bindable<IReadOnlyList<Mod>> mods)
|
public Bindable<IReadOnlyList<Mod>> Current
|
||||||
{
|
{
|
||||||
FooterModDisplay modDisplay;
|
get => modDisplay.Current;
|
||||||
|
set => modDisplay.Current = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly FooterModDisplay modDisplay;
|
||||||
|
|
||||||
|
public FooterButtonMods()
|
||||||
|
{
|
||||||
Add(new Container
|
Add(new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -33,9 +40,6 @@ namespace osu.Game.Screens.Select
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Margin = new MarginPadding { Left = 70 }
|
Margin = new MarginPadding { Left = 70 }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mods != null)
|
|
||||||
modDisplay.Current = mods;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -221,11 +221,9 @@ namespace osu.Game.Screens.Select
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
||||||
{
|
{
|
||||||
mods.BindTo(Mods);
|
|
||||||
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(new FooterButtonMods(mods), ModSelect);
|
Footer.AddButton(new FooterButtonMods { Current = mods }, ModSelect);
|
||||||
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
|
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
|
||||||
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
|
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
|
||||||
|
|
||||||
@ -263,6 +261,13 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
mods.BindTo(Mods);
|
||||||
|
}
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
Loading…
Reference in New Issue
Block a user