mirror of
https://github.com/ppy/osu
synced 2025-01-03 04:42:10 +00:00
hide catchcombo when Hud hide
This commit is contained in:
parent
7f5fe56c1d
commit
857e943b8d
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
|
@ -4,9 +4,13 @@
|
||||
#nullable disable
|
||||
|
||||
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.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -22,11 +26,69 @@ 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; }
|
||||
|
||||
public CatchComboDisplay()
|
||||
: base(new CatchSkinComponent(CatchSkinComponents.CatchComboCounter), _ => Empty())
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(DrawableRuleset drawableRuleset)
|
||||
{
|
||||
hudVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
|
||||
|
||||
hudVisibilityMode.BindValueChanged(s =>
|
||||
{
|
||||
updateVisibilityState();
|
||||
});
|
||||
|
||||
if (drawableRuleset != null)
|
||||
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);
|
||||
|
||||
replayLoaded.BindValueChanged(s =>
|
||||
{
|
||||
updateVisibilityState();
|
||||
});
|
||||
|
||||
showCombo.BindValueChanged(s =>
|
||||
{
|
||||
if (ComboCounter == null) return;
|
||||
|
||||
if (!s.NewValue)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin)
|
||||
{
|
||||
base.SkinChanged(skin);
|
||||
@ -57,6 +119,8 @@ 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