mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Remove ruleset and mod bindables from PlaylistItem
This commit is contained in:
@ -6,6 +6,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Components
|
||||
@ -15,6 +16,9 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
private const float height = 28;
|
||||
private const float transition_duration = 100;
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
private Container drawableRuleset;
|
||||
|
||||
public ModeTypeInfo()
|
||||
@ -56,11 +60,14 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
private void updateBeatmap()
|
||||
{
|
||||
var item = Playlist.FirstOrDefault();
|
||||
var ruleset = item == null ? null : rulesets.GetRuleset(item.RulesetID)?.CreateInstance();
|
||||
|
||||
if (item?.Beatmap != null)
|
||||
if (item?.Beatmap != null && ruleset != null)
|
||||
{
|
||||
var mods = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray();
|
||||
|
||||
drawableRuleset.FadeIn(transition_duration);
|
||||
drawableRuleset.Child = new DifficultyIcon(item.Beatmap.Value, item.Ruleset.Value, item.RequiredMods) { Size = new Vector2(height) };
|
||||
drawableRuleset.Child = new DifficultyIcon(item.Beatmap.Value, ruleset.RulesetInfo, mods) { Size = new Vector2(height) };
|
||||
}
|
||||
else
|
||||
drawableRuleset.FadeOut(transition_duration);
|
||||
|
@ -12,7 +12,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Components
|
||||
{
|
||||
@ -27,9 +26,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
protected IBindable<Room> JoinedRoom => joinedRoom;
|
||||
private readonly Bindable<Room> joinedRoom = new Bindable<Room>();
|
||||
|
||||
[Resolved]
|
||||
private IRulesetStore rulesets { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
@ -117,7 +113,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
try
|
||||
{
|
||||
foreach (var pi in room.Playlist)
|
||||
pi.MapObjects(rulesets);
|
||||
pi.MapObjects();
|
||||
|
||||
var existing = rooms.FirstOrDefault(e => e.RoomID.Value == room.RoomID.Value);
|
||||
if (existing == null)
|
||||
|
Reference in New Issue
Block a user