mirror of
https://github.com/ppy/osu.git
synced 2025-01-18 11:02:57 +08:00
Merge branch 'master' into show-in-windows-association-menus and adapt ApplicationCapability
This commit is contained in:
commit
dc23534a57
@ -51,8 +51,11 @@ dotnet_diagnostic.IDE1006.severity = warning
|
||||
# Too many noisy warnings for parsing/formatting numbers
|
||||
dotnet_diagnostic.CA1305.severity = none
|
||||
|
||||
# messagepack complains about "osu" not being title cased due to reserved words
|
||||
dotnet_diagnostic.CS8981.severity = none
|
||||
|
||||
# CA1507: Use nameof to express symbol names
|
||||
# Flaggs serialization name attributes
|
||||
# Flags serialization name attributes
|
||||
dotnet_diagnostic.CA1507.severity = suggestion
|
||||
|
||||
# CA1806: Do not ignore method results
|
||||
|
@ -9,9 +9,9 @@
|
||||
<GenerateProgramFile>false</GenerateProgramFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu.Game.Rulesets.EmptyFreeform\osu.Game.Rulesets.EmptyFreeform.csproj" />
|
||||
|
@ -9,9 +9,9 @@
|
||||
<GenerateProgramFile>false</GenerateProgramFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu.Game.Rulesets.Pippidon\osu.Game.Rulesets.Pippidon.csproj" />
|
||||
|
@ -9,9 +9,9 @@
|
||||
<GenerateProgramFile>false</GenerateProgramFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu.Game.Rulesets.EmptyScrolling\osu.Game.Rulesets.EmptyScrolling.csproj" />
|
||||
|
@ -9,9 +9,9 @@
|
||||
<GenerateProgramFile>false</GenerateProgramFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu.Game.Rulesets.Pippidon\osu.Game.Rulesets.Pippidon.csproj" />
|
||||
|
@ -61,14 +61,13 @@ namespace osu.Desktop.Windows
|
||||
/// Installs file and URI associations.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Call <see cref="UpdateDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||
/// Call <see cref="LocaliseDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||
/// </remarks>
|
||||
public static void InstallAssociations()
|
||||
{
|
||||
try
|
||||
{
|
||||
updateAssociations();
|
||||
updateDescriptions(null); // write default descriptions in case `UpdateDescriptions()` is not called.
|
||||
NotifyShellUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -81,17 +80,13 @@ namespace osu.Desktop.Windows
|
||||
/// Updates associations with latest definitions.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Call <see cref="UpdateDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||
/// Call <see cref="LocaliseDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||
/// </remarks>
|
||||
public static void UpdateAssociations()
|
||||
{
|
||||
try
|
||||
{
|
||||
updateAssociations();
|
||||
|
||||
// TODO: Remove once UpdateDescriptions() is called as specified in the xmldoc.
|
||||
updateDescriptions(null); // always write default descriptions, in case of updating from an older version in which file associations were not implemented/installed
|
||||
|
||||
NotifyShellUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -100,11 +95,19 @@ namespace osu.Desktop.Windows
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateDescriptions(LocalisationManager localisationManager)
|
||||
// TODO: call this sometime.
|
||||
public static void LocaliseDescriptions(LocalisationManager localisationManager)
|
||||
{
|
||||
try
|
||||
{
|
||||
updateDescriptions(localisationManager);
|
||||
application_capability.LocaliseDescription(localisationManager);
|
||||
|
||||
foreach (var association in file_associations)
|
||||
association.LocaliseDescription(localisationManager);
|
||||
|
||||
foreach (var association in uri_associations)
|
||||
association.LocaliseDescription(localisationManager);
|
||||
|
||||
NotifyShellUpdate();
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -152,19 +155,6 @@ namespace osu.Desktop.Windows
|
||||
application_capability.RegisterUriAssociations(uri_associations);
|
||||
}
|
||||
|
||||
private static void updateDescriptions(LocalisationManager? localisation)
|
||||
{
|
||||
application_capability.UpdateDescription(getLocalisedString(application_capability.Description));
|
||||
|
||||
foreach (var association in file_associations)
|
||||
association.UpdateDescription(getLocalisedString(association.Description));
|
||||
|
||||
foreach (var association in uri_associations)
|
||||
association.UpdateDescription(getLocalisedString(association.Description));
|
||||
|
||||
string getLocalisedString(LocalisableString s) => localisation?.GetLocalisedString(s) ?? s.ToString();
|
||||
}
|
||||
|
||||
#region Native interop
|
||||
|
||||
[DllImport("Shell32.dll")]
|
||||
@ -188,26 +178,37 @@ namespace osu.Desktop.Windows
|
||||
|
||||
#endregion
|
||||
|
||||
private record ApplicationCapability(string UniqueName, string CapabilityPath, LocalisableString Description)
|
||||
private class ApplicationCapability
|
||||
{
|
||||
private string uniqueName { get; }
|
||||
private string capabilityPath { get; }
|
||||
private LocalisableString description { get; }
|
||||
|
||||
public ApplicationCapability(string uniqueName, string capabilityPath, LocalisableString description)
|
||||
{
|
||||
this.uniqueName = uniqueName;
|
||||
this.capabilityPath = capabilityPath;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers an application capability according to <see href="https://learn.microsoft.com/en-us/windows/win32/shell/default-programs#registering-an-application-for-use-with-default-programs">
|
||||
/// Registering an Application for Use with Default Programs</see>.
|
||||
/// </summary>
|
||||
public void Install()
|
||||
{
|
||||
using (Registry.CurrentUser.CreateSubKey(CapabilityPath))
|
||||
using (var capability = Registry.CurrentUser.CreateSubKey(capabilityPath))
|
||||
{
|
||||
// create an empty "capability" key, other methods will fill it with information
|
||||
capability.SetValue(@"ApplicationDescription", description.ToString());
|
||||
}
|
||||
|
||||
using (var registeredApplications = Registry.CurrentUser.OpenSubKey(software_registered_applications, true))
|
||||
registeredApplications?.SetValue(UniqueName, CapabilityPath);
|
||||
registeredApplications?.SetValue(uniqueName, capabilityPath);
|
||||
}
|
||||
|
||||
public void RegisterFileAssociations(FileAssociation[] associations)
|
||||
{
|
||||
using var capability = Registry.CurrentUser.OpenSubKey(CapabilityPath, true);
|
||||
using var capability = Registry.CurrentUser.OpenSubKey(capabilityPath, true);
|
||||
if (capability == null) return;
|
||||
|
||||
using var fileAssociations = capability.CreateSubKey(@"FileAssociations");
|
||||
@ -218,7 +219,7 @@ namespace osu.Desktop.Windows
|
||||
|
||||
public void RegisterUriAssociations(UriAssociation[] associations)
|
||||
{
|
||||
using var capability = Registry.CurrentUser.OpenSubKey(CapabilityPath, true);
|
||||
using var capability = Registry.CurrentUser.OpenSubKey(capabilityPath, true);
|
||||
if (capability == null) return;
|
||||
|
||||
using var urlAssociations = capability.CreateSubKey(@"UrlAssociations");
|
||||
@ -227,27 +228,38 @@ namespace osu.Desktop.Windows
|
||||
urlAssociations.SetValue(association.Protocol, association.ProgramId);
|
||||
}
|
||||
|
||||
public void UpdateDescription(string description)
|
||||
public void LocaliseDescription(LocalisationManager localisationManager)
|
||||
{
|
||||
using (var capability = Registry.CurrentUser.OpenSubKey(CapabilityPath, true))
|
||||
using (var capability = Registry.CurrentUser.OpenSubKey(capabilityPath, true))
|
||||
{
|
||||
capability?.SetValue(@"ApplicationDescription", description);
|
||||
capability?.SetValue(@"ApplicationDescription", localisationManager.GetLocalisedString(description));
|
||||
}
|
||||
}
|
||||
|
||||
public void Uninstall()
|
||||
{
|
||||
using (var registeredApplications = Registry.CurrentUser.OpenSubKey(software_registered_applications, true))
|
||||
registeredApplications?.DeleteValue(UniqueName, throwOnMissingValue: false);
|
||||
registeredApplications?.DeleteValue(uniqueName, throwOnMissingValue: false);
|
||||
|
||||
Registry.CurrentUser.DeleteSubKeyTree(CapabilityPath, throwOnMissingSubKey: false);
|
||||
Registry.CurrentUser.DeleteSubKeyTree(capabilityPath, throwOnMissingSubKey: false);
|
||||
}
|
||||
}
|
||||
|
||||
private record FileAssociation(string Extension, LocalisableString Description, string IconPath)
|
||||
private class FileAssociation
|
||||
{
|
||||
public string ProgramId => $@"{program_id_file_prefix}{Extension}";
|
||||
|
||||
public string Extension { get; }
|
||||
private LocalisableString description { get; }
|
||||
private string iconPath { get; }
|
||||
|
||||
public FileAssociation(string extension, LocalisableString description, string iconPath)
|
||||
{
|
||||
Extension = extension;
|
||||
this.description = description;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Installs a file extension association in accordance with https://learn.microsoft.com/en-us/windows/win32/com/-progid--key
|
||||
/// </summary>
|
||||
@ -259,8 +271,10 @@ namespace osu.Desktop.Windows
|
||||
// register a program id for the given extension
|
||||
using (var programKey = classes.CreateSubKey(ProgramId))
|
||||
{
|
||||
programKey.SetValue(null, description.ToString());
|
||||
|
||||
using (var defaultIconKey = programKey.CreateSubKey(default_icon))
|
||||
defaultIconKey.SetValue(null, IconPath);
|
||||
defaultIconKey.SetValue(null, iconPath);
|
||||
|
||||
using (var openCommandKey = programKey.CreateSubKey(SHELL_OPEN_COMMAND))
|
||||
openCommandKey.SetValue(null, $@"""{exe_path}"" ""%1""");
|
||||
@ -280,13 +294,13 @@ namespace osu.Desktop.Windows
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDescription(string description)
|
||||
public void LocaliseDescription(LocalisationManager localisationManager)
|
||||
{
|
||||
using var classes = Registry.CurrentUser.OpenSubKey(software_classes, true);
|
||||
if (classes == null) return;
|
||||
|
||||
using (var programKey = classes.OpenSubKey(ProgramId, true))
|
||||
programKey?.SetValue(null, description);
|
||||
programKey?.SetValue(null, localisationManager.GetLocalisedString(description));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -307,13 +321,24 @@ namespace osu.Desktop.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private record UriAssociation(string Protocol, LocalisableString Description, string IconPath)
|
||||
private class UriAssociation
|
||||
{
|
||||
/// <summary>
|
||||
/// "The <c>URL Protocol</c> string value indicates that this key declares a custom pluggable protocol handler."
|
||||
/// See https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa767914(v=vs.85).
|
||||
/// </summary>
|
||||
public const string URL_PROTOCOL = @"URL Protocol";
|
||||
private const string url_protocol = @"URL Protocol";
|
||||
|
||||
public string Protocol { get; }
|
||||
private LocalisableString description { get; }
|
||||
private string iconPath { get; }
|
||||
|
||||
public UriAssociation(string protocol, LocalisableString description, string iconPath)
|
||||
{
|
||||
Protocol = protocol;
|
||||
this.description = description;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
public string ProgramId => $@"{program_id_protocol_prefix}.{Protocol}";
|
||||
|
||||
@ -327,7 +352,8 @@ namespace osu.Desktop.Windows
|
||||
|
||||
using (var protocolKey = classes.CreateSubKey(Protocol))
|
||||
{
|
||||
protocolKey.SetValue(URL_PROTOCOL, string.Empty);
|
||||
protocolKey.SetValue(null, $@"URL:{description}");
|
||||
protocolKey.SetValue(url_protocol, string.Empty);
|
||||
|
||||
// clear out old data
|
||||
protocolKey.DeleteSubKeyTree(default_icon, throwOnMissingSubKey: false);
|
||||
@ -338,20 +364,20 @@ namespace osu.Desktop.Windows
|
||||
using (var programKey = classes.CreateSubKey(ProgramId))
|
||||
{
|
||||
using (var defaultIconKey = programKey.CreateSubKey(default_icon))
|
||||
defaultIconKey.SetValue(null, IconPath);
|
||||
defaultIconKey.SetValue(null, iconPath);
|
||||
|
||||
using (var openCommandKey = programKey.CreateSubKey(SHELL_OPEN_COMMAND))
|
||||
openCommandKey.SetValue(null, $@"""{exe_path}"" ""%1""");
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDescription(string description)
|
||||
public void LocaliseDescription(LocalisationManager localisationManager)
|
||||
{
|
||||
using var classes = Registry.CurrentUser.OpenSubKey(software_classes, true);
|
||||
if (classes == null) return;
|
||||
|
||||
using (var protocolKey = classes.OpenSubKey(Protocol, true))
|
||||
protocolKey?.SetValue(null, $@"URL:{description}");
|
||||
protocolKey?.SetValue(null, $@"URL:{localisationManager.GetLocalisedString(description)}");
|
||||
}
|
||||
|
||||
public void Uninstall()
|
||||
|
@ -24,9 +24,9 @@
|
||||
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="System.IO.Packaging" Version="8.0.1" />
|
||||
<PackageReference Include="System.IO.Packaging" Version="9.0.0" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.2.1.24" />
|
||||
<PackageReference Include="Velopack" Version="0.0.915" />
|
||||
<PackageReference Include="Velopack" Version="0.0.1053" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Resources">
|
||||
<EmbeddedResource Include="lazer.ico" />
|
||||
|
@ -9,7 +9,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
|
||||
<PackageReference Include="nunit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -626,7 +626,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)
|
||||
{
|
||||
if (BodyPiece.ReceivePositionalInputAt(screenSpacePos))
|
||||
if (BodyPiece.ReceivePositionalInputAt(screenSpacePos) && DrawableObject.Body.Alpha > 0)
|
||||
return true;
|
||||
|
||||
if (ControlPointVisualiser == null)
|
||||
|
@ -230,7 +230,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
// If samples aren't available at the exact start time of the object,
|
||||
// use samples (without additions) in the closest original hit object instead
|
||||
obj.Samples = samples ?? getClosestHitObject(originalHitObjects, obj.StartTime).Samples.Where(s => !HitSampleInfo.AllAdditions.Contains(s.Name)).ToList();
|
||||
obj.Samples = samples ?? getClosestHitObject(originalHitObjects, obj.StartTime).Samples.Where(s => !HitSampleInfo.ALL_ADDITIONS.Contains(s.Name)).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,6 +382,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
repeat.SuppressHitAnimations();
|
||||
|
||||
TailCircle.SuppressHitAnimations();
|
||||
|
||||
// This method is called every frame in editor contexts, thus the lack of need for transforms.
|
||||
|
||||
if (Time.Current >= HitStateUpdateTime)
|
||||
{
|
||||
// Apply the slider's alpha to *only* the body.
|
||||
// This allows start and – more importantly – end circles to fade slower than the overall slider.
|
||||
if (Alpha < 1)
|
||||
Body.Alpha = Alpha;
|
||||
Alpha = 1;
|
||||
}
|
||||
|
||||
LifetimeEnd = HitStateUpdateTime + 700;
|
||||
}
|
||||
|
||||
internal void RestoreHitAnimations()
|
||||
|
@ -5,12 +5,12 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
@ -75,44 +75,38 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
accentColour = drawableRepeat.AccentColour.GetBoundCopy();
|
||||
accentColour.BindValueChanged(accent => icon.Colour = accent.NewValue.Darken(4), true);
|
||||
|
||||
drawableRepeat.ApplyCustomUpdateState += updateStateTransforms;
|
||||
}
|
||||
|
||||
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (Time.Current >= drawableRepeat.HitStateUpdateTime && drawableRepeat.State.Value == ArmedState.Hit)
|
||||
{
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
Scale = new Vector2(Interpolation.ValueAt(Time.Current, 1, 1.5f, drawableRepeat.HitStateUpdateTime, drawableRepeat.HitStateUpdateTime + animDuration, Easing.Out));
|
||||
}
|
||||
else
|
||||
Scale = Vector2.One;
|
||||
|
||||
const float move_distance = -12;
|
||||
const float scale_amount = 1.3f;
|
||||
|
||||
const double move_out_duration = 35;
|
||||
const double move_in_duration = 250;
|
||||
const double total = 300;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
main.ScaleTo(1.3f, move_out_duration, Easing.Out)
|
||||
.Then()
|
||||
.ScaleTo(1f, move_in_duration, Easing.Out)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
side
|
||||
.MoveToX(move_distance, move_out_duration, Easing.Out)
|
||||
.Then()
|
||||
.MoveToX(0, move_in_duration, Easing.Out)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
break;
|
||||
double loopCurrentTime = (Time.Current - drawableRepeat.AnimationStartTime.Value) % total;
|
||||
|
||||
case ArmedState.Hit:
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
this.ScaleTo(1.5f, animDuration, Easing.Out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (loopCurrentTime < move_out_duration)
|
||||
main.Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, 1, scale_amount, 0, move_out_duration, Easing.Out));
|
||||
else
|
||||
main.Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, scale_amount, 1f, move_out_duration, move_out_duration + move_in_duration, Easing.Out));
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (drawableRepeat.IsNotNull())
|
||||
drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
|
||||
if (loopCurrentTime < move_out_duration)
|
||||
side.X = Interpolation.ValueAt(loopCurrentTime, 0, move_distance, 0, move_out_duration, Easing.Out);
|
||||
else
|
||||
side.X = Interpolation.ValueAt(loopCurrentTime, move_distance, 0, move_out_duration, move_out_duration + move_in_duration, Easing.Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
@ -40,37 +40,31 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
private void load(DrawableHitObject drawableObject)
|
||||
{
|
||||
drawableRepeat = (DrawableSliderRepeat)drawableObject;
|
||||
drawableRepeat.ApplyCustomUpdateState += updateStateTransforms;
|
||||
}
|
||||
|
||||
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (Time.Current >= drawableRepeat.HitStateUpdateTime && drawableRepeat.State.Value == ArmedState.Hit)
|
||||
{
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
Scale = new Vector2(Interpolation.ValueAt(Time.Current, 1, 1.5f, drawableRepeat.HitStateUpdateTime, drawableRepeat.HitStateUpdateTime + animDuration, Easing.Out));
|
||||
}
|
||||
else
|
||||
{
|
||||
const float scale_amount = 1.3f;
|
||||
|
||||
const double move_out_duration = 35;
|
||||
const double move_in_duration = 250;
|
||||
const double total = 300;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
InternalChild.ScaleTo(1.3f, move_out_duration, Easing.Out)
|
||||
.Then()
|
||||
.ScaleTo(1f, move_in_duration, Easing.Out)
|
||||
.Loop(total - (move_in_duration + move_out_duration));
|
||||
break;
|
||||
|
||||
case ArmedState.Hit:
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
InternalChild.ScaleTo(1.5f, animDuration, Easing.Out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (drawableRepeat.IsNotNull())
|
||||
drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
|
||||
double loopCurrentTime = (Time.Current - drawableRepeat.AnimationStartTime.Value) % total;
|
||||
if (loopCurrentTime < move_out_duration)
|
||||
Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, 1, scale_amount, 0, move_out_duration, Easing.Out));
|
||||
else
|
||||
Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, scale_amount, 1f, move_out_duration, move_out_duration + move_in_duration, Easing.Out));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,12 @@ using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
@ -51,8 +53,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
textureIsDefaultSkin = skin is ISkinTransformer transformer && transformer.Skin is DefaultLegacySkin;
|
||||
|
||||
drawableObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||
|
||||
shouldRotate = skinSource.GetConfig<SkinConfiguration.LegacySetting, decimal>(SkinConfiguration.LegacySetting.Version)?.Value <= 1;
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
accentColour = drawableRepeat.AccentColour.GetBoundCopy();
|
||||
accentColour.BindValueChanged(c =>
|
||||
{
|
||||
arrow.Colour = textureIsDefaultSkin && c.NewValue.R + c.NewValue.G + c.NewValue.B > (600 / 255f) ? Color4.Black : Color4.White;
|
||||
arrow.Colour = textureIsDefaultSkin && c.NewValue.R + c.NewValue.G + c.NewValue.B > 600 / 255f ? Color4.Black : Color4.White;
|
||||
}, true);
|
||||
}
|
||||
|
||||
@ -80,36 +80,32 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
drawableRepeat.DrawableSlider.OverlayElementContainer.Add(proxy);
|
||||
}
|
||||
|
||||
private void updateStateTransforms(DrawableHitObject hitObject, ArmedState state)
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (Time.Current >= drawableRepeat.HitStateUpdateTime && drawableRepeat.State.Value == ArmedState.Hit)
|
||||
{
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
arrow.Scale = new Vector2(Interpolation.ValueAt(Time.Current, 1, 1.4f, drawableRepeat.HitStateUpdateTime, drawableRepeat.HitStateUpdateTime + animDuration, Easing.Out));
|
||||
}
|
||||
else
|
||||
{
|
||||
const double duration = 300;
|
||||
const float rotation = 5.625f;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ArmedState.Idle:
|
||||
double loopCurrentTime = (Time.Current - drawableRepeat.AnimationStartTime.Value) % duration;
|
||||
|
||||
// Reference: https://github.com/peppy/osu-stable-reference/blob/2280c4c436f80d04f9c79d3c905db00ac2902273/osu!/GameplayElements/HitObjects/Osu/HitCircleSliderEnd.cs#L79-L96
|
||||
if (shouldRotate)
|
||||
{
|
||||
InternalChild.ScaleTo(1.3f)
|
||||
.RotateTo(rotation)
|
||||
.Then()
|
||||
.ScaleTo(1f, duration)
|
||||
.RotateTo(-rotation, duration)
|
||||
.Loop();
|
||||
arrow.Rotation = Interpolation.ValueAt(loopCurrentTime, rotation, -rotation, 0, duration);
|
||||
arrow.Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, 1.3f, 1, 0, duration));
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalChild.ScaleTo(1.3f).Then()
|
||||
.ScaleTo(1f, duration, Easing.Out)
|
||||
.Loop();
|
||||
arrow.Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, 1.3f, 1, 0, duration, Easing.Out));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ArmedState.Hit:
|
||||
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
|
||||
InternalChild.ScaleTo(1.4f, animDuration, Easing.Out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +116,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
if (drawableRepeat.IsNotNull())
|
||||
{
|
||||
drawableRepeat.HitObjectApplied -= onHitObjectApplied;
|
||||
drawableRepeat.ApplyCustomUpdateState -= updateStateTransforms;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -112,5 +112,20 @@ namespace osu.Game.Tests.Beatmaps
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRepeatsGeneratedEvenForZeroLengthSlider()
|
||||
{
|
||||
var events = SliderEventGenerator.Generate(start_time, span_duration, 1, span_duration / 2, 0, 2).ToArray();
|
||||
|
||||
Assert.That(events[0].Type, Is.EqualTo(SliderEventType.Head));
|
||||
Assert.That(events[0].Time, Is.EqualTo(start_time));
|
||||
|
||||
Assert.That(events[1].Type, Is.EqualTo(SliderEventType.Repeat));
|
||||
Assert.That(events[1].Time, Is.EqualTo(span_duration));
|
||||
|
||||
Assert.That(events[3].Type, Is.EqualTo(SliderEventType.Tail));
|
||||
Assert.That(events[3].Time, Is.EqualTo(span_duration * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -539,5 +539,85 @@ namespace osu.Game.Tests.Editing
|
||||
Assert.That(beatmap.Breaks[0].EndTime, Is.EqualTo(5000 - OsuHitObject.PREEMPT_MAX));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPuttingObjectBetweenBreakEndAndAnotherObjectForcesNewCombo()
|
||||
{
|
||||
var controlPoints = new ControlPointInfo();
|
||||
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||
var beatmap = new EditorBeatmap(new Beatmap
|
||||
{
|
||||
ControlPointInfo = controlPoints,
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo },
|
||||
Difficulty =
|
||||
{
|
||||
ApproachRate = 10,
|
||||
},
|
||||
HitObjects =
|
||||
{
|
||||
new HitCircle { StartTime = 1000, NewCombo = true },
|
||||
new HitCircle { StartTime = 4500 },
|
||||
new HitCircle { StartTime = 5000, NewCombo = true },
|
||||
},
|
||||
Breaks =
|
||||
{
|
||||
new BreakPeriod(2000, 4000),
|
||||
}
|
||||
});
|
||||
|
||||
foreach (var ho in beatmap.HitObjects)
|
||||
ho.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
|
||||
|
||||
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||
beatmapProcessor.PreProcess();
|
||||
beatmapProcessor.PostProcess();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[1]).NewCombo, Is.True);
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[2]).NewCombo, Is.True);
|
||||
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[0]).ComboIndex, Is.EqualTo(1));
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[1]).ComboIndex, Is.EqualTo(2));
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[2]).ComboIndex, Is.EqualTo(3));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAutomaticallyInsertedBreakForcesNewCombo()
|
||||
{
|
||||
var controlPoints = new ControlPointInfo();
|
||||
controlPoints.Add(0, new TimingControlPoint { BeatLength = 500 });
|
||||
var beatmap = new EditorBeatmap(new Beatmap
|
||||
{
|
||||
ControlPointInfo = controlPoints,
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo },
|
||||
Difficulty =
|
||||
{
|
||||
ApproachRate = 10,
|
||||
},
|
||||
HitObjects =
|
||||
{
|
||||
new HitCircle { StartTime = 1000, NewCombo = true },
|
||||
new HitCircle { StartTime = 5000 },
|
||||
},
|
||||
});
|
||||
|
||||
foreach (var ho in beatmap.HitObjects)
|
||||
ho.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
|
||||
|
||||
var beatmapProcessor = new EditorBeatmapProcessor(beatmap, new OsuRuleset());
|
||||
beatmapProcessor.PreProcess();
|
||||
beatmapProcessor.PostProcess();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(beatmap.Breaks, Has.Count.EqualTo(1));
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[1]).NewCombo, Is.True);
|
||||
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[0]).ComboIndex, Is.EqualTo(1));
|
||||
Assert.That(((HitCircle)beatmap.HitObjects[1]).ComboIndex, Is.EqualTo(2));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Components;
|
||||
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
||||
using osu.Game.Screens.Edit.GameplayTest;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -127,6 +128,35 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("sample playback re-enabled", () => !Editor.SamplePlaybackDisabled.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGameplayTestResetsPlaybackSpeedAdjustment()
|
||||
{
|
||||
AddStep("start track", () => EditorClock.Start());
|
||||
AddStep("change playback speed", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(this.ChildrenOfType<PlaybackControl.PlaybackTabControl.PlaybackTabItem>().First());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddAssert("track playback rate is 0.25x", () => Beatmap.Value.Track.AggregateTempo.Value, () => Is.EqualTo(0.25));
|
||||
|
||||
AddStep("click test gameplay button", () =>
|
||||
{
|
||||
var button = Editor.ChildrenOfType<TestGameplayButton>().Single();
|
||||
|
||||
InputManager.MoveMouseTo(button);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
EditorPlayer editorPlayer = null;
|
||||
AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null);
|
||||
AddAssert("editor track stopped", () => !EditorClock.IsRunning);
|
||||
AddAssert("track playback rate is 1x", () => Beatmap.Value.Track.AggregateTempo.Value, () => Is.EqualTo(1));
|
||||
|
||||
AddStep("exit player", () => editorPlayer.Exit());
|
||||
AddUntilStep("current screen is editor", () => Stack.CurrentScreen is Editor);
|
||||
AddAssert("track playback rate is 0.25x", () => Beatmap.Value.Track.AggregateTempo.Value, () => Is.EqualTo(0.25));
|
||||
}
|
||||
|
||||
[TestCase(2000)] // chosen to be after last object in the map
|
||||
[TestCase(22000)] // chosen to be in the middle of the last spinner
|
||||
public void TestGameplayTestAtEndOfBeatmap(int offsetFromEnd)
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
|
||||
protected OsuScreenStack IntroStack;
|
||||
|
||||
private IntroScreen intro;
|
||||
protected IntroScreen Intro { get; private set; }
|
||||
|
||||
[Cached(typeof(INotificationOverlay))]
|
||||
private NotificationOverlay notifications;
|
||||
@ -62,22 +62,9 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
[Test]
|
||||
public virtual void TestPlayIntro()
|
||||
{
|
||||
AddStep("restart sequence", () =>
|
||||
{
|
||||
logo.FinishTransforms();
|
||||
logo.IsTracking = false;
|
||||
RestartIntro();
|
||||
|
||||
IntroStack?.Expire();
|
||||
|
||||
Add(IntroStack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
IntroStack.Push(intro = CreateScreen());
|
||||
});
|
||||
|
||||
AddUntilStep("wait for menu", () => intro.DidLoadMenu);
|
||||
WaitForMenu();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -103,18 +90,18 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
IntroStack.Push(intro = CreateScreen());
|
||||
IntroStack.Push(Intro = CreateScreen());
|
||||
});
|
||||
|
||||
AddStep("trigger failure", () =>
|
||||
{
|
||||
trackResetDelegate = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
intro.Beatmap.Value.Track.Seek(0);
|
||||
Intro.Beatmap.Value.Track.Seek(0);
|
||||
}, 0, true);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for menu", () => intro.DidLoadMenu);
|
||||
WaitForMenu();
|
||||
|
||||
if (IntroReliesOnTrack)
|
||||
AddUntilStep("wait for notification", () => notifications.UnreadCount.Value == 1);
|
||||
@ -122,6 +109,29 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
AddStep("uninstall delegate", () => trackResetDelegate?.Cancel());
|
||||
}
|
||||
|
||||
protected void RestartIntro()
|
||||
{
|
||||
AddStep("restart sequence", () =>
|
||||
{
|
||||
logo.FinishTransforms();
|
||||
logo.IsTracking = false;
|
||||
|
||||
IntroStack?.Expire();
|
||||
|
||||
Add(IntroStack = new OsuScreenStack
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
});
|
||||
|
||||
IntroStack.Push(Intro = CreateScreen());
|
||||
});
|
||||
}
|
||||
|
||||
protected void WaitForMenu()
|
||||
{
|
||||
AddUntilStep("wait for menu", () => Intro.DidLoadMenu);
|
||||
}
|
||||
|
||||
protected abstract IntroScreen CreateScreen();
|
||||
}
|
||||
}
|
||||
|
37
osu.Game.Tests/Visual/Menus/TestSceneIntroIntegrity.cs
Normal file
37
osu.Game.Tests/Visual/Menus/TestSceneIntroIntegrity.cs
Normal file
@ -0,0 +1,37 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
[HeadlessTest]
|
||||
[TestFixture]
|
||||
public partial class TestSceneIntroIntegrity : IntroTestScene
|
||||
{
|
||||
[Test]
|
||||
public virtual void TestDeletedFilesRestored()
|
||||
{
|
||||
RestartIntro();
|
||||
WaitForMenu();
|
||||
|
||||
AddStep("delete game files unexpectedly", () => LocalStorage.DeleteDirectory("files"));
|
||||
AddStep("reset game beatmap", () => Dependencies.Get<Bindable<WorkingBeatmap>>().Value = new DummyWorkingBeatmap(Audio, null));
|
||||
AddStep("invalidate beatmap from cache", () => Dependencies.Get<IWorkingBeatmapCache>().Invalidate(Intro.Beatmap.Value.BeatmapSetInfo));
|
||||
|
||||
RestartIntro();
|
||||
WaitForMenu();
|
||||
|
||||
AddUntilStep("ensure track is not virtual", () => Intro.Beatmap.Value.Track is TrackBass);
|
||||
}
|
||||
|
||||
protected override bool IntroReliesOnTrack => true;
|
||||
protected override IntroScreen CreateScreen() => new IntroTriangles();
|
||||
}
|
||||
}
|
@ -3,29 +3,71 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Components;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public partial class TestSceneStarRatingRangeDisplay : OnlinePlayTestScene
|
||||
public partial class TestSceneStarRatingRangeDisplay : OsuTestScene
|
||||
{
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
private readonly Room room = new Room();
|
||||
|
||||
AddStep("create display", () =>
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
SelectedRoom.Value = new Room();
|
||||
base.LoadComplete();
|
||||
|
||||
Child = new StarRatingRangeDisplay(SelectedRoom.Value)
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(5),
|
||||
},
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(2),
|
||||
},
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(1),
|
||||
},
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.2f,
|
||||
Scale = new Vector2(5),
|
||||
},
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.2f,
|
||||
Scale = new Vector2(2),
|
||||
},
|
||||
new StarRatingRangeDisplay(room)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.2f,
|
||||
Scale = new Vector2(1),
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -33,10 +75,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
AddStep("set playlist", () =>
|
||||
{
|
||||
SelectedRoom.Value!.Playlist =
|
||||
room.Playlist =
|
||||
[
|
||||
new PlaylistItem(new BeatmapInfo { StarRating = min }),
|
||||
new PlaylistItem(new BeatmapInfo { StarRating = max }),
|
||||
new PlaylistItem(new BeatmapInfo { StarRating = min }) { ID = TestResources.GetNextTestID() },
|
||||
new PlaylistItem(new BeatmapInfo { StarRating = max }) { ID = TestResources.GetNextTestID() },
|
||||
];
|
||||
});
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
@ -85,6 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestPresentedBeatmapIsRecommended()
|
||||
{
|
||||
List<BeatmapSetInfo> beatmapSets = null;
|
||||
@ -106,6 +106,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestCurrentRulesetIsRecommended()
|
||||
{
|
||||
BeatmapSetInfo catchSet = null, mixedSet = null;
|
||||
@ -142,6 +143,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestSecondBestRulesetIsRecommended()
|
||||
{
|
||||
BeatmapSetInfo osuSet = null, mixedSet = null;
|
||||
@ -159,6 +161,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestCorrectStarRatingIsUsed()
|
||||
{
|
||||
BeatmapSetInfo osuSet = null, maniaSet = null;
|
||||
@ -176,6 +179,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
public void TestBeatmapListingFilter()
|
||||
{
|
||||
AddStep("set playmode to taiko", () => ((DummyAPIAccess)API).LocalUser.Value.PlayMode = "taiko");
|
||||
@ -245,7 +249,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
|
||||
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect select && select.BeatmapSetsLoaded);
|
||||
AddUntilStep("recommended beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.MatchesOnlineID(getImport().Beatmaps[expectedDiff - 1]));
|
||||
AddUntilStep("recommended beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(getImport().Beatmaps[expectedDiff - 1].OnlineID));
|
||||
}
|
||||
|
||||
protected override TestOsuGame CreateTestGame() => new NoBeatmapUpdateGame(LocalStorage, API);
|
||||
|
@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.TestProject.props" />
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="DeepEqual" Version="4.2.1" />
|
||||
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -4,9 +4,9 @@
|
||||
<StartupObject>osu.Game.Tournament.Tests.TournamentTestRunner</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -33,12 +33,12 @@ namespace osu.Game.Audio
|
||||
/// <summary>
|
||||
/// All valid sample addition constants.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> AllAdditions => new[] { HIT_WHISTLE, HIT_FINISH, HIT_CLAP };
|
||||
public static readonly string[] ALL_ADDITIONS = [HIT_WHISTLE, HIT_FINISH, HIT_CLAP];
|
||||
|
||||
/// <summary>
|
||||
/// All valid bank constants.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> AllBanks => new[] { BANK_NORMAL, BANK_SOFT, BANK_DRUM };
|
||||
public static readonly string[] ALL_BANKS = [BANK_NORMAL, BANK_SOFT, BANK_DRUM];
|
||||
|
||||
/// <summary>
|
||||
/// The name of the sample to load.
|
||||
|
@ -266,7 +266,7 @@ namespace osu.Game.Database
|
||||
/// <para>
|
||||
/// If a write transaction did not modify any objects in this <see cref="IRealmCollection{T}" />, the callback is not invoked at all.
|
||||
/// If an error occurs the callback will be invoked with <c>null</c> for the <c>sender</c> parameter and a non-<c>null</c> <c>error</c>.
|
||||
/// Currently the only errors that can occur are when opening the <see cref="Realm" /> on the background worker thread.
|
||||
/// Currently, the only errors that can occur are when opening the <see cref="Realm" /> on the background worker thread.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// At the time when the block is called, the <see cref="IRealmCollection{T}" /> object will be fully evaluated
|
||||
@ -285,8 +285,8 @@ namespace osu.Game.Database
|
||||
/// A subscription token. It must be kept alive for as long as you want to receive change notifications.
|
||||
/// To stop receiving notifications, call <see cref="IDisposable.Dispose" />.
|
||||
/// </returns>
|
||||
/// <seealso cref="Realms.CollectionExtensions.SubscribeForNotifications{T}(IList{T}, NotificationCallbackDelegate{T})" />
|
||||
/// <seealso cref="Realms.CollectionExtensions.SubscribeForNotifications{T}(IQueryable{T}, NotificationCallbackDelegate{T})" />
|
||||
/// <seealso cref="Realms.CollectionExtensions.SubscribeForNotifications{T}(IList{T}, NotificationCallbackDelegate{T},KeyPathsCollection?)" />
|
||||
/// <seealso cref="Realms.CollectionExtensions.SubscribeForNotifications{T}(IQueryable{T}, NotificationCallbackDelegate{T},KeyPathsCollection?)" />
|
||||
#pragma warning restore RS0030
|
||||
public static IDisposable QueryAsyncWithNotifications<T>(this IRealmCollection<T> collection, NotificationCallbackDelegate<T> callback)
|
||||
where T : RealmObjectBase
|
||||
|
@ -46,7 +46,8 @@ namespace osu.Game.Database
|
||||
}
|
||||
|
||||
public IRealmCollection<T> Freeze() => throw new NotImplementedException();
|
||||
public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback) => throw new NotImplementedException();
|
||||
public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback, KeyPathsCollection? keyPathCollection = null) => throw new NotImplementedException();
|
||||
|
||||
public bool IsValid => throw new NotImplementedException();
|
||||
public Realm Realm => throw new NotImplementedException();
|
||||
public ObjectSchema ObjectSchema => throw new NotImplementedException();
|
||||
|
@ -15,10 +15,9 @@ namespace osu.Game.Localisation
|
||||
public static LocalisableString Header => new TranslatableString(getKey(@"header"), @"Import");
|
||||
|
||||
/// <summary>
|
||||
/// "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will not affect your existing installation's files in any way."
|
||||
/// "If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will not affect your existing installation's files in any way."
|
||||
/// </summary>
|
||||
public static LocalisableString Description => new TranslatableString(getKey(@"description"),
|
||||
@"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will not affect your existing installation's files in any way.");
|
||||
public static LocalisableString Description => new TranslatableString(getKey(@"description"), @"If you have an installation of a previous osu! version, you can choose to migrate your existing content. Note that this will not affect your existing installation's files in any way.");
|
||||
|
||||
/// <summary>
|
||||
/// "previous osu! install"
|
||||
@ -38,8 +37,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Your import will continue in the background. Check on its progress in the notifications sidebar!"
|
||||
/// </summary>
|
||||
public static LocalisableString ImportInProgress =>
|
||||
new TranslatableString(getKey(@"import_in_progress"), @"Your import will continue in the background. Check on its progress in the notifications sidebar!");
|
||||
public static LocalisableString ImportInProgress => new TranslatableString(getKey(@"import_in_progress"), @"Your import will continue in the background. Check on its progress in the notifications sidebar!");
|
||||
|
||||
/// <summary>
|
||||
/// "calculating..."
|
||||
|
@ -84,12 +84,12 @@ Please try changing your audio device to a working setting.");
|
||||
public static LocalisableString LinkTypeNotSupported => new TranslatableString(getKey(@"unsupported_link_type"), @"This link type is not yet supported!");
|
||||
|
||||
/// <summary>
|
||||
/// "You received a private message from '{0}'. Click to read it!"
|
||||
/// "You received a private message from '{0}'. Click to read it!"
|
||||
/// </summary>
|
||||
public static LocalisableString PrivateMessageReceived(string username) => new TranslatableString(getKey(@"private_message_received"), @"You received a private message from '{0}'. Click to read it!", username);
|
||||
|
||||
/// <summary>
|
||||
/// "Your name was mentioned in chat by '{0}'. Click to find out why!"
|
||||
/// "Your name was mentioned in chat by '{0}'. Click to find out why!"
|
||||
/// </summary>
|
||||
public static LocalisableString YourNameWasMentioned(string username) => new TranslatableString(getKey(@"your_name_was_mentioned"), @"Your name was mentioned in chat by '{0}'. Click to find out why!", username);
|
||||
|
||||
@ -115,7 +115,7 @@ Please try changing your audio device to a working setting.");
|
||||
|
||||
/// <summary>
|
||||
/// "You are now running osu! {0}.
|
||||
/// Click to see what's new!"
|
||||
/// Click to see what's new!"
|
||||
/// </summary>
|
||||
public static LocalisableString GameVersionAfterUpdate(string version) => new TranslatableString(getKey(@"game_version_after_update"), @"You are now running osu! {0}.
|
||||
Click to see what's new!", version);
|
||||
|
@ -10,10 +10,12 @@ using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
public class ModSettingsDictionaryFormatter : IMessagePackFormatter<Dictionary<string, object>>
|
||||
public class ModSettingsDictionaryFormatter : IMessagePackFormatter<Dictionary<string, object>?>
|
||||
{
|
||||
public void Serialize(ref MessagePackWriter writer, Dictionary<string, object> value, MessagePackSerializerOptions options)
|
||||
public void Serialize(ref MessagePackWriter writer, Dictionary<string, object>? value, MessagePackSerializerOptions options)
|
||||
{
|
||||
if (value == null) return;
|
||||
|
||||
var primitiveFormatter = PrimitiveObjectFormatter.Instance;
|
||||
|
||||
writer.WriteArrayHeader(value.Count);
|
||||
|
@ -4,13 +4,16 @@
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
|
||||
|
||||
namespace osu.Game.Online.Chat
|
||||
@ -23,9 +26,15 @@ namespace osu.Game.Online.Chat
|
||||
[Resolved]
|
||||
private Clipboard clipboard { get; set; } = null!;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
[Resolved]
|
||||
private IDialogOverlay? dialogOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private INotificationOverlay? notificationOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
private Bindable<bool> externalLinkWarning = null!;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
@ -34,9 +43,51 @@ namespace osu.Game.Online.Chat
|
||||
externalLinkWarning = config.GetBindable<bool>(OsuSetting.ExternalLinkWarning);
|
||||
}
|
||||
|
||||
public void OpenUrlExternally(string url, bool bypassWarning = false)
|
||||
public void OpenUrlExternally(string url, LinkWarnMode warnMode = LinkWarnMode.Default)
|
||||
{
|
||||
if (!bypassWarning && externalLinkWarning.Value && dialogOverlay != null)
|
||||
bool isTrustedDomain;
|
||||
|
||||
if (url.StartsWith('/'))
|
||||
{
|
||||
url = $"{api.WebsiteRootUrl}{url}";
|
||||
isTrustedDomain = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isTrustedDomain = url.StartsWith(api.WebsiteRootUrl, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
if (!url.CheckIsValidUrl())
|
||||
{
|
||||
notificationOverlay?.Post(new SimpleErrorNotification
|
||||
{
|
||||
Text = NotificationsStrings.UnsupportedOrDangerousUrlProtocol(url),
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool shouldWarn;
|
||||
|
||||
switch (warnMode)
|
||||
{
|
||||
case LinkWarnMode.Default:
|
||||
shouldWarn = externalLinkWarning.Value && !isTrustedDomain;
|
||||
break;
|
||||
|
||||
case LinkWarnMode.AlwaysWarn:
|
||||
shouldWarn = true;
|
||||
break;
|
||||
|
||||
case LinkWarnMode.NeverWarn:
|
||||
shouldWarn = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(warnMode), warnMode, null);
|
||||
}
|
||||
|
||||
if (dialogOverlay != null && shouldWarn)
|
||||
dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url), () => clipboard.SetText(url)));
|
||||
else
|
||||
host.OpenUrlExternally(url);
|
||||
|
23
osu.Game/Online/Chat/LinkWarnMode.cs
Normal file
23
osu.Game/Online/Chat/LinkWarnMode.cs
Normal file
@ -0,0 +1,23 @@
|
||||
// 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.
|
||||
|
||||
namespace osu.Game.Online.Chat
|
||||
{
|
||||
public enum LinkWarnMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Will show a dialog when opening a URL that is not on a trusted domain.
|
||||
/// </summary>
|
||||
Default,
|
||||
|
||||
/// <summary>
|
||||
/// Will always show a dialog when opening a URL.
|
||||
/// </summary>
|
||||
AlwaysWarn,
|
||||
|
||||
/// <summary>
|
||||
/// Will never show a dialog when opening a URL.
|
||||
/// </summary>
|
||||
NeverWarn,
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using MessagePack;
|
||||
|
||||
namespace osu.Game.Online.Multiplayer.MatchTypes.TeamVersus
|
||||
{
|
||||
[MessagePackObject]
|
||||
public class TeamVersusUserState : MatchUserState
|
||||
{
|
||||
[Key(0)]
|
||||
|
@ -18,7 +18,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -516,32 +515,7 @@ namespace osu.Game
|
||||
onScreenDisplay.Display(new CopyUrlToast());
|
||||
});
|
||||
|
||||
public void OpenUrlExternally(string url, bool forceBypassExternalUrlWarning = false) => waitForReady(() => externalLinkOpener, _ =>
|
||||
{
|
||||
bool isTrustedDomain;
|
||||
|
||||
if (url.StartsWith('/'))
|
||||
{
|
||||
url = $"{API.WebsiteRootUrl}{url}";
|
||||
isTrustedDomain = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isTrustedDomain = url.StartsWith(API.WebsiteRootUrl, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
if (!url.CheckIsValidUrl())
|
||||
{
|
||||
Notifications.Post(new SimpleErrorNotification
|
||||
{
|
||||
Text = NotificationsStrings.UnsupportedOrDangerousUrlProtocol(url),
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
externalLinkOpener.OpenUrlExternally(url, forceBypassExternalUrlWarning || isTrustedDomain);
|
||||
});
|
||||
public void OpenUrlExternally(string url, LinkWarnMode warnMode = LinkWarnMode.Default) => waitForReady(() => externalLinkOpener, _ => externalLinkOpener.OpenUrlExternally(url, warnMode));
|
||||
|
||||
/// <summary>
|
||||
/// Open a specific channel in chat.
|
||||
@ -1340,7 +1314,7 @@ namespace osu.Game
|
||||
IconColour = Colours.YellowDark,
|
||||
Activated = () =>
|
||||
{
|
||||
OpenUrlExternally("https://opentabletdriver.net/Tablets", true);
|
||||
OpenUrlExternally("https://opentabletdriver.net/Tablets", LinkWarnMode.NeverWarn);
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
|
@ -315,6 +315,7 @@ namespace osu.Game
|
||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realm, API, LocalConfig));
|
||||
|
||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realm, API, Audio, Resources, Host, defaultBeatmap, difficultyCache, performOnlineLookups: true));
|
||||
dependencies.CacheAs<IWorkingBeatmapCache>(BeatmapManager);
|
||||
|
||||
dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API));
|
||||
dependencies.Cache(ScoreDownloader = new ScoreModelDownloader(ScoreManager, API));
|
||||
|
@ -18,6 +18,7 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
@ -213,7 +214,7 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
if (!string.IsNullOrEmpty(errors.Message))
|
||||
passwordDescription.AddErrors(new[] { errors.Message });
|
||||
|
||||
game?.OpenUrlExternally($"{errors.Redirect}?username={usernameTextBox.Text}&email={emailTextBox.Text}", true);
|
||||
game?.OpenUrlExternally($"{errors.Redirect}?username={usernameTextBox.Text}&email={emailTextBox.Text}", LinkWarnMode.NeverWarn);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
@ -87,7 +88,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
background.Colour = colours.Pink;
|
||||
|
||||
Action = () => game?.OpenUrlExternally(@"/home/support");
|
||||
// Easy to accidentally click so let's always show the open URL popup.
|
||||
Action = () => game?.OpenUrlExternally(@"/home/support", LinkWarnMode.AlwaysWarn);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -119,8 +119,8 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
string bank = parts[0];
|
||||
string sampleSet = parts[1];
|
||||
|
||||
return HitSampleInfo.AllBanks.Contains(bank)
|
||||
&& HitSampleInfo.AllAdditions.Append(HitSampleInfo.HIT_NORMAL).Any(sampleSet.StartsWith);
|
||||
return HitSampleInfo.ALL_BANKS.Contains(bank)
|
||||
&& HitSampleInfo.ALL_ADDITIONS.Append(HitSampleInfo.HIT_NORMAL).Any(sampleSet.StartsWith);
|
||||
}
|
||||
|
||||
public class IssueTemplateConsequentDelay : IssueTemplate
|
||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
++objectsWithoutHitsounds;
|
||||
}
|
||||
|
||||
private bool isHitsound(HitSampleInfo sample) => HitSampleInfo.AllAdditions.Any(sample.Name.Contains);
|
||||
private bool isHitsound(HitSampleInfo sample) => HitSampleInfo.ALL_ADDITIONS.Any(sample.Name.Contains);
|
||||
private bool isHitnormal(HitSampleInfo sample) => sample.Name.Contains(HitSampleInfo.HIT_NORMAL);
|
||||
|
||||
public abstract class IssueTemplateLongPeriod : IssueTemplate
|
||||
|
@ -44,13 +44,13 @@ namespace osu.Game.Rulesets.Objects
|
||||
PathProgress = 0,
|
||||
};
|
||||
|
||||
if (tickDistance != 0)
|
||||
{
|
||||
for (int span = 0; span < spanCount; span++)
|
||||
{
|
||||
double spanStartTime = startTime + span * spanDuration;
|
||||
bool reversed = span % 2 == 1;
|
||||
|
||||
if (tickDistance != 0)
|
||||
{
|
||||
var ticks = generateTicks(span, spanStartTime, spanDuration, reversed, length, tickDistance, minDistanceFromEnd, cancellationToken);
|
||||
|
||||
if (reversed)
|
||||
@ -61,6 +61,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
|
||||
foreach (var e in ticks)
|
||||
yield return e;
|
||||
}
|
||||
|
||||
if (span < spanCount - 1)
|
||||
{
|
||||
@ -74,7 +75,6 @@ namespace osu.Game.Rulesets.Objects
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double totalDuration = spanCount * spanDuration;
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -18,8 +17,6 @@ namespace osu.Game.Screens.Edit.Components
|
||||
|
||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
protected readonly IBindable<Track> Track = new Bindable<Track>();
|
||||
|
||||
public readonly Drawable Background;
|
||||
private readonly Container content;
|
||||
|
||||
@ -45,10 +42,9 @@ namespace osu.Game.Screens.Edit.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, EditorClock clock)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
Track.BindTo(clock.Track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@ -75,7 +76,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
}
|
||||
};
|
||||
|
||||
Track.BindValueChanged(tr => tr.NewValue?.AddAdjustment(AdjustableProperty.Tempo, tempoAdjustment), true);
|
||||
editorClock.AudioAdjustments.AddAdjustment(AdjustableProperty.Tempo, tempoAdjustment);
|
||||
|
||||
if (editor != null)
|
||||
currentScreenMode.BindTo(editor.Mode);
|
||||
@ -105,7 +106,8 @@ namespace osu.Game.Screens.Edit.Components
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
Track.Value?.RemoveAdjustment(AdjustableProperty.Tempo, tempoAdjustment);
|
||||
if (editorClock.IsNotNull())
|
||||
editorClock.AudioAdjustments.RemoveAdjustment(AdjustableProperty.Tempo, tempoAdjustment);
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
@ -148,7 +150,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
public LocalisableString TooltipText { get; set; }
|
||||
}
|
||||
|
||||
private partial class PlaybackTabControl : OsuTabControl<double>
|
||||
public partial class PlaybackTabControl : OsuTabControl<double>
|
||||
{
|
||||
private static readonly double[] tempo_values = { 0.25, 0.5, 0.75, 1 };
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osuTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -26,7 +26,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
[Resolved]
|
||||
protected EditorBeatmap EditorBeatmap { get; private set; } = null!;
|
||||
|
||||
protected readonly IBindable<Track> Track = new Bindable<Track>();
|
||||
[Resolved]
|
||||
private EditorClock editorClock { get; set; } = null!;
|
||||
|
||||
private readonly Container<T> content;
|
||||
|
||||
@ -35,22 +36,17 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
public TimelinePart(Container<T>? content = null)
|
||||
{
|
||||
AddInternal(this.content = content ?? new Container<T> { RelativeSizeAxes = Axes.Both });
|
||||
|
||||
beatmap.ValueChanged += _ =>
|
||||
{
|
||||
updateRelativeChildSize();
|
||||
};
|
||||
|
||||
Track.ValueChanged += _ => updateRelativeChildSize();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, EditorClock clock)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
LoadBeatmap(EditorBeatmap);
|
||||
|
||||
Track.BindTo(clock.Track);
|
||||
this.beatmap.ValueChanged += _ => updateRelativeChildSize();
|
||||
editorClock.TrackChanged += updateRelativeChildSize;
|
||||
updateRelativeChildSize();
|
||||
}
|
||||
|
||||
private void updateRelativeChildSize()
|
||||
@ -68,5 +64,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
{
|
||||
content.Clear();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (editorClock.IsNotNull())
|
||||
editorClock.TrackChanged -= updateRelativeChildSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// </summary>
|
||||
private void createStateBindables()
|
||||
{
|
||||
foreach (string bankName in HitSampleInfo.AllBanks.Prepend(HIT_BANK_AUTO))
|
||||
foreach (string bankName in HitSampleInfo.ALL_BANKS.Prepend(HIT_BANK_AUTO))
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
@ -143,7 +143,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
SelectionBankStates[bankName] = bindable;
|
||||
}
|
||||
|
||||
foreach (string bankName in HitSampleInfo.AllBanks.Prepend(HIT_BANK_AUTO))
|
||||
foreach (string bankName in HitSampleInfo.ALL_BANKS.Prepend(HIT_BANK_AUTO))
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
@ -216,7 +216,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
resetTernaryStates();
|
||||
|
||||
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||
foreach (string sampleName in HitSampleInfo.ALL_ADDITIONS)
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
|
@ -409,7 +409,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private void createStateBindables()
|
||||
{
|
||||
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||
foreach (string sampleName in HitSampleInfo.ALL_ADDITIONS)
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
@ -433,7 +433,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
selectionSampleStates[sampleName] = bindable;
|
||||
}
|
||||
|
||||
banks.AddRange(HitSampleInfo.AllBanks.Prepend(EditorSelectionHandler.HIT_BANK_AUTO));
|
||||
banks.AddRange(HitSampleInfo.ALL_BANKS.Prepend(EditorSelectionHandler.HIT_BANK_AUTO));
|
||||
}
|
||||
|
||||
private void updateTernaryStates()
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -49,6 +49,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
[Resolved]
|
||||
private EditorBeatmap editorBeatmap { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// The timeline's scroll position in the last frame.
|
||||
/// </summary>
|
||||
@ -86,8 +89,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private double trackLengthForZoom;
|
||||
|
||||
private readonly IBindable<Track> track = new Bindable<Track>();
|
||||
|
||||
public Timeline(Drawable userContent)
|
||||
{
|
||||
this.userContent = userContent;
|
||||
@ -101,7 +102,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours, OverlayColourProvider colourProvider, OsuConfigManager config)
|
||||
private void load(OsuColour colours, OverlayColourProvider colourProvider, OsuConfigManager config)
|
||||
{
|
||||
CentreMarker centreMarker;
|
||||
|
||||
@ -150,14 +151,16 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
controlPointsVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTimingChanges);
|
||||
ticksVisible = config.GetBindable<bool>(OsuSetting.EditorTimelineShowTicks);
|
||||
|
||||
track.BindTo(editorClock.Track);
|
||||
track.BindValueChanged(_ =>
|
||||
editorClock.TrackChanged += updateWaveform;
|
||||
updateWaveform();
|
||||
|
||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.TimelineZoom);
|
||||
}
|
||||
|
||||
private void updateWaveform()
|
||||
{
|
||||
waveform.Waveform = beatmap.Value.Waveform;
|
||||
Scheduler.AddOnce(applyVisualOffset, beatmap);
|
||||
}, true);
|
||||
|
||||
Zoom = (float)(defaultTimelineZoom * editorBeatmap.TimelineZoom);
|
||||
}
|
||||
|
||||
private void applyVisualOffset(IBindable<WorkingBeatmap> beatmap)
|
||||
@ -334,5 +337,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
double time = TimeAtPosition(Content.ToLocalSpace(screenSpacePosition).X);
|
||||
return new SnapResult(screenSpacePosition, beatSnapProvider.SnapTime(time));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (editorClock.IsNotNull())
|
||||
editorClock.TrackChanged -= updateWaveform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,9 +155,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
if (hitObject.GetEndTime() < editorClock.CurrentTime - timeline.VisibleRange / 2)
|
||||
break;
|
||||
|
||||
foreach (var sample in hitObject.Samples)
|
||||
for (int i = 0; i < hitObject.Samples.Count; i++)
|
||||
{
|
||||
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
|
||||
var sample = hitObject.Samples[i];
|
||||
|
||||
if (!HitSampleInfo.ALL_BANKS.Contains(sample.Bank))
|
||||
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
|
||||
}
|
||||
|
||||
@ -165,12 +167,19 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
{
|
||||
smallestTimeGap = Math.Min(smallestTimeGap, hasRepeats.Duration / hasRepeats.SpanCount() / 2);
|
||||
|
||||
foreach (var sample in hasRepeats.NodeSamples.SelectMany(s => s))
|
||||
for (int i = 0; i < hasRepeats.NodeSamples.Count; i++)
|
||||
{
|
||||
if (!HitSampleInfo.AllBanks.Contains(sample.Bank))
|
||||
var node = hasRepeats.NodeSamples[i];
|
||||
|
||||
for (int j = 0; j < node.Count; j++)
|
||||
{
|
||||
var sample = node[j];
|
||||
|
||||
if (!HitSampleInfo.ALL_BANKS.Contains(sample.Bank))
|
||||
minimumGap = Math.Max(minimumGap, absolute_minimum_gap + sample.Bank.Length * 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double gap = lastTime - hitObject.GetEndTime();
|
||||
|
||||
|
@ -861,6 +861,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
base.OnResuming(e);
|
||||
dimBackground();
|
||||
clock.BindAdjustments();
|
||||
}
|
||||
|
||||
private void dimBackground()
|
||||
@ -925,6 +926,10 @@ namespace osu.Game.Screens.Edit
|
||||
base.OnSuspending(e);
|
||||
clock.Stop();
|
||||
refetchBeatmap();
|
||||
// unfortunately ordering matters here.
|
||||
// this unbind MUST happen after `refetchBeatmap()`, because along other things, `refetchBeatmap()` causes a global working beatmap change,
|
||||
// which causes `EditorClock` to reload the track and automatically reapply adjustments to it.
|
||||
clock.UnbindAdjustments();
|
||||
}
|
||||
|
||||
private void refetchBeatmap()
|
||||
|
@ -41,6 +41,7 @@ namespace osu.Game.Screens.Edit
|
||||
rulesetBeatmapProcessor?.PostProcess();
|
||||
|
||||
autoGenerateBreaks();
|
||||
ensureNewComboAfterBreaks();
|
||||
}
|
||||
|
||||
private void autoGenerateBreaks()
|
||||
@ -100,5 +101,40 @@ namespace osu.Game.Screens.Edit
|
||||
Beatmap.Breaks.Add(breakPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureNewComboAfterBreaks()
|
||||
{
|
||||
var breakEnds = Beatmap.Breaks.Select(b => b.EndTime).OrderBy(t => t).ToList();
|
||||
|
||||
if (breakEnds.Count == 0)
|
||||
return;
|
||||
|
||||
int currentBreak = 0;
|
||||
|
||||
IHasComboInformation? lastObj = null;
|
||||
bool comboInformationUpdateRequired = false;
|
||||
|
||||
foreach (var hitObject in Beatmap.HitObjects)
|
||||
{
|
||||
if (hitObject is not IHasComboInformation hasCombo)
|
||||
continue;
|
||||
|
||||
if (currentBreak < breakEnds.Count && hitObject.StartTime >= breakEnds[currentBreak])
|
||||
{
|
||||
if (!hasCombo.NewCombo)
|
||||
{
|
||||
hasCombo.NewCombo = true;
|
||||
comboInformationUpdateRequired = true;
|
||||
}
|
||||
|
||||
currentBreak += 1;
|
||||
}
|
||||
|
||||
if (comboInformationUpdateRequired)
|
||||
hasCombo.UpdateComboInformation(lastObj);
|
||||
|
||||
lastObj = hasCombo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -23,12 +25,15 @@ namespace osu.Game.Screens.Edit
|
||||
/// </summary>
|
||||
public partial class EditorClock : CompositeComponent, IFrameBasedClock, IAdjustableClock, ISourceChangeableClock
|
||||
{
|
||||
public IBindable<Track> Track => track;
|
||||
[CanBeNull]
|
||||
public event Action TrackChanged;
|
||||
|
||||
private readonly Bindable<Track> track = new Bindable<Track>();
|
||||
|
||||
public double TrackLength => track.Value?.IsLoaded == true ? track.Value.Length : 60000;
|
||||
|
||||
public AudioAdjustments AudioAdjustments { get; } = new AudioAdjustments();
|
||||
|
||||
public ControlPointInfo ControlPointInfo => Beatmap.ControlPointInfo;
|
||||
|
||||
public IBeatmap Beatmap { get; set; }
|
||||
@ -56,6 +61,8 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
underlyingClock = new FramedBeatmapClock(applyOffsets: true, requireDecoupling: true);
|
||||
AddInternal(underlyingClock);
|
||||
|
||||
track.BindValueChanged(_ => TrackChanged?.Invoke());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -208,7 +215,16 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetSpeedAdjustments() => underlyingClock.ResetSpeedAdjustments();
|
||||
public void BindAdjustments() => track.Value?.BindAdjustments(AudioAdjustments);
|
||||
|
||||
public void UnbindAdjustments() => track.Value?.UnbindAdjustments(AudioAdjustments);
|
||||
|
||||
public void ResetSpeedAdjustments()
|
||||
{
|
||||
AudioAdjustments.RemoveAllAdjustments(AdjustableProperty.Frequency);
|
||||
AudioAdjustments.RemoveAllAdjustments(AdjustableProperty.Tempo);
|
||||
underlyingClock.ResetSpeedAdjustments();
|
||||
}
|
||||
|
||||
double IAdjustableClock.Rate
|
||||
{
|
||||
@ -231,8 +247,12 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public void ChangeSource(IClock source)
|
||||
{
|
||||
UnbindAdjustments();
|
||||
|
||||
track.Value = source as Track;
|
||||
underlyingClock.ChangeSource(source);
|
||||
|
||||
BindAdjustments();
|
||||
}
|
||||
|
||||
public IClock Source => underlyingClock.Source;
|
||||
|
@ -4,8 +4,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Audio;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -305,7 +305,8 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
||||
|
||||
private readonly IBindable<Track> track = new Bindable<Track>();
|
||||
[Resolved]
|
||||
private EditorClock editorClock { get; set; } = null!;
|
||||
|
||||
public WaveformRow(bool isMainRow)
|
||||
{
|
||||
@ -313,7 +314,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(EditorClock clock)
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -343,13 +344,16 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
Colour = colourProvider.Content2
|
||||
}
|
||||
};
|
||||
|
||||
track.BindTo(clock.Track);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
track.ValueChanged += _ => waveformGraph.Waveform = beatmap.Value.Waveform;
|
||||
editorClock.TrackChanged += updateWaveform;
|
||||
}
|
||||
|
||||
private void updateWaveform()
|
||||
{
|
||||
waveformGraph.Waveform = beatmap.Value.Waveform;
|
||||
}
|
||||
|
||||
public int BeatIndex { set => beatIndexText.Text = value.ToString(); }
|
||||
@ -363,6 +367,14 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
get => waveformGraph.X;
|
||||
set => waveformGraph.X = value;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (editorClock.IsNotNull())
|
||||
editorClock.TrackChanged -= updateWaveform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
@ -170,7 +171,14 @@ namespace osu.Game.Screens.Menu
|
||||
if (s.Beatmaps.Count == 0)
|
||||
return;
|
||||
|
||||
initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps.First());
|
||||
var working = beatmaps.GetWorkingBeatmap(s.Beatmaps.First());
|
||||
|
||||
// Ensure files area actually present on disk.
|
||||
// This is to handle edge cases like users deleting files outside the game and breaking the world.
|
||||
if (!hasAllFiles(working))
|
||||
return;
|
||||
|
||||
initialBeatmap = working;
|
||||
});
|
||||
|
||||
return UsingThemedIntro = initialBeatmap != null;
|
||||
@ -188,6 +196,20 @@ namespace osu.Game.Screens.Menu
|
||||
[Resolved]
|
||||
private INotificationOverlay notifications { get; set; }
|
||||
|
||||
private bool hasAllFiles(WorkingBeatmap working)
|
||||
{
|
||||
foreach (var f in working.BeatmapSetInfo.Files)
|
||||
{
|
||||
using (var str = working.GetStream(f.File.GetStoragePath()))
|
||||
{
|
||||
if (str == null)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ensureEventuallyArrivingAtMenu()
|
||||
{
|
||||
// This intends to handle the case where an intro may get stuck.
|
||||
|
@ -14,7 +14,6 @@ using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osuTK;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Components
|
||||
{
|
||||
@ -30,6 +29,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
private StarRatingDisplay maxDisplay = null!;
|
||||
private Drawable maxBackground = null!;
|
||||
|
||||
private BufferedContainer bufferedContent = null!;
|
||||
|
||||
public StarRatingRangeDisplay(Room room)
|
||||
{
|
||||
this.room = room;
|
||||
@ -41,11 +42,15 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = 1,
|
||||
// Stops artifacting from boxes drawn behind wrong colour boxes (and edge pixels adding up to higher opacity).
|
||||
Padding = new MarginPadding(-0.1f),
|
||||
Child = bufferedContent = new BufferedContainer(pixelSnapping: true, cachedFrameBuffer: true)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
minBackground = new Box
|
||||
@ -53,16 +58,14 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f),
|
||||
Size = new Vector2(1, 0.5f),
|
||||
},
|
||||
maxBackground = new Box
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f),
|
||||
},
|
||||
}
|
||||
Size = new Vector2(1, 0.5f),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
@ -73,6 +76,9 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
maxDisplay = new StarRatingDisplay(default, StarRatingDisplaySize.Range)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -121,6 +127,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
|
||||
minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars);
|
||||
maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars);
|
||||
|
||||
bufferedContent.ForceRedraw();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -54,6 +54,10 @@ namespace osu.Game.Users
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Union(12, typeof(InSoloGame))]
|
||||
[Union(23, typeof(InMultiplayerGame))]
|
||||
[Union(24, typeof(SpectatingMultiplayerGame))]
|
||||
[Union(31, typeof(InPlaylistGame))]
|
||||
public abstract class InGame : UserActivity
|
||||
{
|
||||
[Key(0)]
|
||||
|
@ -20,24 +20,24 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="AutoMapper" Version="13.0.1" />
|
||||
<PackageReference Include="DiffPlex" Version="1.7.2" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.70" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.72" />
|
||||
<PackageReference Include="Humanizer" Version="2.14.1" />
|
||||
<PackageReference Include="MessagePack" Version="2.5.187" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="ppy.LocalisationAnalyser" Version="2024.802.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="11.5.0" />
|
||||
<PackageReference Include="Realm" Version="20.1.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.1224.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.1224.0" />
|
||||
<PackageReference Include="Sentry" Version="4.13.0" />
|
||||
<PackageReference Include="Sentry" Version="5.0.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user