mirror of https://github.com/ppy/osu
Merge pull request #29281 from kstefanowicz/multiplayer-chat-focus-hint
Add "enter" hint to in-gameplay chatbox placeholder text
This commit is contained in:
commit
8773c2f7eb
|
@ -24,6 +24,11 @@ public static class ChatStrings
|
|||
/// </summary>
|
||||
public static LocalisableString MentionUser => new TranslatableString(getKey(@"mention_user"), @"Mention");
|
||||
|
||||
private static string getKey(string key) => $"{prefix}:{key}";
|
||||
/// <summary>
|
||||
/// "press enter to chat..."
|
||||
/// </summary>
|
||||
public static LocalisableString InGameInputPlaceholder => new TranslatableString(getKey(@"in_game_input_placeholder"), @"press enter to chat...");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,9 @@ private void channelChanged(ValueChangedEvent<Channel> e)
|
|||
|
||||
public partial class ChatTextBox : HistoryTextBox
|
||||
{
|
||||
public Action Focus;
|
||||
public Action FocusLost;
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
// Chat text boxes are generally used in places where they retain focus, but shouldn't block interaction with other
|
||||
|
@ -153,13 +156,17 @@ protected override void LoadComplete()
|
|||
BackgroundFocused = new Color4(10, 10, 10, 255);
|
||||
}
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
base.OnFocus(e);
|
||||
Focus?.Invoke();
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(FocusLostEvent e)
|
||||
{
|
||||
base.OnFocusLost(e);
|
||||
FocusLost?.Invoke();
|
||||
}
|
||||
|
||||
public Action FocusLost;
|
||||
}
|
||||
|
||||
public partial class StandAloneDrawableChannel : DrawableChannel
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
using osu.Game.Screens.Play;
|
||||
|
@ -41,7 +42,13 @@ public GameplayChatDisplay(Room room)
|
|||
|
||||
Background.Alpha = 0.2f;
|
||||
|
||||
TextBox.FocusLost = () => expandedFromTextBoxFocus.Value = false;
|
||||
TextBox.PlaceholderText = ChatStrings.InGameInputPlaceholder;
|
||||
TextBox.Focus = () => TextBox.PlaceholderText = Resources.Localisation.Web.ChatStrings.InputPlaceholder;
|
||||
TextBox.FocusLost = () =>
|
||||
{
|
||||
TextBox.PlaceholderText = ChatStrings.InGameInputPlaceholder;
|
||||
expandedFromTextBoxFocus.Value = false;
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e) => true; // use UI mouse cursor.
|
||||
|
|
Loading…
Reference in New Issue