Skip to content

Commit

Permalink
XDDDD
Browse files Browse the repository at this point in the history
  • Loading branch information
kinsi55 committed Dec 3, 2024
1 parent aa9e594 commit 302616f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Configuration/FilterPresets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ internal void CalculateTagBitfields() {


[UIComponent("hideOlderThanSlider")] internal SliderSetting hideOlderThanSlider = null;
[UIComponent("genrePickButton")] internal NoTransitionsButton genrePickButton = null;

[UIAction("ShowGenrePicker")]
void ShowGenrePicker() => filterView.ShowGenrePicker();

[UIAction("UpdateData")] public static void UpdateData(object _ = null) => SharedCoroutineStarter.instance.StartCoroutine(FilterView.limitedUpdateData.CallNextFrame());

Expand Down
14 changes: 6 additions & 8 deletions UI/FilterView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,11 @@ void Parsed() {
//// I hate BSML some times
var m = GetComponentsInChildren<DropDownListSetting>()
.Where(x => x.AssociatedValue.MemberName == "mods")
.FirstOrDefault() //https://discord.com/channels/441805394323439646/864240224400572467/1311519207682474074
?.GetComponent<DropdownWithTableView>()
.First()
.GetComponent<DropdownWithTableView>()
._modalView;

if(m != null)
((RectTransform)m.transform).pivot = new Vector2(0.5f, 0.3f);
((RectTransform)m.transform).pivot = new Vector2(0.5f, 0.3f);

// This is garbage
foreach(var x in GetComponentsInChildren<Backgroundable>().Select(x => x.GetComponent<ImageView>())) {
Expand Down Expand Up @@ -131,14 +130,13 @@ internal void SetFilter(FilterOptions filter = null) {


BSMLParserParams genreViewParams = null;
[UIAction("ShowGenrePicker")]
void ShowGenrePicker() {

internal void ShowGenrePicker() {
BSMLStuff.InitSplitView(ref genreViewParams, gameObject, SplitViews.GenrePicker.instance).EmitEvent("OpenGenreModal");

SplitViews.GenrePicker.instance.Reload();
}

[UIComponent("genrePickButton")] internal NoTransitionsButton genrePickButton = null;
internal void SetGenreFilter(List<string> includedGenres, List<string> excludedGenres) {
currentFilter.mapGenreString = includedGenres == null ? "" : string.Join(",", includedGenres);
currentFilter.mapGenreExcludeString = excludedGenres == null ? "" : string.Join(",", excludedGenres);
Expand All @@ -148,7 +146,7 @@ internal void SetGenreFilter(List<string> includedGenres, List<string> excludedG
if(includedGenres?.Count > 0 || excludedGenres?.Count > 0)
genrefilter = $"{includedGenres?.Count ?? 0} Incl., {excludedGenres?.Count ?? 0} Excl.";

genrePickButton.GetComponentInChildren<CurvedTextMeshPro>().text = genrefilter;
currentFilter.genrePickButton.GetComponentInChildren<CurvedTextMeshPro>().text = genrefilter;

FilterOptions.UpdateData();
}
Expand Down
6 changes: 2 additions & 4 deletions UI/Views/FilterView.bsml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@
<slider-setting text='Minimum Votes' value="minimumVotes" bind-value="true" apply-on-change="true" max='100' integer-only='true' on-change="UpdateData"/>
<string-setting text='Uploader(s)' value='uploadersString' bind-value='true' apply-on-change='true' formatter='FormatUploaderShortInfo' on-change="UpdateData" hover-hint='You can enter multiple Uploader names, seperated by spaces. If you have an Exclamation mark at the beginning of your input it becomes a blacklist for the given uploaders'/>
<dropdown-list-setting text='Map Style' value="mapStyleString" apply-on-change="true" bind-value="true" choices='mapStyles' formatter='FormatBeatSaverTag' on-change="UpdateData"/>
<horizontal pad-right="-3"> <!--child-alignment="MiddleRight" -->
<horizontal child-alignment="MiddleRight" pad-right="-3">
<text text="Song Genre" align="MidlineLeft" italics="true"/>
<macro.as-host host='filterView'>
<button id='genrePickButton' text="Any" preferred-width="29" on-click="ShowGenrePicker" all-uppercase="false"/>
</macro.as-host>
<button id='genrePickButton' text="Any" preferred-width="29" on-click="ShowGenrePicker" all-uppercase="false"/>
</horizontal>
<checkbox-setting apply-on-change="true" value="onlyCuratedMaps" text="Curated Maps" on-change="UpdateData"/>
<checkbox-setting apply-on-change="true" value="onlyVerifiedMappers" text="Verified Mappers" on-change="UpdateData"/>
Expand Down

0 comments on commit 302616f

Please sign in to comment.