1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-21 19:52:55 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into rankings-tables

This commit is contained in:
Andrei Zavatski 2019-10-02 13:00:29 +03:00
commit 5274f69872
21 changed files with 37 additions and 77 deletions

View File

@ -32,6 +32,12 @@ namespace osu.Game.Tests.Visual.Online
Id = 4, Id = 4,
}; };
private readonly User longUsernameUser = new User
{
Username = "Very Long Long Username",
Id = 5,
};
[Cached] [Cached]
private ChannelManager channelManager = new ChannelManager(); private ChannelManager channelManager = new ChannelManager();
@ -99,6 +105,12 @@ namespace osu.Game.Tests.Visual.Online
Sender = admin, Sender = admin,
Content = "Okay okay, calm down guys. Let's do this!" Content = "Okay okay, calm down guys. Let's do this!"
})); }));
AddStep("message from long username", () => testChannel.AddNewMessages(new Message(sequence++)
{
Sender = longUsernameUser,
Content = "Hi guys, my new username is lit!"
}));
} }
} }
} }

View File

@ -114,7 +114,7 @@ namespace osu.Game.Configuration
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f); Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
Set(OsuSetting.UIHoldActivationDelay, 200, 0, 500); Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
Set(OsuSetting.IntroSequence, IntroSequence.Triangles); Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
} }

View File

@ -30,12 +30,12 @@ namespace osu.Game.Graphics.Containers
public Bindable<double> Progress = new BindableDouble(); public Bindable<double> Progress = new BindableDouble();
private Bindable<int> holdActivationDelay; private Bindable<float> holdActivationDelay;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
holdActivationDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay); holdActivationDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
} }
protected void BeginConfirm() protected void BeginConfirm()

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
public BackButton(Receptor receptor) public BackButton(Receptor receptor)
{ {
receptor.OnBackPressed = () => Action?.Invoke(); receptor.OnBackPressed = () => button.Click();
Size = TwoLayerButton.SIZE_EXTENDED; Size = TwoLayerButton.SIZE_EXTENDED;

View File

@ -2,22 +2,20 @@
// 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 osuTK.Graphics; using osuTK.Graphics;
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osuTK.Input; using osuTK.Input;
using osu.Framework.Input.Bindings;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
/// <summary> /// <summary>
/// A textbox which holds focus eagerly. /// A textbox which holds focus eagerly.
/// </summary> /// </summary>
public class FocusedTextBox : OsuTextBox public class FocusedTextBox : OsuTextBox, IKeyBindingHandler<GlobalAction>
{ {
public Action Exit;
private bool focus; private bool focus;
private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true; private bool allowImmediateFocus => host?.OnScreenKeyboardOverlapsGameWindow != true;
@ -63,12 +61,12 @@ namespace osu.Game.Graphics.UserInterface
if (!HasFocus) return false; if (!HasFocus) return false;
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back). return false; // disable the framework-level handling of escape key for conformity (we use GlobalAction.Back).
return base.OnKeyDown(e); return base.OnKeyDown(e);
} }
public override bool OnPressed(GlobalAction action) public bool OnPressed(GlobalAction action)
{ {
if (action == GlobalAction.Back) if (action == GlobalAction.Back)
{ {
@ -79,14 +77,10 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
return base.OnPressed(action); return false;
} }
protected override void KillFocus() public bool OnReleased(GlobalAction action) => false;
{
base.KillFocus();
Exit?.Invoke();
}
public override bool RequestsFocus => HoldFocus; public override bool RequestsFocus => HoldFocus;
} }

View File

@ -8,13 +8,11 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Input.Bindings;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuTextBox : TextBox, IKeyBindingHandler<GlobalAction> public class OsuTextBox : TextBox
{ {
protected override float LeftRightPadding => 10; protected override float LeftRightPadding => 10;
@ -57,18 +55,5 @@ namespace osu.Game.Graphics.UserInterface
} }
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }; protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
public virtual bool OnPressed(GlobalAction action)
{
if (action == GlobalAction.Back)
{
KillFocus();
return true;
}
return false;
}
public bool OnReleased(GlobalAction action) => false;
} }
} }

View File

@ -21,8 +21,6 @@ namespace osu.Game.Online.Chat
{ {
public readonly Bindable<Channel> Channel = new Bindable<Channel>(); public readonly Bindable<Channel> Channel = new Bindable<Channel>();
public Action Exit;
private readonly FocusedTextBox textbox; private readonly FocusedTextBox textbox;
protected ChannelManager ChannelManager; protected ChannelManager ChannelManager;
@ -66,8 +64,6 @@ namespace osu.Game.Online.Chat
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
}); });
textbox.Exit += () => Exit?.Invoke();
} }
Channel.BindValueChanged(channelChanged); Channel.BindValueChanged(channelChanged);
@ -146,6 +142,7 @@ namespace osu.Game.Online.Chat
protected override float HorizontalPadding => 10; protected override float HorizontalPadding => 10;
protected override float MessagePadding => 120; protected override float MessagePadding => 120;
protected override float TimestampPadding => 50;
public StandAloneMessage(Message message) public StandAloneMessage(Message message)
: base(message) : base(message)

View File

@ -31,7 +31,9 @@ namespace osu.Game.Overlays.Chat
protected virtual float MessagePadding => default_message_padding; protected virtual float MessagePadding => default_message_padding;
private const float timestamp_padding = 65; private const float default_timestamp_padding = 65;
protected virtual float TimestampPadding => default_timestamp_padding;
private const float default_horizontal_padding = 15; private const float default_horizontal_padding = 15;
@ -94,7 +96,7 @@ namespace osu.Game.Overlays.Chat
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true), Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true),
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
MaxWidth = default_message_padding - timestamp_padding MaxWidth = MessagePadding - TimestampPadding
}; };
if (hasBackground) if (hasBackground)
@ -149,7 +151,6 @@ namespace osu.Game.Overlays.Chat
new MessageSender(message.Sender) new MessageSender(message.Sender)
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = timestamp_padding },
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Child = effectedUsername, Child = effectedUsername,

View File

@ -119,7 +119,6 @@ namespace osu.Game.Overlays.Chat.Selection
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
PlaceholderText = @"Search", PlaceholderText = @"Search",
Exit = Hide,
}, },
}, },
}, },

View File

@ -138,7 +138,6 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 1, Height = 1,
PlaceholderText = "type your message", PlaceholderText = "type your message",
Exit = Hide,
OnCommit = postMessage, OnCommit = postMessage,
ReleaseFocusOnCommit = false, ReleaseFocusOnCommit = false,
HoldFocus = true, HoldFocus = true,

View File

@ -31,7 +31,6 @@ namespace osu.Game.Overlays.Music
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 40, Height = 40,
Exit = () => ExitRequested?.Invoke(),
}, },
new CollectionsDropdown<PlaylistCollection> new CollectionsDropdown<PlaylistCollection>
{ {
@ -47,8 +46,6 @@ namespace osu.Game.Overlays.Music
private void current_ValueChanged(ValueChangedEvent<string> e) => FilterChanged?.Invoke(e.NewValue); private void current_ValueChanged(ValueChangedEvent<string> e) => FilterChanged?.Invoke(e.NewValue);
public Action ExitRequested;
public Action<string> FilterChanged; public Action<string> FilterChanged;
public class FilterTextBox : SearchTextBox public class FilterTextBox : SearchTextBox

View File

@ -63,7 +63,6 @@ namespace osu.Game.Overlays.Music
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
ExitRequested = Hide,
FilterChanged = search => list.Filter(search), FilterChanged = search => list.Filter(search),
Padding = new MarginPadding(10), Padding = new MarginPadding(10),
}, },

View File

@ -88,8 +88,6 @@ namespace osu.Game.Overlays.SearchableList
}, },
}, },
}; };
Filter.Search.Exit = Hide;
} }
protected override void Update() protected override void Update()

View File

@ -27,16 +27,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
LabelText = "Parallax", LabelText = "Parallax",
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax) Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
}, },
new SettingsSlider<int, TimeSlider> new SettingsSlider<float, TimeSlider>
{ {
LabelText = "Hold-to-confirm activation time", LabelText = "Hold-to-confirm activation time",
Bindable = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay), Bindable = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay),
KeyboardStep = 50 KeyboardStep = 50
}, },
}; };
} }
private class TimeSlider : OsuSliderBar<int> private class TimeSlider : OsuSliderBar<float>
{ {
public override string TooltipText => Current.Value.ToString("N0") + "ms"; public override string TooltipText => Current.Value.ToString("N0") + "ms";
} }

View File

@ -91,7 +91,6 @@ namespace osu.Game.Overlays
Top = 20, Top = 20,
Bottom = 20 Bottom = 20
}, },
Exit = Hide,
}, },
Footer = CreateFooter() Footer = CreateFooter()
}, },

View File

@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => background; protected override BackgroundScreen CreateBackground() => background;
private Bindable<int> holdDelay; private Bindable<float> holdDelay;
private Bindable<bool> loginDisplayed; private Bindable<bool> loginDisplayed;
private ExitConfirmOverlay exitConfirmOverlay; private ExitConfirmOverlay exitConfirmOverlay;
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics) private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
{ {
holdDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay); holdDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed); loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
if (host.CanExit) if (host.CanExit)

View File

@ -69,8 +69,6 @@ namespace osu.Game.Screens.Multi.Lounge
}, },
}, },
}; };
Filter.Search.Exit += this.Exit;
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()

View File

@ -62,7 +62,6 @@ namespace osu.Game.Screens.Multi.Match
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
MatchChatDisplay chat;
Components.Header header; Components.Header header;
Info info; Info info;
GridContainer bottomRow; GridContainer bottomRow;
@ -122,7 +121,7 @@ namespace osu.Game.Screens.Multi.Match
Vertical = 10, Vertical = 10,
}, },
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = chat = new MatchChatDisplay Child = new MatchChatDisplay
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }
@ -159,12 +158,6 @@ namespace osu.Game.Screens.Multi.Match
bottomRow.FadeTo(settingsDisplayed ? 0 : 1, fade_duration, Easing.OutQuint); bottomRow.FadeTo(settingsDisplayed ? 0 : 1, fade_duration, Easing.OutQuint);
}, true); }, true);
chat.Exit += () =>
{
if (this.IsCurrentScreen())
this.Exit();
};
beatmapManager.ItemAdded += beatmapAdded; beatmapManager.ItemAdded += beatmapAdded;
} }

View File

@ -63,11 +63,11 @@ namespace osu.Game.Screens.Play.HUD
[Resolved] [Resolved]
private OsuConfigManager config { get; set; } private OsuConfigManager config { get; set; }
private Bindable<int> activationDelay; private Bindable<float> activationDelay;
protected override void LoadComplete() protected override void LoadComplete()
{ {
activationDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay); activationDelay = config.GetBindable<float>(OsuSetting.UIHoldActivationDelay);
activationDelay.BindValueChanged(v => activationDelay.BindValueChanged(v =>
{ {
text.Text = v.NewValue > 0 text.Text = v.NewValue > 0

View File

@ -49,8 +49,6 @@ namespace osu.Game.Screens.Select
return criteria; return criteria;
} }
public Action Exit;
private readonly SearchTextBox searchTextBox; private readonly SearchTextBox searchTextBox;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
@ -75,11 +73,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Children = new Drawable[] Children = new Drawable[]
{ {
searchTextBox = new SearchTextBox searchTextBox = new SearchTextBox { RelativeSizeAxes = Axes.X },
{
RelativeSizeAxes = Axes.X,
Exit = () => Exit?.Invoke(),
},
new Box new Box
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -171,11 +171,6 @@ namespace osu.Game.Screens.Select
Height = FilterControl.HEIGHT, Height = FilterControl.HEIGHT,
FilterChanged = c => Carousel.Filter(c), FilterChanged = c => Carousel.Filter(c),
Background = { Width = 2 }, Background = { Width = 2 },
Exit = () =>
{
if (this.IsCurrentScreen())
this.Exit();
},
}, },
} }
}, },