mirror of
https://github.com/ppy/osu
synced 2024-12-25 08:12:41 +00:00
Make collection name a bindable
This commit is contained in:
parent
345fb9d8e0
commit
4b4dd02942
@ -97,7 +97,7 @@ namespace osu.Game.Collections
|
||||
{
|
||||
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
||||
if (existing == null)
|
||||
Collections.Add(existing = new BeatmapCollection { Name = newCol.Name });
|
||||
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });
|
||||
|
||||
foreach (var newBeatmap in newCol.Beatmaps)
|
||||
{
|
||||
@ -122,7 +122,7 @@ namespace osu.Game.Collections
|
||||
|
||||
for (int i = 0; i < collectionCount; i++)
|
||||
{
|
||||
var collection = new BeatmapCollection { Name = sr.ReadString() };
|
||||
var collection = new BeatmapCollection { Name = { Value = sr.ReadString() } };
|
||||
int mapCount = sr.ReadInt32();
|
||||
|
||||
for (int j = 0; j < mapCount; j++)
|
||||
@ -183,7 +183,7 @@ namespace osu.Game.Collections
|
||||
|
||||
foreach (var c in Collections)
|
||||
{
|
||||
sw.Write(c.Name);
|
||||
sw.Write(c.Name.Value);
|
||||
sw.Write(c.Beatmaps.Count);
|
||||
|
||||
foreach (var b in c.Beatmaps)
|
||||
@ -221,7 +221,7 @@ namespace osu.Game.Collections
|
||||
/// </summary>
|
||||
public event Action Changed;
|
||||
|
||||
public string Name;
|
||||
public readonly Bindable<string> Name = new Bindable<string>();
|
||||
|
||||
public readonly BindableList<BeatmapInfo> Beatmaps = new BindableList<BeatmapInfo>();
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Collections
|
||||
public DeleteCollectionDialog(BeatmapCollection collection)
|
||||
{
|
||||
HeaderText = "Confirm deletion of";
|
||||
BodyText = collection.Name;
|
||||
BodyText = collection.Name.Value;
|
||||
|
||||
Icon = FontAwesome.Regular.TrashAlt;
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Collections
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = Vector2.One,
|
||||
CornerRadius = item_height / 2,
|
||||
Text = collection.Name
|
||||
Current = collection.Name
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Collections
|
||||
Size = Vector2.One,
|
||||
Padding = new MarginPadding(10),
|
||||
Text = "Create new collection",
|
||||
Action = () => collectionManager.Collections.Add(new BeatmapCollection { Name = "My new collection" })
|
||||
Action = () => collectionManager.Collections.Add(new BeatmapCollection { Name = { Value = "My new collection" } })
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -120,6 +120,9 @@ namespace osu.Game.Collections
|
||||
|
||||
this.FadeOut(exit_duration, Easing.OutQuint);
|
||||
this.ScaleTo(0.9f, exit_duration);
|
||||
|
||||
// Ensure that textboxes commit
|
||||
GetContainingInputManager()?.TriggerFocusContention(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private MenuItem createCollectionMenuItem(BeatmapCollection collection)
|
||||
{
|
||||
return new ToggleMenuItem(collection.Name, MenuItemType.Standard, s =>
|
||||
return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s =>
|
||||
{
|
||||
if (s)
|
||||
collection.Beatmaps.Add(beatmap);
|
||||
|
@ -171,7 +171,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
else
|
||||
state = TernaryState.False;
|
||||
|
||||
return new TernaryStateMenuItem(collection.Name, MenuItemType.Standard, s =>
|
||||
return new TernaryStateMenuItem(collection.Name.Value, MenuItemType.Standard, s =>
|
||||
{
|
||||
foreach (var b in beatmapSet.Beatmaps)
|
||||
{
|
||||
|
@ -270,7 +270,7 @@ namespace osu.Game.Screens.Select
|
||||
Current.TriggerChange();
|
||||
}
|
||||
|
||||
protected override string GenerateItemText(CollectionFilter item) => item.Collection?.Name ?? "All beatmaps";
|
||||
protected override string GenerateItemText(CollectionFilter item) => item.Collection?.Name.Value ?? "All beatmaps";
|
||||
|
||||
protected override DropdownHeader CreateHeader() => new CollectionDropdownHeader();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user