Merge branch 'master' into fix-screens-blocking-home/altf4

This commit is contained in:
Dan Balasescu 2020-07-15 13:17:53 +09:00 committed by GitHub
commit b1c06c1e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 51 additions and 44 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.714.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public BindableNumber<float> CircleSize { get; } = new BindableFloat public BindableNumber<float> CircleSize { get; } = new BindableFloat
{ {
Precision = 0.1f, Precision = 0.1f,
MinValue = 1, MinValue = 0,
MaxValue = 10, MaxValue = 10,
Default = 5, Default = 5,
Value = 5, Value = 5,
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public BindableNumber<float> ApproachRate { get; } = new BindableFloat public BindableNumber<float> ApproachRate { get; } = new BindableFloat
{ {
Precision = 0.1f, Precision = 0.1f,
MinValue = 1, MinValue = 0,
MaxValue = 10, MaxValue = 10,
Default = 5, Default = 5,
Value = 5, Value = 5,

View File

@ -8,7 +8,6 @@ using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osu.Game.Users;
namespace osu.Game.Tests.Online namespace osu.Game.Tests.Online
{ {
@ -55,7 +54,7 @@ namespace osu.Game.Tests.Online
AddStep("fire request", () => AddStep("fire request", () =>
{ {
gotResponse = false; gotResponse = false;
request = new LeaveChannelRequest(new Channel(), new User()); request = new LeaveChannelRequest(new Channel());
request.Success += () => gotResponse = true; request.Success += () => gotResponse = true;
API.Queue(request); API.Queue(request);
}); });
@ -74,7 +73,7 @@ namespace osu.Game.Tests.Online
AddStep("fire request", () => AddStep("fire request", () =>
{ {
gotResponse = false; gotResponse = false;
request = new LeaveChannelRequest(new Channel(), new User()); request = new LeaveChannelRequest(new Channel());
request.Success += () => gotResponse = true; request.Success += () => gotResponse = true;
API.Perform(request); API.Perform(request);
}); });
@ -93,7 +92,7 @@ namespace osu.Game.Tests.Online
AddStep("fire request", () => AddStep("fire request", () =>
{ {
gotResponse = false; gotResponse = false;
request = new LeaveChannelRequest(new Channel(), new User()); request = new LeaveChannelRequest(new Channel());
request.Success += () => gotResponse = true; request.Success += () => gotResponse = true;
API.PerformAsync(request); API.PerformAsync(request);
}); });

View File

@ -48,16 +48,13 @@ namespace osu.Game.Beatmaps
public Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken) public Task UpdateAsync(BeatmapSetInfo beatmapSet, CancellationToken cancellationToken)
{ {
if (api?.State != APIState.Online)
return Task.CompletedTask;
LogForModel(beatmapSet, "Performing online lookups..."); LogForModel(beatmapSet, "Performing online lookups...");
return Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray()); return Task.WhenAll(beatmapSet.Beatmaps.Select(b => UpdateAsync(beatmapSet, b, cancellationToken)).ToArray());
} }
// todo: expose this when we need to do individual difficulty lookups. // todo: expose this when we need to do individual difficulty lookups.
protected Task UpdateAsync(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken) protected Task UpdateAsync(BeatmapSetInfo beatmapSet, BeatmapInfo beatmap, CancellationToken cancellationToken)
=> Task.Factory.StartNew(() => lookup(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler, updateScheduler); => Task.Factory.StartNew(() => lookup(beatmapSet, beatmap), cancellationToken, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler);
private void lookup(BeatmapSetInfo set, BeatmapInfo beatmap) private void lookup(BeatmapSetInfo set, BeatmapInfo beatmap)
{ {

View File

@ -91,6 +91,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.FadePlayfieldWhenHealthLow, true); Set(OsuSetting.FadePlayfieldWhenHealthLow, true);
Set(OsuSetting.KeyOverlay, false); Set(OsuSetting.KeyOverlay, false);
Set(OsuSetting.PositionalHitSounds, true); Set(OsuSetting.PositionalHitSounds, true);
Set(OsuSetting.AlwaysPlayFirstComboBreak, true);
Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth); Set(OsuSetting.ScoreMeter, ScoreMeterType.HitErrorBoth);
Set(OsuSetting.FloatingComments, false); Set(OsuSetting.FloatingComments, false);
@ -180,6 +181,7 @@ namespace osu.Game.Configuration
ShowStoryboard, ShowStoryboard,
KeyOverlay, KeyOverlay,
PositionalHitSounds, PositionalHitSounds,
AlwaysPlayFirstComboBreak,
ScoreMeter, ScoreMeter,
FloatingComments, FloatingComments,
ShowInterface, ShowInterface,

View File

@ -57,6 +57,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit), new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit),
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed), new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
}; };
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[] public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
@ -160,6 +161,9 @@ namespace osu.Game.Input.Bindings
Home, Home,
[Description("Toggle notifications")] [Description("Toggle notifications")]
ToggleNotifications ToggleNotifications,
[Description("Pause")]
PauseGameplay,
} }
} }

View File

@ -5,6 +5,7 @@ using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Users;
namespace osu.Game.Online.API namespace osu.Game.Online.API
{ {
@ -61,6 +62,11 @@ namespace osu.Game.Online.API
protected APIAccess API; protected APIAccess API;
protected WebRequest WebRequest; protected WebRequest WebRequest;
/// <summary>
/// The currently logged in user. Note that this will only be populated during <see cref="Perform"/>.
/// </summary>
protected User User { get; private set; }
/// <summary> /// <summary>
/// Invoked on successful completion of an API request. /// Invoked on successful completion of an API request.
/// This will be scheduled to the API's internal scheduler (run on update thread automatically). /// This will be scheduled to the API's internal scheduler (run on update thread automatically).
@ -86,6 +92,7 @@ namespace osu.Game.Online.API
} }
API = apiAccess; API = apiAccess;
User = apiAccess.LocalUser.Value;
if (checkAndScheduleFailure()) if (checkAndScheduleFailure())
return; return;

View File

@ -4,19 +4,16 @@
using System.Net.Http; using System.Net.Http;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class JoinChannelRequest : APIRequest public class JoinChannelRequest : APIRequest
{ {
private readonly Channel channel; private readonly Channel channel;
private readonly User user;
public JoinChannelRequest(Channel channel, User user) public JoinChannelRequest(Channel channel)
{ {
this.channel = channel; this.channel = channel;
this.user = user;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests
return req; return req;
} }
protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; protected override string Target => $@"chat/channels/{channel.Id}/users/{User.Id}";
} }
} }

View File

@ -4,19 +4,16 @@
using System.Net.Http; using System.Net.Http;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class JoinRoomRequest : APIRequest public class JoinRoomRequest : APIRequest
{ {
private readonly Room room; private readonly Room room;
private readonly User user;
public JoinRoomRequest(Room room, User user) public JoinRoomRequest(Room room)
{ {
this.room = room; this.room = room;
this.user = user;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests
return req; return req;
} }
protected override string Target => $"rooms/{room.RoomID.Value}/users/{user.Id}"; protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}";
} }
} }

View File

@ -4,19 +4,16 @@
using System.Net.Http; using System.Net.Http;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class LeaveChannelRequest : APIRequest public class LeaveChannelRequest : APIRequest
{ {
private readonly Channel channel; private readonly Channel channel;
private readonly User user;
public LeaveChannelRequest(Channel channel, User user) public LeaveChannelRequest(Channel channel)
{ {
this.channel = channel; this.channel = channel;
this.user = user;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests
return req; return req;
} }
protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; protected override string Target => $@"chat/channels/{channel.Id}/users/{User.Id}";
} }
} }

View File

@ -4,19 +4,16 @@
using System.Net.Http; using System.Net.Http;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
public class PartRoomRequest : APIRequest public class PartRoomRequest : APIRequest
{ {
private readonly Room room; private readonly Room room;
private readonly User user;
public PartRoomRequest(Room room, User user) public PartRoomRequest(Room room)
{ {
this.room = room; this.room = room;
this.user = user;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
@ -26,6 +23,6 @@ namespace osu.Game.Online.API.Requests
return req; return req;
} }
protected override string Target => $"rooms/{room.RoomID.Value}/users/{user.Id}"; protected override string Target => $"rooms/{room.RoomID.Value}/users/{User.Id}";
} }
} }

View File

@ -381,7 +381,7 @@ namespace osu.Game.Online.Chat
break; break;
default: default:
var req = new JoinChannelRequest(channel, api.LocalUser.Value); var req = new JoinChannelRequest(channel);
req.Success += () => joinChannel(channel, fetchInitialMessages); req.Success += () => joinChannel(channel, fetchInitialMessages);
req.Failure += ex => LeaveChannel(channel); req.Failure += ex => LeaveChannel(channel);
api.Queue(req); api.Queue(req);
@ -410,7 +410,7 @@ namespace osu.Game.Online.Chat
if (channel.Joined.Value) if (channel.Joined.Value)
{ {
api.Queue(new LeaveChannelRequest(channel, api.LocalUser.Value)); api.Queue(new LeaveChannelRequest(channel));
channel.Joined.Value = false; channel.Joined.Value = false;
} }
} }

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mods
public BindableNumber<float> DrainRate { get; } = new BindableFloat public BindableNumber<float> DrainRate { get; } = new BindableFloat
{ {
Precision = 0.1f, Precision = 0.1f,
MinValue = 1, MinValue = 0,
MaxValue = 10, MaxValue = 10,
Default = 5, Default = 5,
Value = 5, Value = 5,
@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Mods
public BindableNumber<float> OverallDifficulty { get; } = new BindableFloat public BindableNumber<float> OverallDifficulty { get; } = new BindableFloat
{ {
Precision = 0.1f, Precision = 0.1f,
MinValue = 1, MinValue = 0,
MaxValue = 10, MaxValue = 10,
Default = 5, Default = 5,
Value = 5, Value = 5,

View File

@ -114,7 +114,7 @@ namespace osu.Game.Screens.Multi
public void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null) public void JoinRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
{ {
currentJoinRoomRequest?.Cancel(); currentJoinRoomRequest?.Cancel();
currentJoinRoomRequest = new JoinRoomRequest(room, api.LocalUser.Value); currentJoinRoomRequest = new JoinRoomRequest(room);
currentJoinRoomRequest.Success += () => currentJoinRoomRequest.Success += () =>
{ {
@ -139,7 +139,7 @@ namespace osu.Game.Screens.Multi
if (joinedRoom == null) if (joinedRoom == null)
return; return;
api.Queue(new PartRoomRequest(joinedRoom, api.LocalUser.Value)); api.Queue(new PartRoomRequest(joinedRoom));
joinedRoom = null; joinedRoom = null;
} }

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Configuration;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -16,27 +17,34 @@ namespace osu.Game.Screens.Play
private SkinnableSound comboBreakSample; private SkinnableSound comboBreakSample;
private Bindable<bool> alwaysPlay;
private bool firstTime = true;
public ComboEffects(ScoreProcessor processor) public ComboEffects(ScoreProcessor processor)
{ {
this.processor = processor; this.processor = processor;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OsuConfigManager config)
{ {
InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak")); InternalChild = comboBreakSample = new SkinnableSound(new SampleInfo("combobreak"));
alwaysPlay = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak);
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
processor.Combo.BindValueChanged(onComboChange, true); processor.Combo.BindValueChanged(onComboChange);
} }
private void onComboChange(ValueChangedEvent<int> combo) private void onComboChange(ValueChangedEvent<int> combo)
{ {
if (combo.NewValue == 0 && combo.OldValue > 20) if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlay.Value && firstTime)))
{
comboBreakSample?.Play(); comboBreakSample?.Play();
firstTime = false;
}
} }
} }
} }

View File

@ -251,6 +251,7 @@ namespace osu.Game.Screens.Play.HUD
switch (action) switch (action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
case GlobalAction.PauseGameplay: // in the future this behaviour will differ for replays etc.
if (!pendingAnimation) if (!pendingAnimation)
BeginConfirm(); BeginConfirm();
return true; return true;
@ -264,6 +265,7 @@ namespace osu.Game.Screens.Play.HUD
switch (action) switch (action)
{ {
case GlobalAction.Back: case GlobalAction.Back:
case GlobalAction.PauseGameplay:
AbortConfirm(); AbortConfirm();
break; break;
} }

View File

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<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.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.714.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" />
<PackageReference Include="Sentry" Version="2.1.4" /> <PackageReference Include="Sentry" Version="2.1.4" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.25.1" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.714.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.714.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<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.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.714.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.714.1" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.25.1" />
<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" />