17
17
using osu . Framework . Graphics . Shapes ;
18
18
using osu . Framework . Graphics . Sprites ;
19
19
using osu . Framework . Graphics . UserInterface ;
20
+ using osu . Framework . Localisation ;
20
21
using osu . Game . Beatmaps ;
21
22
using osu . Game . Configuration ;
22
23
using osu . Game . Extensions ;
@@ -447,6 +448,9 @@ protected override void LoadComplete()
447
448
448
449
private partial class ExtraTagsPopover : OsuPopover
449
450
{
451
+ private SearchTextBox searchBox = null ! ;
452
+ private SearchContainer searchContainer = null ! ;
453
+
450
454
public BindableList < UserTag > ExtraTags { get ; } = new BindableList < UserTag > ( ) ;
451
455
452
456
public Action < UserTag > ? OnSelected { get ; set ; }
@@ -457,28 +461,43 @@ private void load()
457
461
Child = new OsuScrollContainer
458
462
{
459
463
Width = 250 ,
460
- Height = 200 ,
464
+ Height = 250 ,
461
465
ScrollbarOverlapsContent = false ,
462
- Child = new FillFlowContainer
466
+ Children = new Drawable [ ]
463
467
{
464
- RelativeSizeAxes = Axes . X ,
465
- AutoSizeAxes = Axes . Y ,
466
- Padding = new MarginPadding { Right = 5 } ,
467
- Spacing = new Vector2 ( 10 ) ,
468
- ChildrenEnumerable = ExtraTags . Select ( tag => new DrawableExtraTag ( tag )
468
+ searchBox = new SearchTextBox
469
+ {
470
+ RelativeSizeAxes = Axes . X ,
471
+ } ,
472
+ searchContainer = new SearchContainer
469
473
{
470
- Action = ( ) =>
474
+ RelativeSizeAxes = Axes . X ,
475
+ AutoSizeAxes = Axes . Y ,
476
+ Direction = FillDirection . Vertical ,
477
+ Padding = new MarginPadding { Right = 5 , Top = 50 , } ,
478
+ Spacing = new Vector2 ( 10 ) ,
479
+ ChildrenEnumerable = ExtraTags . Select ( tag => new DrawableExtraTag ( tag )
471
480
{
472
- OnSelected ? . Invoke ( tag ) ;
473
- this . HidePopover ( ) ;
474
- }
475
- } )
476
- }
481
+ Action = ( ) =>
482
+ {
483
+ OnSelected ? . Invoke ( tag ) ;
484
+ this . HidePopover ( ) ;
485
+ }
486
+ } )
487
+ }
488
+ } ,
477
489
} ;
478
490
}
491
+
492
+ protected override void LoadComplete ( )
493
+ {
494
+ base . LoadComplete ( ) ;
495
+
496
+ searchBox . Current . BindValueChanged ( _ => searchContainer . SearchTerm = searchBox . Current . Value , true ) ;
497
+ }
479
498
}
480
499
481
- private partial class DrawableExtraTag : OsuAnimatedButton
500
+ private partial class DrawableExtraTag : OsuAnimatedButton , IFilterable
482
501
{
483
502
private readonly UserTag tag ;
484
503
@@ -527,6 +546,15 @@ private void load(OsuColour colours)
527
546
}
528
547
} ) ;
529
548
}
549
+
550
+ public IEnumerable < LocalisableString > FilterTerms => [ tag . Name , tag . Description ] ;
551
+
552
+ public bool MatchingFilter
553
+ {
554
+ set => Alpha = value ? 1 : 0 ;
555
+ }
556
+
557
+ public bool FilteringActive { set { } }
530
558
}
531
559
}
532
560
0 commit comments