mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 03:22:54 +08:00
Merge branch 'master' into slider-ball-scaling
This commit is contained in:
commit
7cab0fcfb8
@ -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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -38,9 +38,9 @@ namespace osu.Desktop
|
|||||||
if (Host is DesktopGameHost desktopHost)
|
if (Host is DesktopGameHost desktopHost)
|
||||||
return new StableStorage(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;
|
return null;
|
||||||
@ -52,11 +52,7 @@ namespace osu.Desktop
|
|||||||
|
|
||||||
if (!noVersionOverlay)
|
if (!noVersionOverlay)
|
||||||
{
|
{
|
||||||
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
|
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, Add);
|
||||||
{
|
|
||||||
Add(v);
|
|
||||||
v.Show();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||||
Add(new SquirrelUpdateManager());
|
Add(new SquirrelUpdateManager());
|
||||||
|
@ -17,7 +17,6 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -51,26 +50,14 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
private DummySongSelect songSelect;
|
private DummySongSelect songSelect;
|
||||||
private TestPlayerLoader playerLoader;
|
private TestPlayerLoader playerLoader;
|
||||||
private TestPlayer player;
|
private TestPlayer player;
|
||||||
private DatabaseContextFactory factory;
|
|
||||||
private BeatmapManager manager;
|
private BeatmapManager manager;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
{
|
{
|
||||||
factory = new DatabaseContextFactory(LocalStorage);
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
factory.ResetDatabase();
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default));
|
||||||
|
|
||||||
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(new OsuConfigManager(LocalStorage));
|
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
||||||
|
|
||||||
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
|
manager.Import(TestResources.GetTestBeatmapForImport()).Wait();
|
||||||
|
@ -15,7 +15,6 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -35,7 +34,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private WorkingBeatmap defaultBeatmap;
|
private WorkingBeatmap defaultBeatmap;
|
||||||
private DatabaseContextFactory factory;
|
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -74,28 +72,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private TestSongSelect songSelect;
|
private TestSongSelect songSelect;
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
factory.ResetDatabase();
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
{
|
{
|
||||||
factory = new DatabaseContextFactory(LocalStorage);
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
factory.ResetDatabase();
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,13 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Components
|
namespace osu.Game.Tournament.Tests.Components
|
||||||
{
|
{
|
||||||
public class TestSceneDrawableTournamentMatch : OsuTestScene
|
public class TestSceneDrawableTournamentMatch : TournamentTestScene
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests
|
namespace osu.Game.Tournament.Tests
|
||||||
{
|
{
|
||||||
public abstract class LadderTestScene : OsuTestScene
|
[TestFixture]
|
||||||
|
public abstract class LadderTestScene : TournamentTestScene
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected LadderInfo Ladder { get; private set; }
|
protected LadderInfo Ladder { get; private set; }
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Screens.Gameplay;
|
using osu.Game.Tournament.Screens.Gameplay;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneGameplayScreen : OsuTestScene
|
public class TestSceneGameplayScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay();
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Screens.Schedule;
|
using osu.Game.Tournament.Screens.Schedule;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneScheduleScreen : OsuTestScene
|
public class TestSceneScheduleScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Screens.Showcase;
|
using osu.Game.Tournament.Screens.Showcase;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Screens
|
namespace osu.Game.Tournament.Tests.Screens
|
||||||
{
|
{
|
||||||
public class TestSceneShowcaseScreen : OsuTestScene
|
public class TestSceneShowcaseScreen : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests
|
namespace osu.Game.Tournament.Tests
|
||||||
{
|
{
|
||||||
public class TestSceneTournamentSceneManager : OsuTestScene
|
public class TestSceneTournamentSceneManager : TournamentTestScene
|
||||||
{
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(Storage storage)
|
private void load(Storage storage)
|
||||||
|
28
osu.Game.Tournament.Tests/TournamentTestScene.cs
Normal file
28
osu.Game.Tournament.Tests/TournamentTestScene.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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 osu.Framework.Testing;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Tests
|
||||||
|
{
|
||||||
|
public abstract class TournamentTestScene : OsuTestScene
|
||||||
|
{
|
||||||
|
protected override ITestSceneTestRunner CreateRunner() => new TournamentTestSceneTestRunner();
|
||||||
|
|
||||||
|
public class TournamentTestSceneTestRunner : TournamentGameBase, ITestSceneTestRunner
|
||||||
|
{
|
||||||
|
private TestSceneTestRunner.TestRunner runner;
|
||||||
|
|
||||||
|
protected override void LoadAsyncComplete()
|
||||||
|
{
|
||||||
|
// this has to be run here rather than LoadComplete because
|
||||||
|
// TestScene.cs is checking the IsLoaded state (on another thread) and expects
|
||||||
|
// the runner to be loaded at that point.
|
||||||
|
Add(runner = new TestSceneTestRunner.TestRunner());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,15 +9,20 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
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.Graphics.Textures;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Tournament.IPC;
|
using osu.Game.Tournament.IPC;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tournament
|
namespace osu.Game.Tournament
|
||||||
@ -35,6 +40,8 @@ namespace osu.Game.Tournament
|
|||||||
private Bindable<Size> windowSize;
|
private Bindable<Size> windowSize;
|
||||||
private FileBasedIPC ipc;
|
private FileBasedIPC ipc;
|
||||||
|
|
||||||
|
private Drawable heightWarning;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
return dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
@ -53,6 +60,12 @@ namespace osu.Game.Tournament
|
|||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
|
||||||
|
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
|
var minWidth = (int)(size.NewValue.Height / 9f * 16 + 400);
|
||||||
|
|
||||||
|
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
||||||
|
}), true);
|
||||||
|
|
||||||
readBracket();
|
readBracket();
|
||||||
|
|
||||||
@ -61,7 +74,9 @@ namespace osu.Game.Tournament
|
|||||||
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
dependencies.CacheAs<MatchIPCInfo>(ipc = new FileBasedIPC());
|
||||||
Add(ipc);
|
Add(ipc);
|
||||||
|
|
||||||
Add(new OsuButton
|
AddRange(new[]
|
||||||
|
{
|
||||||
|
new OsuButton
|
||||||
{
|
{
|
||||||
Text = "Save Changes",
|
Text = "Save Changes",
|
||||||
Width = 140,
|
Width = 140,
|
||||||
@ -71,6 +86,31 @@ namespace osu.Game.Tournament
|
|||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
Action = SaveChanges,
|
Action = SaveChanges,
|
||||||
|
},
|
||||||
|
heightWarning = new Container
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
CornerRadius = 5,
|
||||||
|
Depth = float.MinValue,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Red,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = "Please make the window wider",
|
||||||
|
Font = OsuFont.Default.With(weight: "bold"),
|
||||||
|
Colour = Color4.White,
|
||||||
|
Padding = new MarginPadding(20)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,18 +235,6 @@ namespace osu.Game.Tournament
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
var minWidth = (int)(windowSize.Value.Height / 9f * 16 + 400);
|
|
||||||
|
|
||||||
if (windowSize.Value.Width < minWidth)
|
|
||||||
{
|
|
||||||
// todo: can be removed after ppy/osu-framework#1975
|
|
||||||
windowSize.Value = Host.Window.ClientSize = new Size(minWidth, windowSize.Value.Height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void SaveChanges()
|
protected virtual void SaveChanges()
|
||||||
{
|
{
|
||||||
foreach (var r in ladder.Rounds)
|
foreach (var r in ladder.Rounds)
|
||||||
|
@ -27,11 +27,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
|
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)
|
public OsuScrollContainer(Direction scrollDirection = Direction.Vertical)
|
||||||
: base(scrollDirection)
|
: base(scrollDirection)
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (shouldPerformRightMouseScroll(e))
|
if (shouldPerformRightMouseScroll(e))
|
||||||
{
|
{
|
||||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
scrollFromMouseEvent(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,9 +52,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnDrag(DragEvent e)
|
protected override bool OnDrag(DragEvent e)
|
||||||
{
|
{
|
||||||
if (mouseScrollBarDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
scrollToRelative(e.MousePosition[ScrollDim]);
|
scrollFromMouseEvent(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (shouldPerformRightMouseScroll(e))
|
if (shouldPerformRightMouseScroll(e))
|
||||||
{
|
{
|
||||||
mouseScrollBarDragging = true;
|
rightMouseDragging = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +74,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnDragEnd(DragEndEvent e)
|
protected override bool OnDragEnd(DragEndEvent e)
|
||||||
{
|
{
|
||||||
if (mouseScrollBarDragging)
|
if (rightMouseDragging)
|
||||||
{
|
{
|
||||||
mouseScrollBarDragging = false;
|
rightMouseDragging = false;
|
||||||
return true;
|
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
|
// 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.
|
// 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);
|
var databasedScore = ScoreManager.GetScore(databasedScoreInfo);
|
||||||
|
|
||||||
if (databasedScore.Replay == null)
|
if (databasedScore.Replay == null)
|
||||||
|
@ -107,6 +107,8 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
private class SkinDropdownControl : DropdownControl
|
private class SkinDropdownControl : DropdownControl
|
||||||
{
|
{
|
||||||
protected override string GenerateItemText(SkinInfo item) => item.ToString();
|
protected override string GenerateItemText(SkinInfo item) => item.ToString();
|
||||||
|
|
||||||
|
protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
@ -43,6 +44,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
private readonly Lazy<Storage> localStorage;
|
private readonly Lazy<Storage> localStorage;
|
||||||
protected Storage LocalStorage => localStorage.Value;
|
protected Storage LocalStorage => localStorage.Value;
|
||||||
|
|
||||||
|
private readonly Lazy<DatabaseContextFactory> contextFactory;
|
||||||
|
protected DatabaseContextFactory ContextFactory => contextFactory.Value;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
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
|
// 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()
|
protected OsuTestScene()
|
||||||
{
|
{
|
||||||
localStorage = new Lazy<Storage>(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
|
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]
|
[Resolved]
|
||||||
@ -85,6 +97,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (beatmap?.Value.TrackLoaded == true)
|
if (beatmap?.Value.TrackLoaded == true)
|
||||||
beatmap.Value.Track.Stop();
|
beatmap.Value.Track.Stop();
|
||||||
|
|
||||||
|
if (contextFactory.IsValueCreated)
|
||||||
|
contextFactory.Value.ResetDatabase();
|
||||||
|
|
||||||
if (localStorage.IsValueCreated)
|
if (localStorage.IsValueCreated)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using SharpRaven;
|
using SharpRaven;
|
||||||
@ -36,29 +37,48 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
{
|
{
|
||||||
if (exception is IOException ioe)
|
if (!shouldSubmitException(exception))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
||||||
|
if (lastException != null &&
|
||||||
|
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastException = exception;
|
||||||
|
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception) { Message = entry.Message }));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool shouldSubmitException(Exception exception)
|
||||||
{
|
{
|
||||||
|
switch (exception)
|
||||||
|
{
|
||||||
|
case IOException ioe:
|
||||||
// disk full exceptions, see https://stackoverflow.com/a/9294382
|
// disk full exceptions, see https://stackoverflow.com/a/9294382
|
||||||
const int hr_error_handle_disk_full = unchecked((int)0x80070027);
|
const int hr_error_handle_disk_full = unchecked((int)0x80070027);
|
||||||
const int hr_error_disk_full = unchecked((int)0x80070070);
|
const int hr_error_disk_full = unchecked((int)0x80070070);
|
||||||
|
|
||||||
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
|
if (ioe.HResult == hr_error_handle_disk_full || ioe.HResult == hr_error_disk_full)
|
||||||
return;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// since we let unhandled exceptions go ignored at times, we want to ensure they don't get submitted on subsequent reports.
|
break;
|
||||||
if (lastException != null &&
|
|
||||||
lastException.Message == exception.Message && exception.StackTrace.StartsWith(lastException.StackTrace))
|
case WebException we:
|
||||||
|
switch (we.Status)
|
||||||
{
|
{
|
||||||
return;
|
// more statuses may need to be blocked as we come across them.
|
||||||
|
case WebExceptionStatus.Timeout:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastException = exception;
|
break;
|
||||||
queuePendingTask(raven.CaptureAsync(new SentryEvent(exception)));
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
raven.AddTrail(new Breadcrumb(entry.Target.ToString(), BreadcrumbType.Navigation) { Message = entry.Message });
|
return true;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queuePendingTask(Task<string> task)
|
private void queuePendingTask(Task<string> task)
|
||||||
|
Loading…
Reference in New Issue
Block a user