mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Have placeholder text change while focused
This commit is contained in:
parent
54a8f5b306
commit
775f76f472
@ -128,6 +128,9 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
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,18 @@ namespace osu.Game.Online.Chat
|
||||
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
|
||||
|
@ -42,8 +42,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
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
Block a user