mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 18:13:09 +08: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);
|
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
||||||
if (existing == null)
|
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)
|
foreach (var newBeatmap in newCol.Beatmaps)
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ namespace osu.Game.Collections
|
|||||||
|
|
||||||
for (int i = 0; i < collectionCount; i++)
|
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();
|
int mapCount = sr.ReadInt32();
|
||||||
|
|
||||||
for (int j = 0; j < mapCount; j++)
|
for (int j = 0; j < mapCount; j++)
|
||||||
@ -183,7 +183,7 @@ namespace osu.Game.Collections
|
|||||||
|
|
||||||
foreach (var c in Collections)
|
foreach (var c in Collections)
|
||||||
{
|
{
|
||||||
sw.Write(c.Name);
|
sw.Write(c.Name.Value);
|
||||||
sw.Write(c.Beatmaps.Count);
|
sw.Write(c.Beatmaps.Count);
|
||||||
|
|
||||||
foreach (var b in c.Beatmaps)
|
foreach (var b in c.Beatmaps)
|
||||||
@ -221,7 +221,7 @@ namespace osu.Game.Collections
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action Changed;
|
public event Action Changed;
|
||||||
|
|
||||||
public string Name;
|
public readonly Bindable<string> Name = new Bindable<string>();
|
||||||
|
|
||||||
public readonly BindableList<BeatmapInfo> Beatmaps = new BindableList<BeatmapInfo>();
|
public readonly BindableList<BeatmapInfo> Beatmaps = new BindableList<BeatmapInfo>();
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Collections
|
|||||||
public DeleteCollectionDialog(BeatmapCollection collection)
|
public DeleteCollectionDialog(BeatmapCollection collection)
|
||||||
{
|
{
|
||||||
HeaderText = "Confirm deletion of";
|
HeaderText = "Confirm deletion of";
|
||||||
BodyText = collection.Name;
|
BodyText = collection.Name.Value;
|
||||||
|
|
||||||
Icon = FontAwesome.Regular.TrashAlt;
|
Icon = FontAwesome.Regular.TrashAlt;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Collections
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Size = Vector2.One,
|
Size = Vector2.One,
|
||||||
CornerRadius = item_height / 2,
|
CornerRadius = item_height / 2,
|
||||||
Text = collection.Name
|
Current = collection.Name
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Collections
|
|||||||
Size = Vector2.One,
|
Size = Vector2.One,
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding(10),
|
||||||
Text = "Create new collection",
|
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.FadeOut(exit_duration, Easing.OutQuint);
|
||||||
this.ScaleTo(0.9f, exit_duration);
|
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)
|
private MenuItem createCollectionMenuItem(BeatmapCollection collection)
|
||||||
{
|
{
|
||||||
return new ToggleMenuItem(collection.Name, MenuItemType.Standard, s =>
|
return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s =>
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
collection.Beatmaps.Add(beatmap);
|
collection.Beatmaps.Add(beatmap);
|
||||||
|
@ -171,7 +171,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
else
|
else
|
||||||
state = TernaryState.False;
|
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)
|
foreach (var b in beatmapSet.Beatmaps)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Current.TriggerChange();
|
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();
|
protected override DropdownHeader CreateHeader() => new CollectionDropdownHeader();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user