mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:25:04 +08:00
Merge branch 'master' into no-sentry-timeouts
This commit is contained in:
commit
79f120b381
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
@ -38,9 +38,9 @@ namespace osu.Desktop
|
||||
if (Host is DesktopGameHost desktopHost)
|
||||
return new StableStorage(desktopHost);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
Logger.Error(e, "Error while searching for stable install");
|
||||
Logger.Log("Could not find a stable install", LoggingTarget.Runtime, LogLevel.Important);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -52,11 +52,7 @@ namespace osu.Desktop
|
||||
|
||||
if (!noVersionOverlay)
|
||||
{
|
||||
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
|
||||
{
|
||||
Add(v);
|
||||
v.Show();
|
||||
});
|
||||
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add);
|
||||
|
||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||
Add(new SquirrelUpdateManager());
|
||||
|
@ -17,7 +17,6 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -51,26 +50,14 @@ namespace osu.Game.Tests.Visual.Background
|
||||
private DummySongSelect songSelect;
|
||||
private TestPlayerLoader playerLoader;
|
||||
private TestPlayer player;
|
||||
private DatabaseContextFactory factory;
|
||||
private BeatmapManager manager;
|
||||
private RulesetStore rulesets;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
factory = new DatabaseContextFactory(LocalStorage);
|
||||
factory.ResetDatabase();
|
||||
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
|
||||
factory.ResetDatabase();
|
||||
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
|
||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, Beatmap.Default));
|
||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
||||
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
||||
|
||||
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
|
||||
|
@ -15,7 +15,6 @@ using osu.Framework.MathUtils;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -35,7 +34,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
private RulesetStore rulesets;
|
||||
|
||||
private WorkingBeatmap defaultBeatmap;
|
||||
private DatabaseContextFactory factory;
|
||||
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
@ -74,28 +72,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
private TestSongSelect songSelect;
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
factory.ResetDatabase();
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
{
|
||||
factory = new DatabaseContextFactory(LocalStorage);
|
||||
factory.ResetDatabase();
|
||||
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
|
||||
factory.ResetDatabase();
|
||||
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
|
||||
Dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
||||
|
||||
Beatmap.SetDefault();
|
||||
}
|
||||
|
@ -27,11 +27,12 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
||||
|
||||
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
||||
private void scrollFromMouseEvent(MouseEvent e) =>
|
||||
ScrollTo(Clamp(ToLocalSpace(e.ScreenSpaceMousePosition)[ScrollDim] / DrawSize[ScrollDim]) * Content.DrawSize[ScrollDim], true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
private bool mouseScrollBarDragging;
|
||||
private bool rightMouseDragging;
|
||||
|
||||
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
||||
protected override bool IsDragging => base.IsDragging || rightMouseDragging;
|
||||
|
||||
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
||||
: base(scrollDirection)
|
||||
@ -42,7 +43,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(e))
|
||||
{
|
||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
||||
scrollFromMouseEvent(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,9 +52,9 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnDrag(DragEvent e)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
if (rightMouseDragging)
|
||||
{
|
||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
||||
scrollFromMouseEvent(e);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -64,7 +65,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(e))
|
||||
{
|
||||
mouseScrollBarDragging = true;
|
||||
rightMouseDragging = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,9 +74,9 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
if (rightMouseDragging)
|
||||
{
|
||||
mouseScrollBarDragging = false;
|
||||
rightMouseDragging = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,16 @@ namespace osu.Game
|
||||
{
|
||||
// The given ScoreInfo may have missing properties if it was retrieved from online data. Re-retrieve it from the database
|
||||
// to ensure all the required data for presenting a replay are present.
|
||||
var databasedScoreInfo = ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID);
|
||||
var databasedScoreInfo = score.OnlineScoreID != null
|
||||
? ScoreManager.Query(s => s.OnlineScoreID == score.OnlineScoreID)
|
||||
: ScoreManager.Query(s => s.Hash == score.Hash);
|
||||
|
||||
if (databasedScoreInfo == null)
|
||||
{
|
||||
Logger.Log("The requested score could not be found locally.", LoggingTarget.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var databasedScore = ScoreManager.GetScore(databasedScoreInfo);
|
||||
|
||||
if (databasedScore.Replay == null)
|
||||
|
@ -15,6 +15,7 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
@ -43,6 +44,9 @@ namespace osu.Game.Tests.Visual
|
||||
private readonly Lazy<Storage> localStorage;
|
||||
protected Storage LocalStorage => localStorage.Value;
|
||||
|
||||
private readonly Lazy<DatabaseContextFactory> contextFactory;
|
||||
protected DatabaseContextFactory ContextFactory => contextFactory.Value;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
||||
@ -59,6 +63,14 @@ namespace osu.Game.Tests.Visual
|
||||
protected OsuTestScene()
|
||||
{
|
||||
localStorage = new Lazy<Storage>(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
|
||||
contextFactory = new Lazy<DatabaseContextFactory>(() =>
|
||||
{
|
||||
var factory = new DatabaseContextFactory(LocalStorage);
|
||||
factory.ResetDatabase();
|
||||
using (var usage = factory.Get())
|
||||
usage.Migrate();
|
||||
return factory;
|
||||
});
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
@ -85,6 +97,9 @@ namespace osu.Game.Tests.Visual
|
||||
if (beatmap?.Value.TrackLoaded == true)
|
||||
beatmap.Value.Track.Stop();
|
||||
|
||||
if (contextFactory.IsValueCreated)
|
||||
contextFactory.Value.ResetDatabase();
|
||||
|
||||
if (localStorage.IsValueCreated)
|
||||
{
|
||||
try
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Utils
|
||||
return;
|
||||
|
||||
lastException = exception;
|
||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception)));
|
||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception) { Message = entry.Message }));
|
||||
}
|
||||
else
|
||||
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
||||
|
Loading…
Reference in New Issue
Block a user