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

Merge branch 'master' into sprite-icon-compatibility

This commit is contained in:
Dean Herbert 2019-03-28 23:47:44 +09:00 committed by GitHub
commit 176b4ecc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 60 deletions

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osuTK.Graphics; using osuTK.Graphics;
@ -14,7 +15,7 @@ using osuTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
public class SliderBall : CircularContainer, ISliderProgress public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
{ {
private const float width = 128; private const float width = 128;
@ -107,18 +108,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
private Vector2? lastScreenSpaceMousePosition; private Vector2? lastScreenSpaceMousePosition;
protected override bool OnMouseDown(MouseDownEvent e)
{
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
{
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseUp(e);
}
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;

View File

@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Background
public void PlayerLoaderSettingsHoverTest() public void PlayerLoaderSettingsHoverTest()
{ {
setupUserSettings(); setupUserSettings();
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer()))); AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { BlockLoad = true })));
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false); AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
AddStep("Trigger background preview", () => AddStep("Trigger background preview", () =>
@ -255,14 +255,7 @@ namespace osu.Game.Tests.Visual.Background
{ {
setupUserSettings(); setupUserSettings();
AddStep("Start player loader", () => AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { AllowPause = allowPause, })));
{
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
{
AllowPause = allowPause,
Ready = true,
}));
});
AddUntilStep("Wait for Player Loader to load", () => playerLoader.IsLoaded); AddUntilStep("Wait for Player Loader to load", () => playerLoader.IsLoaded);
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
AddUntilStep("Wait for player to load", () => player.IsLoaded); AddUntilStep("Wait for player to load", () => player.IsLoaded);
@ -351,7 +344,7 @@ namespace osu.Game.Tests.Visual.Background
public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; public UserDimContainer CurrentStoryboardContainer => StoryboardContainer;
// Whether or not the player should be allowed to load. // Whether or not the player should be allowed to load.
public bool Ready; public bool BlockLoad;
public Bindable<bool> StoryboardEnabled; public Bindable<bool> StoryboardEnabled;
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>(); public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
@ -362,10 +355,11 @@ namespace osu.Game.Tests.Visual.Background
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config, CancellationToken token)
{ {
while (!Ready) while (BlockLoad && !token.IsCancellationRequested)
Thread.Sleep(1); Thread.Sleep(1);
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard); StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
ReplacesBackground.BindTo(Background.StoryboardReplacesBackground); ReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
DrawableRuleset.IsPaused.BindTo(IsPaused); DrawableRuleset.IsPaused.BindTo(IsPaused);

View File

@ -391,11 +391,9 @@ namespace osu.Game
logoContainer = new Container { RelativeSizeAxes = Axes.Both }, logoContainer = new Container { RelativeSizeAxes = Axes.Both },
} }
}, },
overlayContent = new Container overlayContent = new Container { RelativeSizeAxes = Axes.Both },
{ floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
RelativeSizeAxes = Axes.Both, topMostOverlayContent = new Container { RelativeSizeAxes = Axes.Both },
},
floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue },
idleTracker = new GameIdleTracker(6000) idleTracker = new GameIdleTracker(6000)
}); });
@ -415,13 +413,12 @@ namespace osu.Game
loadComponentSingleFile(Toolbar = new Toolbar loadComponentSingleFile(Toolbar = new Toolbar
{ {
Depth = -5,
OnHome = delegate OnHome = delegate
{ {
CloseAllOverlays(false); CloseAllOverlays(false);
menuScreen?.MakeCurrent(); menuScreen?.MakeCurrent();
}, },
}, floatingOverlayContent.Add); }, topMostOverlayContent.Add);
loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add); loadComponentSingleFile(volume = new VolumeOverlay(), floatingOverlayContent.Add);
loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add); loadComponentSingleFile(onscreenDisplay = new OnScreenDisplay(), Add);
@ -429,47 +426,32 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add); loadComponentSingleFile(screenshotManager, Add);
//overlay elements //overlay elements
loadComponentSingleFile(direct = new DirectOverlay { Depth = -1 }, overlayContent.Add); loadComponentSingleFile(direct = new DirectOverlay(), overlayContent.Add);
loadComponentSingleFile(social = new SocialOverlay { Depth = -1 }, overlayContent.Add); loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add);
loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal);
loadComponentSingleFile(chatOverlay = new ChatOverlay { Depth = -1 }, overlayContent.Add); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add);
loadComponentSingleFile(settings = new MainSettings loadComponentSingleFile(settings = new MainSettings { GetToolbarHeight = () => ToolbarOffset }, floatingOverlayContent.Add);
loadComponentSingleFile(userProfile = new UserProfileOverlay(), overlayContent.Add);
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay(), overlayContent.Add);
loadComponentSingleFile(notifications = new NotificationOverlay
{ {
GetToolbarHeight = () => ToolbarOffset, GetToolbarHeight = () => ToolbarOffset,
Depth = -1 Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, floatingOverlayContent.Add); }, floatingOverlayContent.Add);
loadComponentSingleFile(userProfile = new UserProfileOverlay { Depth = -2 }, overlayContent.Add);
loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, overlayContent.Add);
loadComponentSingleFile(musicController = new MusicController loadComponentSingleFile(musicController = new MusicController
{ {
Depth = -5,
Position = new Vector2(0, Toolbar.HEIGHT), Position = new Vector2(0, Toolbar.HEIGHT),
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}, floatingOverlayContent.Add); }, floatingOverlayContent.Add);
loadComponentSingleFile(notifications = new NotificationOverlay loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add);
{
GetToolbarHeight = () => ToolbarOffset,
Depth = -4,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}, floatingOverlayContent.Add);
loadComponentSingleFile(accountCreation = new AccountCreationOverlay loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add);
{
Depth = -6,
}, floatingOverlayContent.Add);
loadComponentSingleFile(dialogOverlay = new DialogOverlay loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener(), topMostOverlayContent.Add);
{
Depth = -7,
}, floatingOverlayContent.Add);
loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener
{
Depth = -8,
}, floatingOverlayContent.Add);
dependencies.CacheAs(idleTracker); dependencies.CacheAs(idleTracker);
dependencies.Cache(settings); dependencies.Cache(settings);
@ -715,6 +697,8 @@ namespace osu.Game
private Container floatingOverlayContent; private Container floatingOverlayContent;
private Container topMostOverlayContent;
private FrameworkConfigManager frameworkConfig; private FrameworkConfigManager frameworkConfig;
private ScalingContainer screenContainer; private ScalingContainer screenContainer;