Merge branch 'master' into mod-overlay/incompatibility-panels-clickable

This commit is contained in:
Salman Ahmed
2022-04-22 22:19:42 +03:00
5 changed files with 49 additions and 58 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -16,11 +15,11 @@ namespace osu.Game.Beatmaps.Drawables
{
internal class DifficultyIconTooltip : VisibilityContainer, ITooltip<DifficultyIconTooltipContent>
{
private readonly OsuSpriteText difficultyName, starRating;
private readonly Box background;
private readonly FillFlowContainer difficultyFlow;
private OsuSpriteText difficultyName;
private StarRatingDisplay starRating;
public DifficultyIconTooltip()
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AutoSizeAxes = Axes.Both;
Masking = true;
@ -28,9 +27,10 @@ namespace osu.Game.Beatmaps.Drawables
Children = new Drawable[]
{
background = new Box
new Box
{
Alpha = 0.9f,
Colour = colours.Gray3,
RelativeSizeAxes = Axes.Both
},
new FillFlowContainer
@ -40,6 +40,7 @@ namespace osu.Game.Beatmaps.Drawables
AutoSizeEasing = Easing.OutQuint,
Direction = FillDirection.Vertical,
Padding = new MarginPadding(10),
Spacing = new Vector2(5),
Children = new Drawable[]
{
difficultyName = new OsuSpriteText
@ -48,57 +49,27 @@ namespace osu.Game.Beatmaps.Drawables
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
},
difficultyFlow = new FillFlowContainer
starRating = new StarRatingDisplay(default, StarRatingDisplaySize.Small)
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
starRating = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Left = 4 },
Icon = FontAwesome.Solid.Star,
Size = new Vector2(12),
},
}
}
}
}
};
}
[Resolved]
private OsuColour colours { get; set; }
[BackgroundDependencyLoader]
private void load()
{
background.Colour = colours.Gray3;
}
private readonly IBindable<StarDifficulty> starDifficulty = new Bindable<StarDifficulty>();
private DifficultyIconTooltipContent displayedContent;
public void SetContent(DifficultyIconTooltipContent content)
{
difficultyName.Text = content.BeatmapInfo.DifficultyName;
if (displayedContent != null)
starRating.Current.UnbindFrom(displayedContent.Difficulty);
starDifficulty.UnbindAll();
starDifficulty.BindTo(content.Difficulty);
starDifficulty.BindValueChanged(difficulty =>
{
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
}, true);
displayedContent = content;
starRating.Current.BindTarget = displayedContent.Difficulty;
difficultyName.Text = displayedContent.BeatmapInfo.DifficultyName;
}
public void Move(Vector2 pos) => Position = pos;

View File

@ -100,10 +100,9 @@ namespace osu.Game.Overlays.Settings
public IEnumerable<string> Keywords { get; set; }
public bool MatchingFilter
{
set => Alpha = value ? 1 : 0;
}
public override bool IsPresent => base.IsPresent && MatchingFilter;
public bool MatchingFilter { get; set; } = true;
public bool FilteringActive { get; set; }

View File

@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Settings
protected FillFlowContainer FlowContent;
protected override Container<Drawable> Content => FlowContent;
public override bool IsPresent => base.IsPresent && MatchingFilter;
private IBindable<SettingsSection> selectedSection;
private Box dim;
@ -38,10 +40,7 @@ namespace osu.Game.Overlays.Settings
private const int header_size = 24;
private const int border_size = 4;
public bool MatchingFilter
{
set => this.FadeTo(value ? 1 : 0);
}
public bool MatchingFilter { get; set; } = true;
public bool FilteringActive { get; set; }

View File

@ -163,6 +163,7 @@ namespace osu.Game.Overlays
Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
searchTextBox.TakeFocus();
searchTextBox.HoldFocus = true;
}
@ -213,7 +214,6 @@ namespace osu.Game.Overlays
loading.Hide();
searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true);
searchTextBox.TakeFocus();
loadSidebarButtons();
});
@ -284,11 +284,7 @@ namespace osu.Game.Overlays
public string SearchTerm
{
get => SearchContainer.SearchTerm;
set
{
SearchContainer.SearchTerm = value;
InvalidateScrollPosition();
}
set => SearchContainer.SearchTerm = value;
}
protected override FlowContainer<SettingsSection> CreateScrollContentContainer()
@ -307,6 +303,8 @@ namespace osu.Game.Overlays
Colour = colourProvider.Background4,
RelativeSizeAxes = Axes.Both
};
SearchContainer.FilterCompleted += InvalidateScrollPosition;
}
protected override void UpdateAfterChildren()