mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 17:33:02 +08:00
Move CollectionManager to OsuGame
This commit is contained in:
parent
4ddf5f054b
commit
0360f7d845
@ -62,7 +62,7 @@ namespace osu.Game.Collections
|
|||||||
private readonly IBindable<string> collectionName;
|
private readonly IBindable<string> collectionName;
|
||||||
private readonly BeatmapCollection collection;
|
private readonly BeatmapCollection collection;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
private Container textBoxPaddingContainer;
|
private Container textBoxPaddingContainer;
|
||||||
@ -127,7 +127,7 @@ namespace osu.Game.Collections
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Add the new collection and disable our placeholder. If all text is removed, the placeholder should not show back again.
|
// Add the new collection and disable our placeholder. If all text is removed, the placeholder should not show back again.
|
||||||
collectionManager.Collections.Add(collection);
|
collectionManager?.Collections.Add(collection);
|
||||||
textBox.PlaceholderText = string.Empty;
|
textBox.PlaceholderText = string.Empty;
|
||||||
|
|
||||||
// When this item changes from placeholder to non-placeholder (via changing containers), its textbox will lose focus, so it needs to be re-focused.
|
// When this item changes from placeholder to non-placeholder (via changing containers), its textbox will lose focus, so it needs to be re-focused.
|
||||||
@ -158,7 +158,7 @@ namespace osu.Game.Collections
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
private DialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
private readonly BeatmapCollection collection;
|
private readonly BeatmapCollection collection;
|
||||||
@ -231,7 +231,7 @@ namespace osu.Game.Collections
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteCollection() => collectionManager.Collections.Remove(collection);
|
private void deleteCollection() => collectionManager?.Collections.Remove(collection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -19,7 +20,7 @@ namespace osu.Game.Collections
|
|||||||
private const double enter_duration = 500;
|
private const double enter_duration = 500;
|
||||||
private const double exit_duration = 200;
|
private const double exit_duration = 200;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
public ManageCollectionsDialog()
|
public ManageCollectionsDialog()
|
||||||
@ -100,7 +101,7 @@ namespace osu.Game.Collections
|
|||||||
new DrawableCollectionList
|
new DrawableCollectionList
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Items = { BindTarget = collectionManager.Collections }
|
Items = { BindTarget = collectionManager?.Collections ?? new BindableList<BeatmapCollection>() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -538,9 +538,6 @@ namespace osu.Game
|
|||||||
ScoreManager.GetStableStorage = GetStorageForStableInstall;
|
ScoreManager.GetStableStorage = GetStorageForStableInstall;
|
||||||
ScoreManager.PresentImport = items => PresentScore(items.First());
|
ScoreManager.PresentImport = items => PresentScore(items.First());
|
||||||
|
|
||||||
CollectionManager.PostNotification = n => notifications.Post(n);
|
|
||||||
CollectionManager.GetStableStorage = GetStorageForStableInstall;
|
|
||||||
|
|
||||||
Container logoContainer;
|
Container logoContainer;
|
||||||
BackButton.Receptor receptor;
|
BackButton.Receptor receptor;
|
||||||
|
|
||||||
@ -614,6 +611,12 @@ namespace osu.Game
|
|||||||
d.Origin = Anchor.TopRight;
|
d.Origin = Anchor.TopRight;
|
||||||
}), rightFloatingOverlayContent.Add, true);
|
}), rightFloatingOverlayContent.Add, true);
|
||||||
|
|
||||||
|
loadComponentSingleFile(new CollectionManager(Storage)
|
||||||
|
{
|
||||||
|
PostNotification = n => notifications.Post(n),
|
||||||
|
GetStableStorage = GetStorageForStableInstall
|
||||||
|
}, Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(screenshotManager, Add);
|
loadComponentSingleFile(screenshotManager, Add);
|
||||||
|
|
||||||
// dependency on notification overlay, dependent by settings overlay
|
// dependency on notification overlay, dependent by settings overlay
|
||||||
|
@ -26,7 +26,6 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Collections;
|
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
@ -57,8 +56,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected BeatmapManager BeatmapManager;
|
protected BeatmapManager BeatmapManager;
|
||||||
|
|
||||||
protected CollectionManager CollectionManager;
|
|
||||||
|
|
||||||
protected ScoreManager ScoreManager;
|
protected ScoreManager ScoreManager;
|
||||||
|
|
||||||
protected SkinManager SkinManager;
|
protected SkinManager SkinManager;
|
||||||
@ -228,9 +225,6 @@ namespace osu.Game
|
|||||||
dependencies.Cache(difficultyManager);
|
dependencies.Cache(difficultyManager);
|
||||||
AddInternal(difficultyManager);
|
AddInternal(difficultyManager);
|
||||||
|
|
||||||
dependencies.Cache(CollectionManager = new CollectionManager(Storage));
|
|
||||||
AddInternal(CollectionManager);
|
|
||||||
|
|
||||||
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
||||||
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
||||||
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapDifficultyManager difficultyManager { get; set; }
|
private BeatmapDifficultyManager difficultyManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
@ -224,11 +224,14 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
if (beatmap.OnlineBeatmapID.HasValue && beatmapOverlay != null)
|
if (beatmap.OnlineBeatmapID.HasValue && beatmapOverlay != null)
|
||||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value)));
|
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value)));
|
||||||
|
|
||||||
var collectionItems = collectionManager.Collections.Select(createCollectionMenuItem).ToList();
|
if (collectionManager != null)
|
||||||
if (manageCollectionsDialog != null)
|
{
|
||||||
collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show));
|
var collectionItems = collectionManager.Collections.Select(createCollectionMenuItem).ToList();
|
||||||
|
if (manageCollectionsDialog != null)
|
||||||
|
collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show));
|
||||||
|
|
||||||
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
|
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
|
||||||
|
}
|
||||||
|
|
||||||
if (hideRequested != null)
|
if (hideRequested != null)
|
||||||
items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmap)));
|
items.Add(new OsuMenuItem("Hide", MenuItemType.Destructive, () => hideRequested(beatmap)));
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private DialogOverlay dialogOverlay { get; set; }
|
private DialogOverlay dialogOverlay { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
@ -142,11 +142,14 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
if (beatmapSet.OnlineBeatmapSetID != null && viewDetails != null)
|
if (beatmapSet.OnlineBeatmapSetID != null && viewDetails != null)
|
||||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails(beatmapSet.OnlineBeatmapSetID.Value)));
|
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails(beatmapSet.OnlineBeatmapSetID.Value)));
|
||||||
|
|
||||||
var collectionItems = collectionManager.Collections.Select(createCollectionMenuItem).ToList();
|
if (collectionManager != null)
|
||||||
if (manageCollectionsDialog != null)
|
{
|
||||||
collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show));
|
var collectionItems = collectionManager.Collections.Select(createCollectionMenuItem).ToList();
|
||||||
|
if (manageCollectionsDialog != null)
|
||||||
|
collectionItems.Add(new OsuMenuItem("Manage...", MenuItemType.Standard, manageCollectionsDialog.Show));
|
||||||
|
|
||||||
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
|
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
|
||||||
|
}
|
||||||
|
|
||||||
if (beatmapSet.Beatmaps.Any(b => b.Hidden))
|
if (beatmapSet.Beatmaps.Any(b => b.Hidden))
|
||||||
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested(beatmapSet)));
|
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested(beatmapSet)));
|
||||||
|
Loading…
Reference in New Issue
Block a user