1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 02:32:55 +08:00

Change BeatmapAttributesDisplay retrieval to proper method

This commit is contained in:
Salman Ahmed 2024-02-23 16:59:08 +03:00
parent 918577d530
commit 323d7f8e2d
2 changed files with 33 additions and 39 deletions

View File

@ -130,13 +130,6 @@ namespace osu.Game.Overlays.Mods
private RankingInformationDisplay? rankingInformationDisplay; private RankingInformationDisplay? rankingInformationDisplay;
private BeatmapAttributesDisplay? beatmapAttributesDisplay; private BeatmapAttributesDisplay? beatmapAttributesDisplay;
protected virtual BeatmapAttributesDisplay GetBeatmapAttributesDisplay => new BeatmapAttributesDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BeatmapInfo = { Value = Beatmap?.BeatmapInfo }
};
protected ShearedButton BackButton { get; private set; } = null!; protected ShearedButton BackButton { get; private set; } = null!;
protected ShearedToggleButton? CustomisationButton { get; private set; } protected ShearedToggleButton? CustomisationButton { get; private set; }
protected SelectAllModsButton? SelectAllModsButton { get; set; } protected SelectAllModsButton? SelectAllModsButton { get; set; }
@ -283,7 +276,12 @@ namespace osu.Game.Overlays.Mods
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight Origin = Anchor.BottomRight
}, },
beatmapAttributesDisplay = GetBeatmapAttributesDisplay beatmapAttributesDisplay = CreateBeatmapAttributesDisplay().With(b =>
{
b.Anchor = Anchor.BottomRight;
b.Origin = Anchor.BottomRight;
b.BeatmapInfo.Value = Beatmap?.BeatmapInfo;
}),
} }
}); });
} }
@ -293,6 +291,8 @@ namespace osu.Game.Overlays.Mods
textSearchStartsActive = configManager.GetBindable<bool>(OsuSetting.ModSelectTextSearchStartsActive); textSearchStartsActive = configManager.GetBindable<bool>(OsuSetting.ModSelectTextSearchStartsActive);
} }
protected virtual BeatmapAttributesDisplay CreateBeatmapAttributesDisplay() => new BeatmapAttributesDisplay();
public override void Hide() public override void Hide()
{ {
base.Hide(); base.Hide();

View File

@ -6,7 +6,6 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods;
@ -28,13 +27,6 @@ namespace osu.Game.Screens.OnlinePlay.Match
[Resolved] [Resolved]
private RulesetStore rulesets { get; set; } = null!; private RulesetStore rulesets { get; set; } = null!;
protected override BeatmapAttributesDisplay GetBeatmapAttributesDisplay => new RoomBeatmapAttributesDisplay
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
BeatmapInfo = { Value = Beatmap?.BeatmapInfo }
};
private readonly List<Mod> roomMods = new List<Mod>(); private readonly List<Mod> roomMods = new List<Mod>();
protected override void LoadComplete() protected override void LoadComplete()
@ -57,9 +49,10 @@ namespace osu.Game.Screens.OnlinePlay.Match
} }
protected override IEnumerable<Mod> AllSelectedMods => roomMods.Concat(base.AllSelectedMods); protected override IEnumerable<Mod> AllSelectedMods => roomMods.Concat(base.AllSelectedMods);
}
public partial class RoomBeatmapAttributesDisplay : BeatmapAttributesDisplay protected override BeatmapAttributesDisplay CreateBeatmapAttributesDisplay() => new RoomBeatmapAttributesDisplay();
private partial class RoomBeatmapAttributesDisplay : BeatmapAttributesDisplay
{ {
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
private IBindable<PlaylistItem>? selectedItem { get; set; } private IBindable<PlaylistItem>? selectedItem { get; set; }
@ -91,3 +84,4 @@ namespace osu.Game.Screens.OnlinePlay.Match
protected override IEnumerable<Mod> SelectedMods => roomMods.Concat(base.SelectedMods); protected override IEnumerable<Mod> SelectedMods => roomMods.Concat(base.SelectedMods);
} }
} }
}