1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:18:22 +08:00

Merge branch 'master' into fix-slider-path-extension-incorrectness

This commit is contained in:
Dean Herbert 2021-10-26 17:36:50 +09:00
commit d5b4c68d3a
12 changed files with 47 additions and 28 deletions

View File

@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1015.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1014.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1026.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->

View File

@ -56,6 +56,11 @@ namespace osu.Game.Tests.Visual.Editing
checkMutations();
// After placement these must be non-default as defaults are read-only.
AddAssert("Placed object has non-default control points", () =>
editorBeatmap.HitObjects[0].SampleControlPoint != SampleControlPoint.DEFAULT &&
editorBeatmap.HitObjects[0].DifficultyControlPoint != DifficultyControlPoint.DEFAULT);
AddStep("Save", () => InputManager.Keys(PlatformAction.Save));
checkMutations();

View File

@ -462,10 +462,12 @@ namespace osu.Game.Database
if (retrievedItem == null)
throw new ArgumentException(@"Specified model could not be found", nameof(item));
using (var outputStream = exportStorage.GetStream($"{getValidFilename(item.ToString())}{HandledExtensions.First()}", FileAccess.Write, FileMode.Create))
ExportModelTo(retrievedItem, outputStream);
string filename = $"{getValidFilename(item.ToString())}{HandledExtensions.First()}";
exportStorage.OpenInNativeExplorer();
using (var stream = exportStorage.GetStream(filename, FileAccess.Write, FileMode.Create))
ExportModelTo(retrievedItem, stream);
exportStorage.PresentFileExternally(filename);
}
/// <summary>

View File

@ -109,40 +109,42 @@ namespace osu.Game.Graphics
if (Interlocked.Decrement(ref screenShotTasks) == 0 && cursorVisibility.Value == false)
cursorVisibility.Value = true;
var fileName = getFileName();
if (fileName == null) return;
string filename = getFilename();
var stream = storage.GetStream(fileName, FileAccess.Write);
if (filename == null) return;
switch (screenshotFormat.Value)
using (var stream = storage.GetStream(filename, FileAccess.Write))
{
case ScreenshotFormat.Png:
await image.SaveAsPngAsync(stream).ConfigureAwait(false);
break;
switch (screenshotFormat.Value)
{
case ScreenshotFormat.Png:
await image.SaveAsPngAsync(stream).ConfigureAwait(false);
break;
case ScreenshotFormat.Jpg:
const int jpeg_quality = 92;
case ScreenshotFormat.Jpg:
const int jpeg_quality = 92;
await image.SaveAsJpegAsync(stream, new JpegEncoder { Quality = jpeg_quality }).ConfigureAwait(false);
break;
await image.SaveAsJpegAsync(stream, new JpegEncoder { Quality = jpeg_quality }).ConfigureAwait(false);
break;
default:
throw new InvalidOperationException($"Unknown enum member {nameof(ScreenshotFormat)} {screenshotFormat.Value}.");
default:
throw new InvalidOperationException($"Unknown enum member {nameof(ScreenshotFormat)} {screenshotFormat.Value}.");
}
}
notificationOverlay.Post(new SimpleNotification
{
Text = $"{fileName} saved!",
Text = $"{filename} saved!",
Activated = () =>
{
storage.OpenInNativeExplorer();
storage.PresentFileExternally(filename);
return true;
}
});
}
});
private string getFileName()
private string getFilename()
{
var dt = DateTime.Now;
var fileExt = screenshotFormat.ToString().ToLowerInvariant();

View File

@ -70,7 +70,9 @@ namespace osu.Game.IO
public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate) =>
UnderlyingStorage.GetStream(MutatePath(path), access, mode);
public override void OpenPathInNativeExplorer(string path) => UnderlyingStorage.OpenPathInNativeExplorer(MutatePath(path));
public override void OpenFileExternally(string filename) => UnderlyingStorage.OpenFileExternally(MutatePath(filename));
public override void PresentFileExternally(string filename) => UnderlyingStorage.PresentFileExternally(MutatePath(filename));
public override Storage GetStorageForDirectory(string path)
{

View File

@ -913,13 +913,15 @@ namespace osu.Game
}
else if (recentLogCount == short_term_display_limit)
{
var logFile = $@"{entry.Target.ToString().ToLowerInvariant()}.log";
Schedule(() => Notifications.Post(new SimpleNotification
{
Icon = FontAwesome.Solid.EllipsisH,
Text = "Subsequent messages have been logged. Click to view log files.",
Activated = () =>
{
Storage.GetStorageForDirectory("logs").OpenInNativeExplorer();
Storage.GetStorageForDirectory(@"logs").PresentFileExternally(logFile);
return true;
}
}));

View File

@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
Add(new SettingsButton
{
Text = GeneralSettingsStrings.OpenOsuFolder,
Action = storage.OpenInNativeExplorer,
Action = storage.PresentExternally,
});
Add(new SettingsButton

View File

@ -119,6 +119,8 @@ namespace osu.Game.Rulesets.Objects
DifficultyControlPoint = (DifficultyControlPoint)legacyInfo.DifficultyPointAt(StartTime).DeepClone();
DifficultyControlPoint.Time = StartTime;
}
else if (DifficultyControlPoint == DifficultyControlPoint.DEFAULT)
DifficultyControlPoint = new DifficultyControlPoint();
ApplyDefaultsToSelf(controlPointInfo, difficulty);
@ -128,6 +130,8 @@ namespace osu.Game.Rulesets.Objects
SampleControlPoint = (SampleControlPoint)legacyInfo.SamplePointAt(this.GetEndTime() + control_point_leniency).DeepClone();
SampleControlPoint.Time = this.GetEndTime() + control_point_leniency;
}
else if (SampleControlPoint == SampleControlPoint.DEFAULT)
SampleControlPoint = new SampleControlPoint();
nestedHitObjects.Clear();

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Objects
public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOffset)
{
var points = sliderPath.ControlPoints.ToArray();
positionalOffset = points.Last().Position;
positionalOffset = sliderPath.PositionAt(1);
sliderPath.ControlPoints.Clear();
@ -32,7 +32,10 @@ namespace osu.Game.Rulesets.Objects
// propagate types forwards to last null type
if (i == points.Length - 1)
{
p.Type = lastType;
p.Position = Vector2.Zero;
}
else if (p.Type != null)
(p.Type, lastType) = (lastType, p.Type);

View File

@ -10,7 +10,6 @@ using osu.Game.Input.Bindings;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Match.Components;
using osu.Game.Screens.Play;
using osuTK.Input;
namespace osu.Game.Screens.OnlinePlay.Multiplayer
{

View File

@ -36,7 +36,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="10.6.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1014.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1026.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1015.0" />
<PackageReference Include="Sentry" Version="3.9.4" />
<PackageReference Include="SharpCompress" Version="0.29.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1014.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.1026.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1015.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -93,7 +93,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1014.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.1026.0" />
<PackageReference Include="SharpCompress" Version="0.28.3" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="SharpRaven" Version="2.4.0" />