1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Merge branch 'master' into legacy-score-v2

This commit is contained in:
Dean Herbert 2023-07-11 16:56:49 +09:00
commit 0dd4ad8c5d
12 changed files with 79 additions and 82 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="osu!" /> <assemblyIdentity version="1.0.0.0" name="osu!" />
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security> <security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
@ -14,33 +15,10 @@
</trustInfo> </trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application> <application>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 --> <!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 --> <!-- Windows 10 and Windows 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application> </application>
</compatibility> </compatibility>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</asmv1:assembly> </asmv1:assembly>

View File

@ -11,7 +11,7 @@
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger> <AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.707.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2023.710.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" /> <AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="osu!" />
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</asmv1:assembly>

View File

@ -8,7 +8,6 @@
<Title>osu!</Title> <Title>osu!</Title>
<Product>osu!(lazer)</Product> <Product>osu!(lazer)</Product>
<ApplicationIcon>lazer.ico</ApplicationIcon> <ApplicationIcon>lazer.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>0.0.0</Version> <Version>0.0.0</Version>
<FileVersion>0.0.0</FileVersion> <FileVersion>0.0.0</FileVersion>
</PropertyGroup> </PropertyGroup>

View File

@ -17,7 +17,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
@ -125,8 +125,8 @@ namespace osu.Game.Tests.Visual.Gameplay
graphs.Clear(); graphs.Clear();
legend.Clear(); legend.Clear();
runForProcessor("lazer-standardised", Color4.YellowGreen, new ScoreProcessor(new OsuRuleset()), ScoringMode.Standardised); runForProcessor("lazer-standardised", Color4.YellowGreen, new OsuScoreProcessor(), ScoringMode.Standardised);
runForProcessor("lazer-classic", Color4.MediumPurple, new ScoreProcessor(new OsuRuleset()), ScoringMode.Classic); runForProcessor("lazer-classic", Color4.MediumPurple, new OsuScoreProcessor(), ScoringMode.Classic);
runScoreV1(); runScoreV1();
runScoreV2(); runScoreV2();

View File

@ -3,11 +3,13 @@
#nullable disable #nullable disable
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -18,7 +20,7 @@ using osu.Game.Overlays.Chat;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
{ {
[TestFixture] [TestFixture]
public partial class TestSceneChatTextBox : OsuTestScene public partial class TestSceneChatTextBox : OsuManualInputManagerTestScene
{ {
[Cached] [Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
@ -30,6 +32,8 @@ namespace osu.Game.Tests.Visual.Online
private OsuSpriteText searchText; private OsuSpriteText searchText;
private ChatTextBar bar; private ChatTextBar bar;
private ChatTextBox textBox => bar.ChildrenOfType<ChatTextBox>().Single();
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
@ -115,6 +119,36 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Chat Mode Search", () => bar.ShowSearch.Value = true); AddStep("Chat Mode Search", () => bar.ShowSearch.Value = true);
} }
[Test]
public void TestLengthLimit()
{
var firstChannel = new Channel
{
Name = "#test1",
Type = ChannelType.Public,
Id = 4567,
MessageLengthLimit = 20
};
var secondChannel = new Channel
{
Name = "#test2",
Type = ChannelType.Public,
Id = 5678,
MessageLengthLimit = 5
};
AddStep("switch to channel with 20 char length limit", () => currentChannel.Value = firstChannel);
AddStep("type a message", () => textBox.Current.Value = "abcdefgh");
AddStep("switch to channel with 5 char length limit", () => currentChannel.Value = secondChannel);
AddAssert("text box empty", () => textBox.Current.Value, () => Is.Empty);
AddStep("type too much", () => textBox.Current.Value = "123456");
AddAssert("text box has 5 chars", () => textBox.Current.Value, () => Has.Length.EqualTo(5));
AddStep("switch back to channel with 20 char length limit", () => currentChannel.Value = firstChannel);
AddAssert("unsent message preserved without truncation", () => textBox.Current.Value, () => Is.EqualTo("abcdefgh"));
}
private static Channel createPublicChannel(string name) private static Channel createPublicChannel(string name)
=> new Channel { Name = name, Type = ChannelType.Public, Id = 1234 }; => new Channel { Name = name, Type = ChannelType.Public, Id = 1234 };

View File

@ -12,6 +12,7 @@ using osu.Framework.Bindables;
using osu.Framework.Lists; using osu.Framework.Lists;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat;
using osu.Game.Overlays.Chat.Listing;
namespace osu.Game.Online.Chat namespace osu.Game.Online.Chat
{ {
@ -86,6 +87,12 @@ namespace osu.Game.Online.Chat
[JsonProperty(@"last_read_id")] [JsonProperty(@"last_read_id")]
public long? LastReadId; public long? LastReadId;
/// <remarks>
/// Purposefully nullable for the sake of <see cref="ChannelListing.ChannelListingChannel"/>.
/// </remarks>
[JsonProperty(@"message_length_limit")]
public int? MessageLengthLimit;
/// <summary> /// <summary>
/// Signals if the current user joined this channel or not. Defaults to false. /// Signals if the current user joined this channel or not. Defaults to false.
/// Note that this does not guarantee a join has completed. Check Id > 0 for confirmation. /// Note that this does not guarantee a join has completed. Check Id > 0 for confirmation.

View File

@ -156,7 +156,11 @@ namespace osu.Game.Overlays.Chat
chatTextBox.Current.UnbindFrom(change.OldValue.TextBoxMessage); chatTextBox.Current.UnbindFrom(change.OldValue.TextBoxMessage);
if (newChannel != null) if (newChannel != null)
{
// change length limit first before binding to avoid accidentally truncating pending message from new channel.
chatTextBox.LengthLimit = newChannel.MessageLengthLimit;
chatTextBox.Current.BindTo(newChannel.TextBoxMessage); chatTextBox.Current.BindTo(newChannel.TextBoxMessage);
}
}, true); }, true);
} }

View File

@ -101,26 +101,31 @@ namespace osu.Game.Screens.Edit.Compose
#region Clipboard operations #region Clipboard operations
protected override void PerformCut() public override void Cut()
{ {
base.PerformCut(); if (!CanCut.Value)
return;
Copy(); Copy();
EditorBeatmap.RemoveRange(EditorBeatmap.SelectedHitObjects.ToArray()); EditorBeatmap.RemoveRange(EditorBeatmap.SelectedHitObjects.ToArray());
} }
protected override void PerformCopy() public override void Copy()
{ {
base.PerformCopy(); // on stable, pressing Ctrl-C would copy the current timestamp to system clipboard
// regardless of whether anything was even selected at all.
// UX-wise this is generally strange and unexpected, but make it work anyways to preserve muscle memory.
// note that this means that `getTimestamp()` must handle no-selection case, too.
host.GetClipboard()?.SetText(getTimestamp());
if (CanCopy.Value)
clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize(); clipboard.Value = new ClipboardContent(EditorBeatmap).Serialize();
host.GetClipboard()?.SetText(formatSelectionAsString());
} }
protected override void PerformPaste() public override void Paste()
{ {
base.PerformPaste(); if (!CanPaste.Value)
return;
var objects = clipboard.Value.Deserialize<ClipboardContent>().HitObjects; var objects = clipboard.Value.Deserialize<ClipboardContent>().HitObjects;
@ -147,7 +152,7 @@ namespace osu.Game.Screens.Edit.Compose
CanPaste.Value = composer.IsLoaded && !string.IsNullOrEmpty(clipboard.Value); CanPaste.Value = composer.IsLoaded && !string.IsNullOrEmpty(clipboard.Value);
} }
private string formatSelectionAsString() private string getTimestamp()
{ {
if (composer == null) if (composer == null)
return string.Empty; return string.Empty;

View File

@ -44,29 +44,23 @@ namespace osu.Game.Screens.Edit
/// <summary> /// <summary>
/// Performs a "cut to clipboard" operation appropriate for the given screen. /// Performs a "cut to clipboard" operation appropriate for the given screen.
/// </summary> /// </summary>
protected virtual void PerformCut() /// <remarks>
/// Implementors are responsible for checking <see cref="CanCut"/> themselves.
/// </remarks>
public virtual void Cut()
{ {
} }
public void Cut()
{
if (CanCut.Value)
PerformCut();
}
public BindableBool CanCopy { get; } = new BindableBool(); public BindableBool CanCopy { get; } = new BindableBool();
/// <summary> /// <summary>
/// Performs a "copy to clipboard" operation appropriate for the given screen. /// Performs a "copy to clipboard" operation appropriate for the given screen.
/// </summary> /// </summary>
protected virtual void PerformCopy() /// <remarks>
{ /// Implementors are responsible for checking <see cref="CanCopy"/> themselves.
} /// </remarks>
public virtual void Copy() public virtual void Copy()
{ {
if (CanCopy.Value)
PerformCopy();
} }
public BindableBool CanPaste { get; } = new BindableBool(); public BindableBool CanPaste { get; } = new BindableBool();
@ -74,14 +68,11 @@ namespace osu.Game.Screens.Edit
/// <summary> /// <summary>
/// Performs a "paste from clipboard" operation appropriate for the given screen. /// Performs a "paste from clipboard" operation appropriate for the given screen.
/// </summary> /// </summary>
protected virtual void PerformPaste() /// <remarks>
{ /// Implementors are responsible for checking <see cref="CanPaste"/> themselves.
} /// </remarks>
public virtual void Paste() public virtual void Paste()
{ {
if (CanPaste.Value)
PerformPaste();
} }
#endregion #endregion

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="11.1.2" /> <PackageReference Include="Realm" Version="11.1.2" />
<PackageReference Include="ppy.osu.Framework" Version="2023.707.0" /> <PackageReference Include="ppy.osu.Framework" Version="2023.710.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.707.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2023.707.0" />
<PackageReference Include="Sentry" Version="3.28.1" /> <PackageReference Include="Sentry" Version="3.28.1" />
<PackageReference Include="SharpCompress" Version="0.32.2" /> <PackageReference Include="SharpCompress" Version="0.32.2" />

View File

@ -16,6 +16,6 @@
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier> <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.707.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2023.710.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>