2022-03-30 04:36:08 +08:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
using osu.Framework.Bindables;
|
2022-11-15 20:06:02 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2022-05-27 13:23:03 +08:00
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2022-03-30 04:36:08 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Chat
|
|
|
|
{
|
2022-11-15 23:12:24 +08:00
|
|
|
public class ChatTextBox : HistoryTextBox
|
2022-03-30 04:36:08 +08:00
|
|
|
{
|
|
|
|
public readonly BindableBool ShowSearch = new BindableBool();
|
|
|
|
|
|
|
|
public override bool HandleLeftRightArrows => !ShowSearch.Value;
|
|
|
|
|
2022-08-02 12:56:02 +08:00
|
|
|
protected override bool ClearTextOnBackKey => false;
|
|
|
|
|
2022-03-30 04:36:08 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
ShowSearch.BindValueChanged(change =>
|
|
|
|
{
|
2022-04-03 00:14:27 +08:00
|
|
|
bool showSearch = change.NewValue;
|
|
|
|
|
2022-05-27 13:23:03 +08:00
|
|
|
PlaceholderText = showSearch ? HomeStrings.SearchPlaceholder : ChatStrings.InputPlaceholder;
|
2022-04-03 00:14:27 +08:00
|
|
|
Text = string.Empty;
|
2022-03-30 04:36:08 +08:00
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Commit()
|
|
|
|
{
|
|
|
|
if (ShowSearch.Value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
base.Commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|