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

Merge branch 'master' into mod-wind

This commit is contained in:
Nitrous 2019-01-28 17:48:57 +08:00 committed by GitHub
commit ea4e79751e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 50 additions and 39 deletions

View File

@ -5,6 +5,7 @@ using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osuTK;
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{ {
@ -22,8 +23,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
{ {
base.LoadComplete(); base.LoadComplete();
// Fixes a 1-frame position discrpancy due to the first mouse move event happening in the next frame // Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
HitObject.Position = GetContainingInputManager().CurrentState.Mouse.Position; HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
} }
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)

View File

@ -47,6 +47,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
setState(PlacementState.Initial); setState(PlacementState.Initial);
} }
protected override void LoadComplete()
{
base.LoadComplete();
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
HitObject.Position = Parent?.ToLocalSpace(GetContainingInputManager().CurrentState.Mouse.Position) ?? Vector2.Zero;
}
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
switch (state) switch (state)

View File

@ -3,7 +3,9 @@
using osuTK.Graphics; using osuTK.Graphics;
using System; using System;
using osu.Framework.Allocation;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Platform;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osuTK.Input; using osuTK.Input;
@ -21,9 +23,16 @@ namespace osu.Game.Graphics.UserInterface
private bool focus; private bool focus;
private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true;
public void TakeFocus()
{
if (allowImmediateFocus) GetContainingInputManager().ChangeFocus(this);
}
public bool HoldFocus public bool HoldFocus
{ {
get { return focus; } get => allowImmediateFocus && focus;
set set
{ {
focus = value; focus = value;
@ -32,6 +41,14 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
private GameHost host;
[BackgroundDependencyLoader]
private void load(GameHost host)
{
this.host = host;
}
// We may not be focused yet, but we need to handle keyboard input to be able to request focus // We may not be focused yet, but we need to handle keyboard input to be able to request focus
public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput;

View File

@ -164,7 +164,7 @@ namespace osu.Game.Overlays.Chat.Selection
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(search); search.TakeFocus();
base.OnFocus(e); base.OnFocus(e);
} }

View File

@ -302,7 +302,7 @@ namespace osu.Game.Overlays
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
//this is necessary as textbox is masked away and therefore can't get focus :( //this is necessary as textbox is masked away and therefore can't get focus :(
GetContainingInputManager().ChangeFocus(textbox); textbox.TakeFocus();
base.OnFocus(e); base.OnFocus(e);
} }

View File

@ -1,7 +1,6 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -53,10 +52,9 @@ namespace osu.Game.Overlays.Music
public class FilterTextBox : SearchTextBox public class FilterTextBox : SearchTextBox
{ {
private Color4 backgroundColour; protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
protected override Color4 BackgroundUnfocused => backgroundColour;
protected override Color4 BackgroundFocused => backgroundColour;
protected override bool AllowCommit => true; protected override bool AllowCommit => true;
public FilterTextBox() public FilterTextBox()
@ -64,12 +62,6 @@ namespace osu.Game.Overlays.Music
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 5;
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
backgroundColour = colours.Gray2;
}
} }
} }
} }

View File

@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Music
protected override void PopIn() protected override void PopIn()
{ {
filter.Search.HoldFocus = true; filter.Search.HoldFocus = true;
Schedule(() => GetContainingInputManager().ChangeFocus(filter.Search)); Schedule(() => filter.Search.TakeFocus());
this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint); this.ResizeTo(new Vector2(1, playlist_height), transition_duration, Easing.OutQuint);
this.FadeIn(transition_duration, Easing.OutQuint); this.FadeIn(transition_duration, Easing.OutQuint);

View File

@ -127,17 +127,10 @@ namespace osu.Game.Overlays.SearchableList
private class FilterSearchTextBox : SearchTextBox private class FilterSearchTextBox : SearchTextBox
{ {
protected override Color4 BackgroundUnfocused => backgroundColour; protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f);
protected override Color4 BackgroundFocused => backgroundColour; protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f);
protected override bool AllowCommit => true; protected override bool AllowCommit => true;
private Color4 backgroundColour;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
backgroundColour = colours.Gray2.Opacity(0.9f);
}
} }
} }
} }

View File

@ -103,7 +103,7 @@ namespace osu.Game.Overlays.SearchableList
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(Filter.Search); Filter.Search.TakeFocus();
} }
protected override void PopIn() protected override void PopIn()

View File

@ -179,7 +179,7 @@ namespace osu.Game.Overlays
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(searchTextBox); searchTextBox.TakeFocus();
base.OnFocus(e); base.OnFocus(e);
} }

View File

@ -98,7 +98,7 @@ namespace osu.Game.Screens.Multi.Lounge
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(Filter.Search); Filter.Search.TakeFocus();
} }
protected override void OnEntering(Screen last) protected override void OnEntering(Screen last)

View File

@ -123,6 +123,16 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Top = 10, Right = 5 }, Padding = new MarginPadding { Top = 10, Right = 5 },
} }
}, },
beatmapInfoWedge = new BeatmapInfoWedge
{
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding
{
Top = left_area_padding,
Right = left_area_padding,
},
},
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -163,16 +173,6 @@ namespace osu.Game.Screens.Select
} }
}, },
}, },
beatmapInfoWedge = new BeatmapInfoWedge
{
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding
{
Top = left_area_padding,
Right = left_area_padding,
},
},
new ResetScrollContainer(() => Carousel.ScrollToSelected()) new ResetScrollContainer(() => Carousel.ScrollToSelected())
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,