mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:35:35 +08:00
Merge branch 'master' into fix-taiko-fastforwarding
This commit is contained in:
commit
46a7de1845
@ -1 +1 @@
|
|||||||
Subproject commit 2610a3133721b0bc4af852342aa2a179d0e66497
|
Subproject commit 90bf49a2df3dbad5994d922df63e4891c622dbc3
|
@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class IconButton : OsuClickableContainer
|
public class IconButton : OsuClickableContainer
|
||||||
{
|
{
|
||||||
private const float button_size = 30;
|
public const float BUTTON_SIZE = 30;
|
||||||
|
|
||||||
private Color4? flashColour;
|
private Color4? flashColour;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -106,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Size = new Vector2(button_size),
|
Size = new Vector2(BUTTON_SIZE),
|
||||||
CornerRadius = 5,
|
CornerRadius = 5,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Threading;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface.Volume
|
namespace osu.Game.Graphics.UserInterface.Volume
|
||||||
@ -14,6 +15,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
public class VolumeControl : OverlayContainer
|
public class VolumeControl : OverlayContainer
|
||||||
{
|
{
|
||||||
private readonly VolumeMeter volumeMeterMaster;
|
private readonly VolumeMeter volumeMeterMaster;
|
||||||
|
private readonly IconButton muteIcon;
|
||||||
|
|
||||||
protected override bool BlockPassThroughMouse => false;
|
protected override bool BlockPassThroughMouse => false;
|
||||||
|
|
||||||
@ -34,6 +36,17 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
Spacing = new Vector2(15, 0),
|
Spacing = new Vector2(15, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Size = new Vector2(IconButton.BUTTON_SIZE),
|
||||||
|
Child = muteIcon = new IconButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Icon = FontAwesome.fa_volume_up,
|
||||||
|
Action = () => Adjust(GlobalAction.ToggleMute),
|
||||||
|
}
|
||||||
|
},
|
||||||
volumeMeterMaster = new VolumeMeter("Master"),
|
volumeMeterMaster = new VolumeMeter("Master"),
|
||||||
volumeMeterEffect = new VolumeMeter("Effects"),
|
volumeMeterEffect = new VolumeMeter("Effects"),
|
||||||
volumeMeterMusic = new VolumeMeter("Music")
|
volumeMeterMusic = new VolumeMeter("Music")
|
||||||
@ -46,18 +59,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
volumeMeterMaster.Bindable.ValueChanged += volumeChanged;
|
volumeMeterMaster.Bindable.ValueChanged += _ => settingChanged();
|
||||||
volumeMeterEffect.Bindable.ValueChanged += volumeChanged;
|
volumeMeterEffect.Bindable.ValueChanged += _ => settingChanged();
|
||||||
volumeMeterMusic.Bindable.ValueChanged += volumeChanged;
|
volumeMeterMusic.Bindable.ValueChanged += _ => settingChanged();
|
||||||
}
|
muted.ValueChanged += _ => settingChanged();
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
volumeMeterMaster.Bindable.ValueChanged -= volumeChanged;
|
|
||||||
volumeMeterEffect.Bindable.ValueChanged -= volumeChanged;
|
|
||||||
volumeMeterMusic.Bindable.ValueChanged -= volumeChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Adjust(GlobalAction action)
|
public bool Adjust(GlobalAction action)
|
||||||
@ -76,23 +81,45 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
else
|
else
|
||||||
volumeMeterMaster.Increase();
|
volumeMeterMaster.Increase();
|
||||||
return true;
|
return true;
|
||||||
|
case GlobalAction.ToggleMute:
|
||||||
|
Show();
|
||||||
|
muted.Toggle();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void volumeChanged(double newVolume)
|
private void settingChanged()
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
schedulePopOut();
|
schedulePopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly BindableDouble muteAdjustment = new BindableDouble();
|
||||||
|
|
||||||
|
private readonly BindableBool muted = new BindableBool();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
volumeMeterMaster.Bindable.BindTo(audio.Volume);
|
volumeMeterMaster.Bindable.BindTo(audio.Volume);
|
||||||
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
volumeMeterEffect.Bindable.BindTo(audio.VolumeSample);
|
||||||
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
|
||||||
|
|
||||||
|
muted.ValueChanged += mute =>
|
||||||
|
{
|
||||||
|
if (mute)
|
||||||
|
{
|
||||||
|
audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
||||||
|
muteIcon.Icon = FontAwesome.fa_volume_off;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
|
||||||
|
muteIcon.Icon = FontAwesome.fa_volume_up;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScheduledDelegate popOutDelegate;
|
private ScheduledDelegate popOutDelegate;
|
||||||
|
@ -70,11 +70,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
|||||||
|
|
||||||
public double Volume
|
public double Volume
|
||||||
{
|
{
|
||||||
get { return Bindable.Value; }
|
get => Bindable.Value;
|
||||||
private set
|
private set => Bindable.Value = value;
|
||||||
{
|
|
||||||
Bindable.Value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Increase()
|
public void Increase()
|
||||||
|
@ -29,10 +29,11 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
|
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
|
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
|
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
|
||||||
new KeyBinding(new[] { InputKey.Up }, GlobalAction.IncreaseVolume),
|
new KeyBinding(InputKey.Up, GlobalAction.IncreaseVolume),
|
||||||
new KeyBinding(new[] { InputKey.MouseWheelUp }, GlobalAction.IncreaseVolume),
|
new KeyBinding(InputKey.MouseWheelUp, GlobalAction.IncreaseVolume),
|
||||||
new KeyBinding(new[] { InputKey.Down }, GlobalAction.DecreaseVolume),
|
new KeyBinding(InputKey.Down, GlobalAction.DecreaseVolume),
|
||||||
new KeyBinding(new[] { InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
|
new KeyBinding(InputKey.MouseWheelDown, GlobalAction.DecreaseVolume),
|
||||||
|
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
||||||
};
|
};
|
||||||
|
|
||||||
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||||
@ -63,6 +64,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
IncreaseVolume,
|
IncreaseVolume,
|
||||||
[Description("Decrease Volume")]
|
[Description("Decrease Volume")]
|
||||||
DecreaseVolume,
|
DecreaseVolume,
|
||||||
|
[Description("Toggle mute")]
|
||||||
|
ToggleMute,
|
||||||
|
|
||||||
// In-Game Keybindings
|
// In-Game Keybindings
|
||||||
[Description("Skip Cutscene")]
|
[Description("Skip Cutscene")]
|
||||||
|
25
osu.Game/Migrations/20180131154205_AddMuteBinding.cs
Normal file
25
osu.Game/Migrations/20180131154205_AddMuteBinding.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
|
namespace osu.Game.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(OsuDbContext))]
|
||||||
|
[Migration("20180131154205_AddMuteBinding")]
|
||||||
|
public partial class AddMuteBinding : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql($"UPDATE KeyBinding SET Action = Action + 1 WHERE RulesetID IS NULL AND Variant IS NULL AND Action >= {(int)GlobalAction.ToggleMute}");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.Sql($"DELETE FROM KeyBinding WHERE RulesetID IS NULL AND Variant IS NULL AND Action = {(int)GlobalAction.ToggleMute}");
|
||||||
|
migrationBuilder.Sql($"UPDATE KeyBinding SET Action = Action - 1 WHERE RulesetID IS NULL AND Variant IS NULL AND Action > {(int)GlobalAction.ToggleMute}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -280,6 +280,7 @@
|
|||||||
<Compile Include="Migrations\20180125143340_Settings.Designer.cs">
|
<Compile Include="Migrations\20180125143340_Settings.Designer.cs">
|
||||||
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Migrations\20180131154205_AddMuteBinding.cs" />
|
||||||
<Compile Include="Overlays\Profile\SupporterIcon.cs" />
|
<Compile Include="Overlays\Profile\SupporterIcon.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetFriendsRequest.cs" />
|
<Compile Include="Online\API\Requests\GetFriendsRequest.cs" />
|
||||||
<Compile Include="Overlays\Settings\DangerousSettingsButton.cs" />
|
<Compile Include="Overlays\Settings\DangerousSettingsButton.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user