mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Merge pull request #16760 from peppy/force-relayout-on-score-mode-change
Trigger a re-layout of HUD components when scoring mode is changed
This commit is contained in:
commit
46d180eeb5
@ -17,6 +17,7 @@ using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
@ -83,10 +84,7 @@ namespace osu.Game.Screens.Play
|
||||
Children = new Drawable[]
|
||||
{
|
||||
CreateFailingLayer(),
|
||||
mainComponents = new SkinnableTargetContainer(SkinnableTarget.MainHUDComponents)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
mainComponents = new MainComponentsContainer(),
|
||||
topRightElements = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -325,5 +323,29 @@ namespace osu.Game.Screens.Play
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private class MainComponentsContainer : SkinnableTargetContainer
|
||||
{
|
||||
private Bindable<ScoringMode> scoringMode;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
public MainComponentsContainer()
|
||||
: base(SkinnableTarget.MainHUDComponents)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// When the scoring mode changes, relative positions of elements may change (see DefaultSkin.GetDrawableComponent).
|
||||
// This is a best effort implementation for cases where users haven't customised layouts.
|
||||
scoringMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
||||
scoringMode.BindValueChanged(val => Reload());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user