mirror of
https://github.com/ppy/osu.git
synced 2025-03-20 07:17:31 +08:00
Merge branch 'master' into fix-skin-dropdown-update-crash
This commit is contained in:
commit
6a1387191a
@ -1,11 +1,45 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Mods
|
||||
{
|
||||
public class TaikoModDifficultyAdjust : ModDifficultyAdjust
|
||||
{
|
||||
[SettingSource("Scroll Speed", "Adjust a beatmap's set scroll speed", LAST_SETTING_ORDER + 1)]
|
||||
public BindableNumber<float> ScrollSpeed { get; } = new BindableFloat
|
||||
{
|
||||
Precision = 0.05f,
|
||||
MinValue = 0.25f,
|
||||
MaxValue = 4,
|
||||
Default = 1,
|
||||
Value = 1,
|
||||
};
|
||||
|
||||
public override string SettingDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
string scrollSpeed = ScrollSpeed.IsDefault ? string.Empty : $"Scroll x{ScrollSpeed.Value:N1}";
|
||||
|
||||
return string.Join(", ", new[]
|
||||
{
|
||||
base.SettingDescription,
|
||||
scrollSpeed
|
||||
}.Where(s => !string.IsNullOrEmpty(s)));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ApplySettings(BeatmapDifficulty difficulty)
|
||||
{
|
||||
base.ApplySettings(difficulty);
|
||||
|
||||
ApplySetting(ScrollSpeed, scroll => difficulty.SliderMultiplier *= scroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Beatmaps
|
||||
cmd.CommandText = "SELECT beatmapset_id, beatmap_id, approved FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineBeatmapID OR filename = @Path";
|
||||
|
||||
cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmap.MD5Hash));
|
||||
cmd.Parameters.Add(new SqliteParameter("@OnlineBeatmapID", beatmap.OnlineBeatmapID));
|
||||
cmd.Parameters.Add(new SqliteParameter("@OnlineBeatmapID", beatmap.OnlineBeatmapID ?? (object)DBNull.Value));
|
||||
cmd.Parameters.Add(new SqliteParameter("@Path", beatmap.Path));
|
||||
|
||||
using (var reader = cmd.ExecuteReader())
|
||||
|
@ -1,36 +0,0 @@
|
||||
// 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 enable
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Extensions.ExceptionExtensions;
|
||||
using osu.Framework.Logging;
|
||||
|
||||
namespace osu.Game.Extensions
|
||||
{
|
||||
public static class TaskExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Denote a task which is to be run without local error handling logic, where failure is not catastrophic.
|
||||
/// Avoids unobserved exceptions from being fired.
|
||||
/// </summary>
|
||||
/// <param name="task">The task.</param>
|
||||
/// <param name="logAsError">
|
||||
/// Whether errors should be logged as errors visible to users, or as debug messages.
|
||||
/// Logging as debug will essentially silence the errors on non-release builds.
|
||||
/// </param>
|
||||
public static void CatchUnobservedExceptions(this Task task, bool logAsError = false)
|
||||
{
|
||||
task.ContinueWith(t =>
|
||||
{
|
||||
Exception? exception = t.Exception?.AsSingular();
|
||||
if (logAsError)
|
||||
Logger.Error(exception, $"Error running task: {exception?.Message ?? "(unknown)"}", LoggingTarget.Runtime, true);
|
||||
else
|
||||
Logger.Log($"Error running task: {exception}", LoggingTarget.Runtime, LogLevel.Debug);
|
||||
}, TaskContinuationOptions.NotOnRanToCompletion);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,7 +15,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -104,7 +103,7 @@ namespace osu.Game.Online.Multiplayer
|
||||
if (!connected.NewValue && Room != null)
|
||||
{
|
||||
Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important);
|
||||
LeaveRoom().CatchUnobservedExceptions();
|
||||
LeaveRoom();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -23,7 +22,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
base.OnResuming(last);
|
||||
|
||||
if (client.Room != null)
|
||||
client.ChangeState(MultiplayerUserState.Idle).CatchUnobservedExceptions(true);
|
||||
client.ChangeState(MultiplayerUserState.Idle);
|
||||
}
|
||||
|
||||
protected override void UpdatePollingRate(bool isIdle)
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
@ -237,7 +236,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
// accessing Exception here silences any potential errors from the antecedent task
|
||||
if (t.Exception != null)
|
||||
{
|
||||
t.CatchUnobservedExceptions(true); // will run immediately.
|
||||
// gameplay was not started due to an exception; unblock button.
|
||||
endOperation();
|
||||
}
|
||||
@ -248,11 +246,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
}
|
||||
|
||||
client.ToggleReady()
|
||||
.ContinueWith(t =>
|
||||
{
|
||||
t.CatchUnobservedExceptions(true); // will run immediately.
|
||||
endOperation();
|
||||
});
|
||||
.ContinueWith(t => endOperation());
|
||||
|
||||
void endOperation()
|
||||
{
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ExceptionExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Rooms.RoomStatuses;
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
base.PartRoom();
|
||||
|
||||
multiplayerClient.LeaveRoom().CatchUnobservedExceptions();
|
||||
multiplayerClient.LeaveRoom();
|
||||
|
||||
// Todo: This is not the way to do this. Basically when we're the only participant and the room closes, there's no way to know if this is actually the case.
|
||||
// This is delayed one frame because upon exiting the match subscreen, multiplayer updates the polling rate and messes with polling.
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -176,7 +175,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
if (Room.Host?.UserID != api.LocalUser.Value.Id)
|
||||
return;
|
||||
|
||||
Client.TransferHost(targetUser).CatchUnobservedExceptions(true);
|
||||
Client.TransferHost(targetUser);
|
||||
})
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user