mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Update CatchComboDisplay
implementation to use newly exposed bindable
This commit is contained in:
parent
d2d589a156
commit
652bc4ac61
@ -6,11 +6,9 @@
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
@ -27,14 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
[CanBeNull]
|
||||
public ICatchComboCounter ComboCounter => Drawable as ICatchComboCounter;
|
||||
|
||||
private Bindable<HUDVisibilityMode> hudVisibilityMode = null!;
|
||||
|
||||
private readonly BindableBool replayLoaded = new BindableBool();
|
||||
|
||||
private readonly BindableBool showCombo = new BindableBool();
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
private readonly IBindable<bool> showCombo = new BindableBool(true);
|
||||
|
||||
public CatchComboDisplay()
|
||||
: base(new CatchSkinComponent(CatchSkinComponents.CatchComboCounter), _ => Empty())
|
||||
@ -42,51 +33,18 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(DrawableRuleset drawableRuleset, HUDOverlay hud)
|
||||
private void load(Player player)
|
||||
{
|
||||
hudVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
||||
|
||||
hudVisibilityMode.BindValueChanged(s =>
|
||||
if (player != null)
|
||||
{
|
||||
updateVisibilityState();
|
||||
});
|
||||
|
||||
if (drawableRuleset != null)
|
||||
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);
|
||||
|
||||
replayLoaded.BindValueChanged(s =>
|
||||
{
|
||||
updateVisibilityState();
|
||||
});
|
||||
|
||||
showCombo.BindValueChanged(s =>
|
||||
{
|
||||
if (ComboCounter == null) return;
|
||||
|
||||
if (!s.NewValue)
|
||||
showCombo.BindTo(player.ShowingOverlayComponents);
|
||||
showCombo.BindValueChanged(s =>
|
||||
{
|
||||
ComboCounter.Hide();
|
||||
}
|
||||
});
|
||||
|
||||
updateVisibilityState();
|
||||
|
||||
void updateVisibilityState()
|
||||
{
|
||||
switch (hudVisibilityMode.Value)
|
||||
{
|
||||
case HUDVisibilityMode.Never:
|
||||
showCombo.Value = false;
|
||||
break;
|
||||
|
||||
case HUDVisibilityMode.HideDuringGameplay:
|
||||
showCombo.Value = replayLoaded.Value;
|
||||
break;
|
||||
|
||||
case HUDVisibilityMode.Always:
|
||||
showCombo.Value = true;
|
||||
break;
|
||||
}
|
||||
if (!s.NewValue)
|
||||
ComboCounter?.Hide();
|
||||
else
|
||||
ComboCounter?.Show();
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,8 +78,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
|
||||
private void updateCombo(int newCombo, Color4? hitObjectColour)
|
||||
{
|
||||
if (!showCombo.Value) return;
|
||||
|
||||
currentCombo = newCombo;
|
||||
ComboCounter?.UpdateCombo(newCombo, hitObjectColour);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user