mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:42:56 +08:00
Add check if game is muted by MuteButton
This commit is contained in:
parent
0afb5c5bb0
commit
00e46fdefe
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -57,10 +58,13 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private InputManager inputManager;
|
private InputManager inputManager;
|
||||||
|
|
||||||
|
private IdleTracker idleTracker;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private NotificationOverlay notificationOverlay { get; set; }
|
private NotificationOverlay notificationOverlay { get; set; }
|
||||||
|
|
||||||
private IdleTracker idleTracker;
|
[Resolved]
|
||||||
|
private VolumeOverlay volumeOverlay { get; set; }
|
||||||
|
|
||||||
public PlayerLoader(Func<Player> createPlayer)
|
public PlayerLoader(Func<Player> createPlayer)
|
||||||
{
|
{
|
||||||
@ -155,7 +159,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void checkVolume(AudioManager audio)
|
private void checkVolume(AudioManager audio)
|
||||||
{
|
{
|
||||||
if (audio.Volume.Value <= audio.Volume.MinValue || audio.VolumeTrack.Value <= audio.VolumeTrack.MinValue)
|
if (volumeOverlay.IsMuted || audio.Volume.Value <= audio.Volume.MinValue || audio.VolumeTrack.Value <= audio.VolumeTrack.MinValue)
|
||||||
notificationOverlay.Post(new MutedNotification());
|
notificationOverlay.Post(new MutedNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +504,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public override bool RequestsFocus => true;
|
public override bool RequestsFocus => true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, AudioManager audioManager, NotificationOverlay notificationOverlay)
|
private void load(OsuColour colours, AudioManager audioManager, NotificationOverlay notificationOverlay, VolumeOverlay volumeOverlay)
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.VolumeMute;
|
Icon = FontAwesome.Solid.VolumeMute;
|
||||||
IconBackgound.Colour = colours.RedDark;
|
IconBackgound.Colour = colours.RedDark;
|
||||||
@ -509,6 +513,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
notificationOverlay.Hide();
|
notificationOverlay.Hide();
|
||||||
|
|
||||||
|
volumeOverlay.IsMuted = false;
|
||||||
audioManager.Volume.SetDefault();
|
audioManager.Volume.SetDefault();
|
||||||
audioManager.VolumeTrack.SetDefault();
|
audioManager.VolumeTrack.SetDefault();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user