mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Fix mode icon not being updated for correct ruleset
This commit is contained in:
parent
9a5630b3d5
commit
eaba9e1378
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -16,15 +17,16 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public class DifficultyIcon : DifficultyColouredContainer
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
private readonly RulesetInfo ruleset;
|
||||
|
||||
public DifficultyIcon(BeatmapInfo beatmap)
|
||||
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null)
|
||||
: base(beatmap)
|
||||
{
|
||||
if (beatmap == null)
|
||||
throw new ArgumentNullException(nameof(beatmap));
|
||||
|
||||
this.beatmap = beatmap;
|
||||
this.ruleset = ruleset ?? beatmap.Ruleset;
|
||||
|
||||
Size = new Vector2(20);
|
||||
}
|
||||
|
||||
@ -58,7 +60,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
// the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment)
|
||||
Icon = beatmap.Ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o }
|
||||
Icon = ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Components
|
||||
@ -16,7 +17,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
public class BeatmapTypeInfo : CompositeDrawable
|
||||
{
|
||||
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
|
||||
public readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
public readonly IBindable<GameType> Type = new Bindable<GameType>();
|
||||
|
||||
public BeatmapTypeInfo()
|
||||
@ -56,6 +57,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
};
|
||||
|
||||
modeTypeInfo.Beatmap.BindTo(Beatmap);
|
||||
modeTypeInfo.Ruleset.BindTo(Ruleset);
|
||||
modeTypeInfo.Type.BindTo(Type);
|
||||
|
||||
beatmapTitle.Beatmap.BindTo(Beatmap);
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Components
|
||||
@ -19,6 +20,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
private readonly Container rulesetContainer;
|
||||
|
||||
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
public readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
public readonly IBindable<GameType> Type = new Bindable<GameType>();
|
||||
|
||||
public ModeTypeInfo()
|
||||
@ -47,6 +49,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
};
|
||||
|
||||
Beatmap.BindValueChanged(updateBeatmap);
|
||||
Ruleset.BindValueChanged(_ => updateBeatmap(Beatmap.Value));
|
||||
Type.BindValueChanged(v => gameTypeContainer.Child = new DrawableGameType(v) { Size = new Vector2(height) });
|
||||
}
|
||||
|
||||
@ -55,7 +58,7 @@ namespace osu.Game.Screens.Multi.Components
|
||||
if (beatmap != null)
|
||||
{
|
||||
rulesetContainer.FadeIn(transition_duration);
|
||||
rulesetContainer.Child = new DifficultyIcon(beatmap) { Size = new Vector2(height) };
|
||||
rulesetContainer.Child = new DifficultyIcon(beatmap, Ruleset.Value) { Size = new Vector2(height) };
|
||||
}
|
||||
else
|
||||
rulesetContainer.FadeOut(transition_duration);
|
||||
|
@ -191,8 +191,9 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
|
||||
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
modeTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
beatmapTitle.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
modeTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
||||
modeTypeInfo.Type.BindTo(bindings.Type);
|
||||
beatmapTitle.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
participantInfo.Host.BindTo(bindings.Host);
|
||||
participantInfo.Participants.BindTo(bindings.Participants);
|
||||
participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||
|
@ -174,9 +174,10 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
||||
participantCount.ParticipantCount.BindTo(bindings.ParticipantCount);
|
||||
participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
|
||||
|
||||
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
||||
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
||||
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
|
||||
bindings.Status.BindValueChanged(displayStatus);
|
||||
bindings.Participants.BindValueChanged(p => participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u)));
|
||||
|
@ -112,6 +112,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
};
|
||||
|
||||
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
||||
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
||||
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
||||
bindings.CurrentMods.BindValueChanged(m => modDisplay.Current.Value = m, true);
|
||||
|
Loading…
Reference in New Issue
Block a user