1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 16:07:25 +08:00

Merge branch 'master' into relax

This commit is contained in:
Dan Balasescu 2018-08-21 12:11:10 +09:00 committed by GitHub
commit c4264794e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 12 deletions

View File

@ -63,7 +63,7 @@ namespace osu.Desktop
{ {
bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0;
Logger.Log($"Unhandled exception has been {(continueExecution ? "allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} .");
// restore the stock of allowable exceptions after a short delay. // restore the stock of allowable exceptions after a short delay.
Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions));

View File

@ -197,7 +197,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
if (Shared.VertexBuffer == null) if (Shared.VertexBuffer == null)
Shared.VertexBuffer = new QuadVertexBuffer<TexturedTrailVertex>(max_sprites, BufferUsageHint.DynamicDraw); Shared.VertexBuffer = new QuadVertexBuffer<TexturedTrailVertex>(max_sprites, BufferUsageHint.DynamicDraw);
Shader.GetUniform<float>("g_FadeClock").Value = Time; Shader.GetUniform<float>("g_FadeClock").UpdateValue(ref Time);
int updateStart = -1, updateEnd = 0; int updateStart = -1, updateEnd = 0;
for (int i = 0; i < Parts.Length; ++i) for (int i = 0; i < Parts.Length; ++i)

View File

@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats
if (ShouldSkipLine(line)) if (ShouldSkipLine(line))
continue; continue;
if (line.StartsWith(@"[") && line.EndsWith(@"]")) if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal))
{ {
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section)) if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
{ {
@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps.Formats
} }
} }
protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//"); protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//", StringComparison.Ordinal);
protected virtual void ParseLine(T output, Section section, string line) protected virtual void ParseLine(T output, Section section, string line)
{ {

View File

@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleEvents(string line) private void handleEvents(string line)
{ {
var depth = 0; var depth = 0;
while (line.StartsWith(" ") || line.StartsWith("_")) while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal))
{ {
++depth; ++depth;
line = line.Substring(1); line = line.Substring(1);

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -19,6 +18,7 @@ using osu.Game.Configuration;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using SixLabors.ImageSharp;
namespace osu.Game.Graphics namespace osu.Game.Graphics
{ {
@ -90,7 +90,7 @@ namespace osu.Game.Graphics
waitDelegate.Cancel(); waitDelegate.Cancel();
} }
using (var bitmap = await host.TakeScreenshotAsync()) using (var image = await host.TakeScreenshotAsync())
{ {
Interlocked.Decrement(ref screenShotTasks); Interlocked.Decrement(ref screenShotTasks);
@ -102,10 +102,10 @@ namespace osu.Game.Graphics
switch (screenshotFormat.Value) switch (screenshotFormat.Value)
{ {
case ScreenshotFormat.Png: case ScreenshotFormat.Png:
bitmap.Save(stream, ImageFormat.Png); image.SaveAsPng(stream);
break; break;
case ScreenshotFormat.Jpg: case ScreenshotFormat.Jpg:
bitmap.Save(stream, ImageFormat.Jpeg); image.SaveAsJpeg(stream);
break; break;
default: default:
throw new ArgumentOutOfRangeException(nameof(screenshotFormat)); throw new ArgumentOutOfRangeException(nameof(screenshotFormat));

View File

@ -504,7 +504,25 @@ namespace osu.Game
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
// we could avoid the need for scheduling altogether. // we could avoid the need for scheduling altogether.
Schedule(() => { asyncLoadStream = asyncLoadStream?.ContinueWith(t => LoadComponentAsync(d, add).Wait()) ?? LoadComponentAsync(d, add); }); Schedule(() =>
{
if (asyncLoadStream != null)
{
//chain with existing load stream
asyncLoadStream = asyncLoadStream.ContinueWith(async t =>
{
try
{
await LoadComponentAsync(d, add);
}
catch (OperationCanceledException)
{
}
});
}
else
asyncLoadStream = LoadComponentAsync(d, add);
});
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(GlobalAction action)

View File

@ -278,7 +278,7 @@ namespace osu.Game.Screens.Menu
if (logo != null) if (logo != null)
{ {
if (logoTracking && iconFacade.IsLoaded) if (logoTracking && logo.RelativePositionAxes == Axes.None && iconFacade.IsLoaded)
logo.Position = logoTrackingPosition; logo.Position = logoTrackingPosition;
iconFacade.Width = logo.SizeForFlow * 0.5f; iconFacade.Width = logo.SizeForFlow * 0.5f;

View File

@ -63,6 +63,12 @@ namespace osu.Game.Screens.Play.HUD
}; };
} }
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
mods.UnbindAll();
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();

View File

@ -460,6 +460,8 @@ namespace osu.Game.Screens.Select
{ {
base.Dispose(isDisposing); base.Dispose(isDisposing);
Ruleset.UnbindAll();
if (beatmaps != null) if (beatmaps != null)
{ {
beatmaps.ItemAdded -= onBeatmapSetAdded; beatmaps.ItemAdded -= onBeatmapSetAdded;

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.815.0" /> <PackageReference Include="ppy.osu.Framework" Version="2018.820.1" />
<PackageReference Include="SharpCompress" Version="0.22.0" /> <PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />