1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 17:45:20 +08:00

Dynamically change placeholder to convey how to activate search

This commit is contained in:
Bartłomiej Dach 2023-06-18 15:53:49 +02:00
parent 75300ca229
commit b87acfa66f
No known key found for this signature in database
3 changed files with 21 additions and 2 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
@ -37,6 +38,12 @@ namespace osu.Game.Graphics.UserInterface
set => textBox.HoldFocus = value;
}
public LocalisableString PlaceholderText
{
get => textBox.PlaceholderText;
set => textBox.PlaceholderText = value;
}
public new bool HasFocus => textBox.HasFocus;
public void TakeFocus() => textBox.TakeFocus();

View File

@ -1,4 +1,4 @@
// 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.
using osu.Framework.Localisation;
@ -39,6 +39,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString UseCurrentMods => new TranslatableString(getKey(@"use_current_mods"), @"Use current mods");
/// <summary>
/// "tab to search..."
/// </summary>
public static LocalisableString TabToSearch => new TranslatableString(getKey(@"tab_to_search"), @"tab to search...");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}
}

View File

@ -303,6 +303,13 @@ namespace osu.Game.Overlays.Mods
});
}
protected override void Update()
{
base.Update();
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? Resources.Localisation.Web.CommonStrings.InputSearch : ModSelectOverlayStrings.TabToSearch;
}
/// <summary>
/// Select all visible mods in all columns.
/// </summary>