Skip to content

Commit

Permalink
Reduce allocations in ModSelectOverlay
Browse files Browse the repository at this point in the history
  • Loading branch information
EVAST9919 committed Feb 24, 2024
1 parent 3b53ed3 commit 6d2187e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions osu.Game/Overlays/Mods/ModSelectOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Beatmaps;
Expand Down Expand Up @@ -349,15 +350,23 @@ protected override void LoadComplete()
});
}

private static readonly LocalisableString input_search_placeholder = Resources.Localisation.Web.CommonStrings.InputSearch;
private static readonly LocalisableString tab_to_search_placeholder = ModSelectOverlayStrings.TabToSearch;

protected override void Update()
{
base.Update();

SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? Resources.Localisation.Web.CommonStrings.InputSearch : ModSelectOverlayStrings.TabToSearch;
SearchTextBox.PlaceholderText = SearchTextBox.HasFocus ? input_search_placeholder : tab_to_search_placeholder;

if (beatmapAttributesDisplay != null)
{
float rightEdgeOfLastButton = footerButtonFlow.Last().ScreenSpaceDrawQuad.TopRight.X;
ShearedButton lastFooterButton = null!;

foreach (var b in footerButtonFlow)
lastFooterButton = b;

float rightEdgeOfLastButton = lastFooterButton.ScreenSpaceDrawQuad.TopRight.X;

// this is cheating a bit; the 640 value is hardcoded based on how wide the expanded panel _generally_ is.
// due to the transition applied, the raw screenspace quad of the panel cannot be used, as it will trigger an ugly feedback cycle of expanding and collapsing.
Expand Down

0 comments on commit 6d2187e

Please sign in to comment.