Merge branch 'master' into hit-sample-pooling

This commit is contained in:
Dean Herbert 2020-12-03 17:08:13 +09:00 committed by GitHub
commit d7cfaa38f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 59 additions and 30 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1201.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.1201.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable enable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Utils; using osu.Framework.Utils;
@ -8,6 +10,7 @@ using osu.Game.Audio;
using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Utils;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects namespace osu.Game.Rulesets.Catch.Objects
@ -53,19 +56,22 @@ namespace osu.Game.Rulesets.Catch.Objects
private class BananaHitSampleInfo : HitSampleInfo, IEquatable<BananaHitSampleInfo> private class BananaHitSampleInfo : HitSampleInfo, IEquatable<BananaHitSampleInfo>
{ {
private static readonly string[] lookup_names = { "metronomelow", "catch-banana" }; private static readonly string[] lookup_names = { "Gameplay/metronomelow", "Gameplay/catch-banana" };
public override IEnumerable<string> LookupNames => lookup_names; public override IEnumerable<string> LookupNames => lookup_names;
public BananaHitSampleInfo() public BananaHitSampleInfo(int volume = 0)
: base(string.Empty) : base(string.Empty, volume: volume)
{ {
} }
public bool Equals(BananaHitSampleInfo other) public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
=> new BananaHitSampleInfo(newVolume.GetOr(Volume));
public bool Equals(BananaHitSampleInfo? other)
=> other != null; => other != null;
public override bool Equals(object obj) public override bool Equals(object? obj)
=> obj is BananaHitSampleInfo other && Equals(other); => obj is BananaHitSampleInfo other && Equals(other);
public override int GetHashCode() => lookup_names.GetHashCode(); public override int GetHashCode() => lookup_names.GetHashCode();

View File

@ -36,6 +36,8 @@ namespace osu.Game.Online.Spectator
private readonly List<int> watchingUsers = new List<int>(); private readonly List<int> watchingUsers = new List<int>();
private readonly object userLock = new object();
public IBindableList<int> PlayingUsers => playingUsers; public IBindableList<int> PlayingUsers => playingUsers;
private readonly BindableList<int> playingUsers = new BindableList<int>(); private readonly BindableList<int> playingUsers = new BindableList<int>();
@ -144,12 +146,19 @@ namespace osu.Game.Online.Spectator
await connection.StartAsync(); await connection.StartAsync();
Logger.Log("Spectator client connected!", LoggingTarget.Network); Logger.Log("Spectator client connected!", LoggingTarget.Network);
// get all the users that were previously being watched
int[] users;
lock (userLock)
{
users = watchingUsers.ToArray();
watchingUsers.Clear();
}
// success // success
isConnected = true; isConnected = true;
// resubscribe to watched users // resubscribe to watched users
var users = watchingUsers.ToArray();
watchingUsers.Clear();
foreach (var userId in users) foreach (var userId in users)
WatchUser(userId); WatchUser(userId);
@ -238,21 +247,29 @@ namespace osu.Game.Online.Spectator
public virtual void WatchUser(int userId) public virtual void WatchUser(int userId)
{ {
if (watchingUsers.Contains(userId)) lock (userLock)
return; {
if (watchingUsers.Contains(userId))
return;
watchingUsers.Add(userId); watchingUsers.Add(userId);
if (!isConnected) return; if (!isConnected)
return;
}
connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId); connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId);
} }
public void StopWatchingUser(int userId) public void StopWatchingUser(int userId)
{ {
watchingUsers.Remove(userId); lock (userLock)
{
watchingUsers.Remove(userId);
if (!isConnected) return; if (!isConnected)
return;
}
connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId); connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId);
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private readonly BindableBool rawInputToggle = new BindableBool(); private readonly BindableBool rawInputToggle = new BindableBool();
private Bindable<double> sensitivityBindable = new BindableDouble(); private Bindable<double> sensitivityBindable = new BindableDouble();
private Bindable<string> ignoredInputHandler; private Bindable<string> ignoredInputHandlers;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
@ -75,20 +75,20 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{ {
// this is temporary until we support per-handler settings. // this is temporary until we support per-handler settings.
const string raw_mouse_handler = @"OsuTKRawMouseHandler"; const string raw_mouse_handler = @"OsuTKRawMouseHandler";
const string standard_mouse_handler = @"OsuTKMouseHandler"; const string standard_mouse_handlers = @"OsuTKMouseHandler MouseHandler";
ignoredInputHandler.Value = enabled.NewValue ? standard_mouse_handler : raw_mouse_handler; ignoredInputHandlers.Value = enabled.NewValue ? standard_mouse_handlers : raw_mouse_handler;
}; };
ignoredInputHandler = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers); ignoredInputHandlers = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
ignoredInputHandler.ValueChanged += handler => ignoredInputHandlers.ValueChanged += handler =>
{ {
bool raw = !handler.NewValue.Contains("Raw"); bool raw = !handler.NewValue.Contains("Raw");
rawInputToggle.Value = raw; rawInputToggle.Value = raw;
sensitivityBindable.Disabled = !raw; sensitivityBindable.Disabled = !raw;
}; };
ignoredInputHandler.TriggerChange(); ignoredInputHandlers.TriggerChange();
} }
} }

View File

@ -106,6 +106,12 @@ namespace osu.Game.Screens.Edit
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, GameHost host, OsuConfigManager config) private void load(OsuColour colours, GameHost host, OsuConfigManager config)
{ {
if (Beatmap.Value is DummyWorkingBeatmap)
{
isNewBeatmap = true;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
}
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor; beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;
beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue); beatDivisor.BindValueChanged(divisor => Beatmap.Value.BeatmapInfo.BeatDivisor = divisor.NewValue);
@ -122,12 +128,6 @@ namespace osu.Game.Screens.Edit
// todo: remove caching of this and consume via editorBeatmap? // todo: remove caching of this and consume via editorBeatmap?
dependencies.Cache(beatDivisor); dependencies.Cache(beatDivisor);
if (Beatmap.Value is DummyWorkingBeatmap)
{
isNewBeatmap = true;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
}
try try
{ {
playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset); playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);

View File

@ -100,8 +100,14 @@ namespace osu.Game.Screens.Select.Carousel
background = new DelayedLoadWrapper(() => new SetPanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault())) background = new DelayedLoadWrapper(() => new SetPanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, 300), }, 300)
mainFlow = new DelayedLoadWrapper(() => new SetPanelContent((CarouselBeatmapSet)Item), 100), {
RelativeSizeAxes = Axes.Both
},
mainFlow = new DelayedLoadWrapper(() => new SetPanelContent((CarouselBeatmapSet)Item), 100)
{
RelativeSizeAxes = Axes.Both
},
}; };
background.DelayedLoadComplete += fadeContentIn; background.DelayedLoadComplete += fadeContentIn;

View File

@ -27,7 +27,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.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.1201.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.1201.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
<PackageReference Include="Sentry" Version="2.1.8" /> <PackageReference Include="Sentry" Version="2.1.8" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1201.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1201.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1030.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1202.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
<PropertyGroup> <PropertyGroup>