mirror of
https://github.com/ppy/osu
synced 2025-01-03 04:42:10 +00:00
Revert changes to basic implementation and remove redundant stuff
This commit is contained in:
parent
c08e16d97f
commit
1318f242c1
@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Overlays;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Online.API.Requests;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -25,24 +24,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Add(overlay = new BeatmapListingOverlay());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowTag()
|
||||
{
|
||||
AddStep("Show Rem tag", () => overlay.ShowTag("Rem"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowGenre()
|
||||
{
|
||||
AddStep("Show Anime genre", () => overlay.ShowGenre(BeatmapSearchGenre.Anime));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShowLanguage()
|
||||
{
|
||||
AddStep("Show Japanese language", () => overlay.ShowLanguage(BeatmapSearchLanguage.Japanese));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShow()
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
@ -57,14 +56,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
}
|
||||
});
|
||||
|
||||
section.SearchParameters.BindValueChanged(parameters =>
|
||||
{
|
||||
query.Text = $"Query: {parameters.NewValue.Query}";
|
||||
ruleset.Text = $"Ruleset: {parameters.NewValue.Ruleset}";
|
||||
category.Text = $"Category: {parameters.NewValue.Category}";
|
||||
genre.Text = $"Genre: {parameters.NewValue.Genre}";
|
||||
language.Text = $"Language: {parameters.NewValue.Language}";
|
||||
}, true);
|
||||
section.Query.BindValueChanged(q => query.Text = $"Query: {q.NewValue}", true);
|
||||
section.Ruleset.BindValueChanged(r => ruleset.Text = $"Ruleset: {r.NewValue}", true);
|
||||
section.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
|
||||
section.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
|
||||
section.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -75,17 +71,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("Set null beatmap", () => section.BeatmapSet = null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestParametersSet()
|
||||
{
|
||||
AddStep("Set big black tag", () => section.SetTag("big black"));
|
||||
AddAssert("Check query is big black", () => section.SearchParameters.Value.Query == "big black");
|
||||
AddStep("Set anime genre", () => section.SetGenre(BeatmapSearchGenre.Anime));
|
||||
AddAssert("Check genre is anime", () => section.SearchParameters.Value.Genre == BeatmapSearchGenre.Anime);
|
||||
AddStep("Set japanese language", () => section.SetLanguage(BeatmapSearchLanguage.Japanese));
|
||||
AddAssert("Check language is japanese", () => section.SearchParameters.Value.Language == BeatmapSearchLanguage.Japanese);
|
||||
}
|
||||
|
||||
private static readonly BeatmapSetInfo beatmap_set = new BeatmapSetInfo
|
||||
{
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
|
@ -13,12 +13,21 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
public class BeatmapListingSearchSection : CompositeDrawable
|
||||
{
|
||||
public Bindable<BeatmapSearchParameters> SearchParameters = new Bindable<BeatmapSearchParameters>();
|
||||
public Bindable<string> Query => textBox.Current;
|
||||
|
||||
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
|
||||
|
||||
public Bindable<BeatmapSearchCategory> Category => categoryFilter.Current;
|
||||
|
||||
public Bindable<BeatmapSearchGenre> Genre => genreFilter.Current;
|
||||
|
||||
public Bindable<BeatmapSearchLanguage> Language => languageFilter.Current;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
@ -105,12 +114,6 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
});
|
||||
|
||||
categoryFilter.Current.Value = BeatmapSearchCategory.Leaderboard;
|
||||
|
||||
textBox.Current.BindValueChanged(_ => changeSearchParameters());
|
||||
modeFilter.Current.BindValueChanged(_ => changeSearchParameters());
|
||||
categoryFilter.Current.BindValueChanged(_ => changeSearchParameters());
|
||||
genreFilter.Current.BindValueChanged(_ => changeSearchParameters());
|
||||
languageFilter.Current.BindValueChanged(_ => changeSearchParameters(), true);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -119,22 +122,6 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
background.Colour = colourProvider.Dark6;
|
||||
}
|
||||
|
||||
public void SetTag(string tag) => textBox.Current.Value = tag;
|
||||
|
||||
public void SetGenre(BeatmapSearchGenre genre) => genreFilter.Current.Value = genre;
|
||||
|
||||
public void SetLanguage(BeatmapSearchLanguage language) => languageFilter.Current.Value = language;
|
||||
|
||||
private void changeSearchParameters()
|
||||
{
|
||||
SearchParameters.Value = new BeatmapSearchParameters(
|
||||
textBox.Current.Value,
|
||||
modeFilter.Current.Value,
|
||||
categoryFilter.Current.Value,
|
||||
genreFilter.Current.Value,
|
||||
languageFilter.Current.Value);
|
||||
}
|
||||
|
||||
private class BeatmapSearchTextBox : SearchTextBox
|
||||
{
|
||||
protected override Color4 SelectionColour => Color4.Gray;
|
||||
|
@ -1,30 +0,0 @@
|
||||
// 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.Game.Online.API.Requests;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
public class BeatmapSearchParameters
|
||||
{
|
||||
public readonly string Query;
|
||||
|
||||
public readonly RulesetInfo Ruleset;
|
||||
|
||||
public readonly BeatmapSearchCategory Category;
|
||||
|
||||
public readonly BeatmapSearchGenre Genre;
|
||||
|
||||
public readonly BeatmapSearchLanguage Language;
|
||||
|
||||
public BeatmapSearchParameters(string query, RulesetInfo ruleset, BeatmapSearchCategory category, BeatmapSearchGenre genre, BeatmapSearchLanguage language)
|
||||
{
|
||||
Query = query;
|
||||
Ruleset = ruleset;
|
||||
Category = category;
|
||||
Genre = genre;
|
||||
Language = language;
|
||||
}
|
||||
}
|
||||
}
|
@ -153,43 +153,22 @@ namespace osu.Game.Overlays
|
||||
var sortCriteria = sortControl.Current;
|
||||
var sortDirection = sortControl.SortDirection;
|
||||
|
||||
searchSection.SearchParameters.BindValueChanged(parameters =>
|
||||
searchSection.Query.BindValueChanged(query =>
|
||||
{
|
||||
if (parameters.OldValue.Query != parameters.NewValue.Query)
|
||||
{
|
||||
sortCriteria.Value = string.IsNullOrEmpty(parameters.NewValue.Query) ? DirectSortCriteria.Ranked : DirectSortCriteria.Relevance;
|
||||
sortDirection.Value = SortDirection.Descending;
|
||||
|
||||
queueUpdateSearch(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
queueUpdateSearch();
|
||||
}
|
||||
sortCriteria.Value = string.IsNullOrEmpty(query.NewValue) ? DirectSortCriteria.Ranked : DirectSortCriteria.Relevance;
|
||||
sortDirection.Value = SortDirection.Descending;
|
||||
queueUpdateSearch(true);
|
||||
});
|
||||
|
||||
searchSection.Ruleset.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchSection.Category.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchSection.Genre.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchSection.Language.BindValueChanged(_ => queueUpdateSearch());
|
||||
|
||||
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
|
||||
sortDirection.BindValueChanged(_ => queueUpdateSearch());
|
||||
}
|
||||
|
||||
public void ShowTag(string tag)
|
||||
{
|
||||
searchSection.SetTag(tag);
|
||||
Show();
|
||||
}
|
||||
|
||||
public void ShowGenre(BeatmapSearchGenre genre)
|
||||
{
|
||||
searchSection.SetGenre(genre);
|
||||
Show();
|
||||
}
|
||||
|
||||
public void ShowLanguage(BeatmapSearchLanguage language)
|
||||
{
|
||||
searchSection.SetLanguage(language);
|
||||
Show();
|
||||
}
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
|
||||
private LoadingLayer loadingLayer;
|
||||
@ -218,13 +197,13 @@ namespace osu.Game.Overlays
|
||||
|
||||
loadingLayer.Show();
|
||||
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(searchSection.SearchParameters.Value.Query, searchSection.SearchParameters.Value.Ruleset)
|
||||
getSetsRequest = new SearchBeatmapSetsRequest(searchSection.Query.Value, searchSection.Ruleset.Value)
|
||||
{
|
||||
SearchCategory = searchSection.SearchParameters.Value.Category,
|
||||
SearchCategory = searchSection.Category.Value,
|
||||
SortCriteria = sortControl.Current.Value,
|
||||
SortDirection = sortControl.SortDirection.Value,
|
||||
Genre = searchSection.SearchParameters.Value.Genre,
|
||||
Language = searchSection.SearchParameters.Value.Language
|
||||
Genre = searchSection.Genre.Value,
|
||||
Language = searchSection.Language.Value
|
||||
};
|
||||
|
||||
getSetsRequest.Success += response => Schedule(() => recreatePanels(response));
|
||||
|
Loading…
Reference in New Issue
Block a user