mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge pull request #24733 from Joehuu/wedge-title-artist-link
Link new song select wedge title and artist to search text box
This commit is contained in:
commit
281c2f6de1
@ -141,9 +141,9 @@ namespace osu.Game.Screens.Select
|
|||||||
LayoutEasing = Easing.OutQuad,
|
LayoutEasing = Easing.OutQuad,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
description = new MetadataSectionDescription(searchOnSongSelect),
|
description = new MetadataSectionDescription(query => songSelect?.Search(query)),
|
||||||
source = new MetadataSectionSource(searchOnSongSelect),
|
source = new MetadataSectionSource(query => songSelect?.Search(query)),
|
||||||
tags = new MetadataSectionTags(searchOnSongSelect),
|
tags = new MetadataSectionTags(query => songSelect?.Search(query)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -176,12 +176,6 @@ namespace osu.Game.Screens.Select
|
|||||||
},
|
},
|
||||||
loading = new LoadingLayer(true)
|
loading = new LoadingLayer(true)
|
||||||
};
|
};
|
||||||
|
|
||||||
void searchOnSongSelect(string text)
|
|
||||||
{
|
|
||||||
if (songSelect != null)
|
|
||||||
songSelect.FilterControl.CurrentTextSearch.Value = text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateStatistics()
|
private void updateStatistics()
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
@ -270,38 +271,59 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(SongSelect? songSelect, LocalisationManager localisation)
|
||||||
{
|
{
|
||||||
var metadata = working.Metadata;
|
var metadata = working.Metadata;
|
||||||
|
|
||||||
|
var titleText = new RomanisableString(metadata.TitleUnicode, metadata.Title);
|
||||||
|
var artistText = new RomanisableString(metadata.ArtistUnicode, metadata.Artist);
|
||||||
|
|
||||||
Child = new FillFlowContainer
|
Child = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Name = "Top-left aligned metadata",
|
Name = "Top-left aligned metadata",
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Padding = new MarginPadding { Left = text_margin, Right = text_margin + shear_width, Top = 12 },
|
Padding = new MarginPadding { Left = text_margin, Top = 12 },
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TitleLabel = new TruncatingSpriteText
|
new OsuHoverContainer
|
||||||
{
|
{
|
||||||
Shadow = true,
|
AutoSizeAxes = Axes.Both,
|
||||||
Text = new RomanisableString(metadata.TitleUnicode, metadata.Title),
|
Action = () => songSelect?.Search(titleText.GetPreferred(localisation.CurrentParameters.Value.PreferOriginalScript)),
|
||||||
Font = OsuFont.TorusAlternate.With(size: 40, weight: FontWeight.SemiBold),
|
Child = TitleLabel = new TruncatingSpriteText
|
||||||
RelativeSizeAxes = Axes.X,
|
{
|
||||||
|
Shadow = true,
|
||||||
|
Text = titleText,
|
||||||
|
Font = OsuFont.TorusAlternate.With(size: 40, weight: FontWeight.SemiBold),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
ArtistLabel = new TruncatingSpriteText
|
new OsuHoverContainer
|
||||||
{
|
{
|
||||||
// TODO : figma design has a diffused shadow, instead of the solid one present here, not possible currently as far as i'm aware.
|
AutoSizeAxes = Axes.Both,
|
||||||
Shadow = true,
|
Action = () => songSelect?.Search(artistText.GetPreferred(localisation.CurrentParameters.Value.PreferOriginalScript)),
|
||||||
Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
|
Child = ArtistLabel = new TruncatingSpriteText
|
||||||
// Not sure if this should be semi bold or medium
|
{
|
||||||
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
|
// TODO : figma design has a diffused shadow, instead of the solid one present here, not possible currently as far as i'm aware.
|
||||||
RelativeSizeAxes = Axes.X,
|
Shadow = true,
|
||||||
}
|
Text = artistText,
|
||||||
|
// Not sure if this should be semi bold or medium
|
||||||
|
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
// best effort to confine the auto-sized text to wedge bounds
|
||||||
|
// the artist label doesn't have an extra text_margin as it doesn't touch the right metadata
|
||||||
|
TitleLabel.MaxWidth = DrawWidth - text_margin * 2 - shear_width;
|
||||||
|
ArtistLabel.MaxWidth = DrawWidth - text_margin - shear_width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,6 +390,15 @@ namespace osu.Game.Screens.Select
|
|||||||
this.Push(new EditorLoader());
|
this.Push(new EditorLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the query to the search text box.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">The string to search.</param>
|
||||||
|
public void Search(string query)
|
||||||
|
{
|
||||||
|
FilterControl.CurrentTextSearch.Value = query;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call to make a selection and perform the default action for this SongSelect.
|
/// Call to make a selection and perform the default action for this SongSelect.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user