mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 07:23:14 +08:00
Merge branch 'master' into mod-overlay/incompatibility-panels-clickable
This commit is contained in:
commit
5120faa830
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Overlays.Settings.Sections;
|
using osu.Game.Overlays.Settings.Sections;
|
||||||
using osu.Game.Overlays.Settings.Sections.Input;
|
using osu.Game.Overlays.Settings.Sections.Input;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -34,6 +35,29 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestQuickFiltering()
|
||||||
|
{
|
||||||
|
AddStep("set filter", () =>
|
||||||
|
{
|
||||||
|
settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling";
|
||||||
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
|
||||||
|
|
||||||
|
AddAssert("ensure all items match filter", () => settings.SectionsContainer
|
||||||
|
.ChildrenOfType<SettingsSection>().Where(f => f.IsPresent)
|
||||||
|
.All(section =>
|
||||||
|
section.Children.Where(f => f.IsPresent)
|
||||||
|
.OfType<ISettingsItem>()
|
||||||
|
.OfType<IFilterable>()
|
||||||
|
.Where(f => !(f is IHasFilterableChildren))
|
||||||
|
.All(f => f.FilterTerms.Any(t => t.Contains("scaling")))
|
||||||
|
));
|
||||||
|
|
||||||
|
AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ToggleVisibility()
|
public void ToggleVisibility()
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -16,11 +15,11 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
{
|
{
|
||||||
internal class DifficultyIconTooltip : VisibilityContainer, ITooltip<DifficultyIconTooltipContent>
|
internal class DifficultyIconTooltip : VisibilityContainer, ITooltip<DifficultyIconTooltipContent>
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText difficultyName, starRating;
|
private OsuSpriteText difficultyName;
|
||||||
private readonly Box background;
|
private StarRatingDisplay starRating;
|
||||||
private readonly FillFlowContainer difficultyFlow;
|
|
||||||
|
|
||||||
public DifficultyIconTooltip()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -28,9 +27,10 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
new Box
|
||||||
{
|
{
|
||||||
Alpha = 0.9f,
|
Alpha = 0.9f,
|
||||||
|
Colour = colours.Gray3,
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
@ -40,6 +40,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
AutoSizeEasing = Easing.OutQuint,
|
AutoSizeEasing = Easing.OutQuint,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
|
Spacing = new Vector2(5),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
difficultyName = new OsuSpriteText
|
difficultyName = new OsuSpriteText
|
||||||
@ -48,57 +49,27 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
||||||
},
|
},
|
||||||
difficultyFlow = new FillFlowContainer
|
starRating = new StarRatingDisplay(default, StarRatingDisplaySize.Small)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = 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 DifficultyIconTooltipContent displayedContent;
|
||||||
private OsuColour colours { get; set; }
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
background.Colour = colours.Gray3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IBindable<StarDifficulty> starDifficulty = new Bindable<StarDifficulty>();
|
|
||||||
|
|
||||||
public void SetContent(DifficultyIconTooltipContent content)
|
public void SetContent(DifficultyIconTooltipContent content)
|
||||||
{
|
{
|
||||||
difficultyName.Text = content.BeatmapInfo.DifficultyName;
|
if (displayedContent != null)
|
||||||
|
starRating.Current.UnbindFrom(displayedContent.Difficulty);
|
||||||
|
|
||||||
starDifficulty.UnbindAll();
|
displayedContent = content;
|
||||||
starDifficulty.BindTo(content.Difficulty);
|
|
||||||
starDifficulty.BindValueChanged(difficulty =>
|
starRating.Current.BindTarget = displayedContent.Difficulty;
|
||||||
{
|
difficultyName.Text = displayedContent.BeatmapInfo.DifficultyName;
|
||||||
starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
|
|
||||||
difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
|
|
||||||
}, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move(Vector2 pos) => Position = pos;
|
public void Move(Vector2 pos) => Position = pos;
|
||||||
|
@ -100,10 +100,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
public IEnumerable<string> Keywords { get; set; }
|
public IEnumerable<string> Keywords { get; set; }
|
||||||
|
|
||||||
public bool MatchingFilter
|
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||||
{
|
|
||||||
set => Alpha = value ? 1 : 0;
|
public bool MatchingFilter { get; set; } = true;
|
||||||
}
|
|
||||||
|
|
||||||
public bool FilteringActive { get; set; }
|
public bool FilteringActive { get; set; }
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Settings
|
|||||||
protected FillFlowContainer FlowContent;
|
protected FillFlowContainer FlowContent;
|
||||||
protected override Container<Drawable> Content => FlowContent;
|
protected override Container<Drawable> Content => FlowContent;
|
||||||
|
|
||||||
|
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||||
|
|
||||||
private IBindable<SettingsSection> selectedSection;
|
private IBindable<SettingsSection> selectedSection;
|
||||||
|
|
||||||
private Box dim;
|
private Box dim;
|
||||||
@ -38,10 +40,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
private const int header_size = 24;
|
private const int header_size = 24;
|
||||||
private const int border_size = 4;
|
private const int border_size = 4;
|
||||||
|
|
||||||
public bool MatchingFilter
|
public bool MatchingFilter { get; set; } = true;
|
||||||
{
|
|
||||||
set => this.FadeTo(value ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FilteringActive { get; set; }
|
public bool FilteringActive { get; set; }
|
||||||
|
|
||||||
|
@ -163,6 +163,7 @@ namespace osu.Game.Overlays
|
|||||||
Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
Sidebar?.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
|
this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
|
||||||
|
searchTextBox.TakeFocus();
|
||||||
searchTextBox.HoldFocus = true;
|
searchTextBox.HoldFocus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +214,6 @@ namespace osu.Game.Overlays
|
|||||||
loading.Hide();
|
loading.Hide();
|
||||||
|
|
||||||
searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true);
|
searchTextBox.Current.BindValueChanged(term => SectionsContainer.SearchTerm = term.NewValue, true);
|
||||||
searchTextBox.TakeFocus();
|
|
||||||
|
|
||||||
loadSidebarButtons();
|
loadSidebarButtons();
|
||||||
});
|
});
|
||||||
@ -284,11 +284,7 @@ namespace osu.Game.Overlays
|
|||||||
public string SearchTerm
|
public string SearchTerm
|
||||||
{
|
{
|
||||||
get => SearchContainer.SearchTerm;
|
get => SearchContainer.SearchTerm;
|
||||||
set
|
set => SearchContainer.SearchTerm = value;
|
||||||
{
|
|
||||||
SearchContainer.SearchTerm = value;
|
|
||||||
InvalidateScrollPosition();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FlowContainer<SettingsSection> CreateScrollContentContainer()
|
protected override FlowContainer<SettingsSection> CreateScrollContentContainer()
|
||||||
@ -307,6 +303,8 @@ namespace osu.Game.Overlays
|
|||||||
Colour = colourProvider.Background4,
|
Colour = colourProvider.Background4,
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SearchContainer.FilterCompleted += InvalidateScrollPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
|
Loading…
Reference in New Issue
Block a user