mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Fix overlays not being blocked when disabled (#5475)
Fix overlays not being blocked when disabled Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
8e4a179cda
@ -63,6 +63,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.909.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.911.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
protected virtual bool DimMainContent => true;
|
protected virtual bool DimMainContent => true;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private OsuGame osuGame { get; set; }
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private PreviewTrackManager previewTrackManager { get; set; }
|
private PreviewTrackManager previewTrackManager { get; set; }
|
||||||
@ -42,13 +42,22 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
if (osuGame != null)
|
|
||||||
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
|
|
||||||
|
|
||||||
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
|
samplePopIn = audio.Samples.Get(@"UI/overlay-pop-in");
|
||||||
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
|
samplePopOut = audio.Samples.Get(@"UI/overlay-pop-out");
|
||||||
|
}
|
||||||
|
|
||||||
State.ValueChanged += onStateChanged;
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
if (game != null)
|
||||||
|
OverlayActivationMode.BindTo(game.OverlayActivationMode);
|
||||||
|
|
||||||
|
OverlayActivationMode.BindValueChanged(mode =>
|
||||||
|
{
|
||||||
|
if (mode.NewValue == OverlayActivation.Disabled)
|
||||||
|
State.Value = Visibility.Hidden;
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -106,26 +115,28 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
|
|
||||||
private void onStateChanged(ValueChangedEvent<Visibility> state)
|
protected override void UpdateState(ValueChangedEvent<Visibility> state)
|
||||||
{
|
{
|
||||||
switch (state.NewValue)
|
switch (state.NewValue)
|
||||||
{
|
{
|
||||||
case Visibility.Visible:
|
case Visibility.Visible:
|
||||||
if (OverlayActivationMode.Value != OverlayActivation.Disabled)
|
if (OverlayActivationMode.Value == OverlayActivation.Disabled)
|
||||||
{
|
{
|
||||||
if (PlaySamplesOnStateChange) samplePopIn?.Play();
|
State.Value = Visibility.Hidden;
|
||||||
if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this);
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Hide();
|
|
||||||
|
|
||||||
|
if (PlaySamplesOnStateChange) samplePopIn?.Play();
|
||||||
|
if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Visibility.Hidden:
|
case Visibility.Hidden:
|
||||||
if (PlaySamplesOnStateChange) samplePopOut?.Play();
|
if (PlaySamplesOnStateChange) samplePopOut?.Play();
|
||||||
if (BlockScreenWideMouse) osuGame?.RemoveBlockingOverlay(this);
|
if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base.UpdateState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
@ -137,7 +148,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
osuGame?.RemoveBlockingOverlay(this);
|
game?.RemoveBlockingOverlay(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.909.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -118,8 +118,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.909.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.909.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.911.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user