1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Merge branch 'master' into move-setter-to-duration

This commit is contained in:
Dean Herbert 2020-05-29 16:04:23 +09:00
commit e8b43e8e1f
28 changed files with 142 additions and 86 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.525.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.528.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -19,8 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Tests namespace osu.Game.Rulesets.Mania.Tests
{ {
[Cached(Type = typeof(IManiaHitObjectComposer))] public abstract class ManiaPlacementBlueprintTestScene : PlacementBlueprintTestScene
public abstract class ManiaPlacementBlueprintTestScene : PlacementBlueprintTestScene, IManiaHitObjectComposer
{ {
private readonly Column column; private readonly Column column;

View File

@ -4,15 +4,13 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Rulesets.Mania.Edit;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Tests namespace osu.Game.Rulesets.Mania.Tests
{ {
[Cached(Type = typeof(IManiaHitObjectComposer))] public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene
public abstract class ManiaSelectionBlueprintTestScene : SelectionBlueprintTestScene, IManiaHitObjectComposer
{ {
[Cached(Type = typeof(IAdjustableClock))] [Cached(Type = typeof(IAdjustableClock))]
private readonly IAdjustableClock clock = new StopwatchClock(); private readonly IAdjustableClock clock = new StopwatchClock();

View File

@ -2,23 +2,27 @@
// 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 System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Mania.Edit;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Mania.Tests namespace osu.Game.Rulesets.Mania.Tests
{ {
[Cached(typeof(IManiaHitObjectComposer))] public class TestSceneManiaBeatSnapGrid : EditorClockTestScene
public class TestSceneManiaBeatSnapGrid : EditorClockTestScene, IManiaHitObjectComposer
{ {
[Cached(typeof(IScrollingInfo))] [Cached(typeof(IScrollingInfo))]
private ScrollingTestContainer.TestScrollingInfo scrollingInfo = new ScrollingTestContainer.TestScrollingInfo(); private ScrollingTestContainer.TestScrollingInfo scrollingInfo = new ScrollingTestContainer.TestScrollingInfo();
@ -50,7 +54,10 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
Clock = new FramedClock(new StopwatchClock()) Clock = new FramedClock(new StopwatchClock())
}, },
beatSnapGrid = new ManiaBeatSnapGrid() new TestHitObjectComposer(Playfield)
{
Child = beatSnapGrid = new ManiaBeatSnapGrid()
}
}; };
} }
@ -67,4 +74,51 @@ namespace osu.Game.Rulesets.Mania.Tests
public ManiaPlayfield Playfield { get; } public ManiaPlayfield Playfield { get; }
} }
public class TestHitObjectComposer : HitObjectComposer
{
public override Playfield Playfield { get; }
public override IEnumerable<DrawableHitObject> HitObjects => Enumerable.Empty<DrawableHitObject>();
public override bool CursorInPlacementArea => false;
public TestHitObjectComposer(Playfield playfield)
{
Playfield = playfield;
}
public Drawable Child
{
set => InternalChild = value;
}
public override SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition)
{
throw new System.NotImplementedException();
}
public override float GetBeatSnapDistanceAt(double referenceTime)
{
throw new System.NotImplementedException();
}
public override float DurationToDistance(double referenceTime, double duration)
{
throw new System.NotImplementedException();
}
public override double DistanceToDuration(double referenceTime, float distance)
{
throw new System.NotImplementedException();
}
public override double GetSnappedDurationFromDistance(double referenceTime, float distance)
{
throw new System.NotImplementedException();
}
public override float GetSnappedDistanceFromDistance(double referenceTime, float distance)
{
throw new System.NotImplementedException();
}
}
} }

View File

@ -20,9 +20,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
private readonly EditNotePiece headPiece; private readonly EditNotePiece headPiece;
private readonly EditNotePiece tailPiece; private readonly EditNotePiece tailPiece;
[Resolved]
private IManiaHitObjectComposer composer { get; set; }
[Resolved] [Resolved]
private IScrollingInfo scrollingInfo { get; set; } private IScrollingInfo scrollingInfo { get; set; }

View File

@ -18,9 +18,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
[Resolved] [Resolved]
private IScrollingInfo scrollingInfo { get; set; } private IScrollingInfo scrollingInfo { get; set; }
[Resolved]
private IManiaHitObjectComposer composer { get; set; }
protected ManiaSelectionBlueprint(DrawableHitObject drawableObject) protected ManiaSelectionBlueprint(DrawableHitObject drawableObject)
: base(drawableObject) : base(drawableObject)
{ {

View File

@ -1,12 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Edit
{
public interface IManiaHitObjectComposer
{
ManiaPlayfield Playfield { get; }
}
}

View File

@ -11,6 +11,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -63,9 +65,9 @@ namespace osu.Game.Rulesets.Mania.Edit
private (double start, double end)? selectionTimeRange; private (double start, double end)? selectionTimeRange;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IManiaHitObjectComposer composer) private void load(HitObjectComposer composer)
{ {
foreach (var stage in composer.Playfield.Stages) foreach (var stage in ((ManiaPlayfield)composer.Playfield).Stages)
{ {
foreach (var column in stage.Columns) foreach (var column in stage.Columns)
{ {

View File

@ -20,8 +20,7 @@ using osuTK;
namespace osu.Game.Rulesets.Mania.Edit namespace osu.Game.Rulesets.Mania.Edit
{ {
[Cached(Type = typeof(IManiaHitObjectComposer))] public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
{ {
private DrawableManiaEditRuleset drawableRuleset; private DrawableManiaEditRuleset drawableRuleset;
private ManiaBeatSnapGrid beatSnapGrid; private ManiaBeatSnapGrid beatSnapGrid;
@ -50,7 +49,7 @@ namespace osu.Game.Rulesets.Mania.Edit
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
public ManiaPlayfield Playfield => ((ManiaPlayfield)drawableRuleset.Playfield); public new ManiaPlayfield Playfield => ((ManiaPlayfield)drawableRuleset.Playfield);
public IScrollingInfo ScrollingInfo => drawableRuleset.ScrollingInfo; public IScrollingInfo ScrollingInfo => drawableRuleset.ScrollingInfo;

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Edit.Blueprints; using osu.Game.Rulesets.Mania.Edit.Blueprints;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
@ -17,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Edit
private IScrollingInfo scrollingInfo { get; set; } private IScrollingInfo scrollingInfo { get; set; }
[Resolved] [Resolved]
private IManiaHitObjectComposer composer { get; set; } private HitObjectComposer composer { get; set; }
public override bool HandleMovement(MoveSelectionEvent moveEvent) public override bool HandleMovement(MoveSelectionEvent moveEvent)
{ {
@ -31,7 +32,9 @@ namespace osu.Game.Rulesets.Mania.Edit
private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent) private void performColumnMovement(int lastColumn, MoveSelectionEvent moveEvent)
{ {
var currentColumn = composer.Playfield.GetColumnByPosition(moveEvent.ScreenSpacePosition); var maniaPlayfield = ((ManiaHitObjectComposer)composer).Playfield;
var currentColumn = maniaPlayfield.GetColumnByPosition(moveEvent.ScreenSpacePosition);
if (currentColumn == null) if (currentColumn == null)
return; return;
@ -50,7 +53,7 @@ namespace osu.Game.Rulesets.Mania.Edit
maxColumn = obj.Column; maxColumn = obj.Column;
} }
columnDelta = Math.Clamp(columnDelta, -minColumn, composer.Playfield.TotalColumns - 1 - maxColumn); columnDelta = Math.Clamp(columnDelta, -minColumn, maniaPlayfield.TotalColumns - 1 - maxColumn);
foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>()) foreach (var obj in SelectedHitObjects.OfType<ManiaHitObject>())
obj.Column += columnDelta; obj.Column += columnDelta;

View File

@ -12,6 +12,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{ {
protected new T HitObject => (T)DrawableObject.HitObject; protected new T HitObject => (T)DrawableObject.HitObject;
protected override bool AlwaysShowWhenSelected => true;
protected OsuSelectionBlueprint(DrawableHitObject drawableObject) protected OsuSelectionBlueprint(DrawableHitObject drawableObject)
: base(drawableObject) : base(drawableObject)
{ {

View File

@ -156,7 +156,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var manager = osu.Dependencies.Get<BeatmapManager>(); var manager = osu.Dependencies.Get<BeatmapManager>();
// ReSharper disable once AccessToModifiedClosure // ReSharper disable once AccessToModifiedClosure
manager.ItemAdded.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount)); manager.ItemUpdated.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
manager.ItemRemoved.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount)); manager.ItemRemoved.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
var imported = await LoadOszIntoOsu(osu); var imported = await LoadOszIntoOsu(osu);
@ -166,7 +166,7 @@ namespace osu.Game.Tests.Beatmaps.IO
imported.Hash += "-changed"; imported.Hash += "-changed";
manager.Update(imported); manager.Update(imported);
Assert.AreEqual(0, itemAddRemoveFireCount -= 2); Assert.AreEqual(0, itemAddRemoveFireCount -= 1);
checkBeatmapSetCount(osu, 1); checkBeatmapSetCount(osu, 1);
checkBeatmapCount(osu, 12); checkBeatmapCount(osu, 12);

View File

@ -55,12 +55,12 @@ namespace osu.Game.Database
public Action<Notification> PostNotification { protected get; set; } public Action<Notification> PostNotification { protected get; set; }
/// <summary> /// <summary>
/// Fired when a new <typeparamref name="TModel"/> becomes available in the database. /// Fired when a new or updated <typeparamref name="TModel"/> becomes available in the database.
/// This is not guaranteed to run on the update thread. /// This is not guaranteed to run on the update thread.
/// </summary> /// </summary>
public IBindable<WeakReference<TModel>> ItemAdded => itemAdded; public IBindable<WeakReference<TModel>> ItemUpdated => itemUpdated;
private readonly Bindable<WeakReference<TModel>> itemAdded = new Bindable<WeakReference<TModel>>(); private readonly Bindable<WeakReference<TModel>> itemUpdated = new Bindable<WeakReference<TModel>>();
/// <summary> /// <summary>
/// Fired when a <typeparamref name="TModel"/> is removed from the database. /// Fired when a <typeparamref name="TModel"/> is removed from the database.
@ -90,7 +90,7 @@ namespace osu.Game.Database
ContextFactory = contextFactory; ContextFactory = contextFactory;
ModelStore = modelStore; ModelStore = modelStore;
ModelStore.ItemAdded += item => handleEvent(() => itemAdded.Value = new WeakReference<TModel>(item)); ModelStore.ItemUpdated += item => handleEvent(() => itemUpdated.Value = new WeakReference<TModel>(item));
ModelStore.ItemRemoved += item => handleEvent(() => itemRemoved.Value = new WeakReference<TModel>(item)); ModelStore.ItemRemoved += item => handleEvent(() => itemRemoved.Value = new WeakReference<TModel>(item));
exportStorage = storage.GetStorageForDirectory("exports"); exportStorage = storage.GetStorageForDirectory("exports");

View File

@ -13,7 +13,7 @@ namespace osu.Game.Database
public interface IModelManager<TModel> public interface IModelManager<TModel>
where TModel : class where TModel : class
{ {
IBindable<WeakReference<TModel>> ItemAdded { get; } IBindable<WeakReference<TModel>> ItemUpdated { get; }
IBindable<WeakReference<TModel>> ItemRemoved { get; } IBindable<WeakReference<TModel>> ItemRemoved { get; }
} }

View File

@ -16,7 +16,14 @@ namespace osu.Game.Database
public abstract class MutableDatabaseBackedStore<T> : DatabaseBackedStore public abstract class MutableDatabaseBackedStore<T> : DatabaseBackedStore
where T : class, IHasPrimaryKey, ISoftDelete where T : class, IHasPrimaryKey, ISoftDelete
{ {
public event Action<T> ItemAdded; /// <summary>
/// Fired when an item was added or updated.
/// </summary>
public event Action<T> ItemUpdated;
/// <summary>
/// Fired when an item was removed.
/// </summary>
public event Action<T> ItemRemoved; public event Action<T> ItemRemoved;
protected MutableDatabaseBackedStore(IDatabaseContextFactory contextFactory, Storage storage = null) protected MutableDatabaseBackedStore(IDatabaseContextFactory contextFactory, Storage storage = null)
@ -41,7 +48,7 @@ namespace osu.Game.Database
context.Attach(item); context.Attach(item);
} }
ItemAdded?.Invoke(item); ItemUpdated?.Invoke(item);
} }
/// <summary> /// <summary>
@ -53,8 +60,7 @@ namespace osu.Game.Database
using (var usage = ContextFactory.GetForWrite()) using (var usage = ContextFactory.GetForWrite())
usage.Context.Update(item); usage.Context.Update(item);
ItemRemoved?.Invoke(item); ItemUpdated?.Invoke(item);
ItemAdded?.Invoke(item);
} }
/// <summary> /// <summary>
@ -91,7 +97,7 @@ namespace osu.Game.Database
item.DeletePending = false; item.DeletePending = false;
} }
ItemAdded?.Invoke(item); ItemUpdated?.Invoke(item);
return true; return true;
} }

View File

@ -34,7 +34,7 @@ namespace osu.Game.Online
Model.Value = model; Model.Value = model;
} }
private IBindable<WeakReference<TModel>> managerAdded; private IBindable<WeakReference<TModel>> managedUpdated;
private IBindable<WeakReference<TModel>> managerRemoved; private IBindable<WeakReference<TModel>> managerRemoved;
private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadBegan; private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadBegan;
private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadFailed; private IBindable<WeakReference<ArchiveDownloadRequest<TModel>>> managerDownloadFailed;
@ -56,8 +56,8 @@ namespace osu.Game.Online
managerDownloadBegan.BindValueChanged(downloadBegan); managerDownloadBegan.BindValueChanged(downloadBegan);
managerDownloadFailed = manager.DownloadFailed.GetBoundCopy(); managerDownloadFailed = manager.DownloadFailed.GetBoundCopy();
managerDownloadFailed.BindValueChanged(downloadFailed); managerDownloadFailed.BindValueChanged(downloadFailed);
managerAdded = manager.ItemAdded.GetBoundCopy(); managedUpdated = manager.ItemUpdated.GetBoundCopy();
managerAdded.BindValueChanged(itemAdded); managedUpdated.BindValueChanged(itemUpdated);
managerRemoved = manager.ItemRemoved.GetBoundCopy(); managerRemoved = manager.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(itemRemoved); managerRemoved.BindValueChanged(itemRemoved);
} }
@ -128,7 +128,7 @@ namespace osu.Game.Online
private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null)); private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null));
private void itemAdded(ValueChangedEvent<WeakReference<TModel>> weakItem) private void itemUpdated(ValueChangedEvent<WeakReference<TModel>> weakItem)
{ {
if (weakItem.NewValue.TryGetTarget(out var item)) if (weakItem.NewValue.TryGetTarget(out var item))
setDownloadStateFromManager(item, DownloadState.LocallyAvailable); setDownloadStateFromManager(item, DownloadState.LocallyAvailable);

View File

@ -192,7 +192,7 @@ namespace osu.Game
ScoreManager.Delete(getBeatmapScores(item), true); ScoreManager.Delete(getBeatmapScores(item), true);
}); });
BeatmapManager.ItemAdded.BindValueChanged(i => BeatmapManager.ItemUpdated.BindValueChanged(i =>
{ {
if (i.NewValue.TryGetTarget(out var item)) if (i.NewValue.TryGetTarget(out var item))
ScoreManager.Undelete(getBeatmapScores(item), true); ScoreManager.Undelete(getBeatmapScores(item), true);
@ -229,8 +229,8 @@ namespace osu.Game
FileStore.Cleanup(); FileStore.Cleanup();
if (API is APIAccess apiAcces) if (API is APIAccess apiAccess)
AddInternal(apiAcces); AddInternal(apiAccess);
AddInternal(RulesetConfigCache); AddInternal(RulesetConfigCache);
GlobalActionContainer globalBinding; GlobalActionContainer globalBinding;

View File

@ -60,14 +60,14 @@ namespace osu.Game.Overlays
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private OnScreenDisplay onScreenDisplay { get; set; } private OnScreenDisplay onScreenDisplay { get; set; }
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded; private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved; private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
managerAdded = beatmaps.ItemAdded.GetBoundCopy(); managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
managerAdded.BindValueChanged(beatmapAdded); managerUpdated.BindValueChanged(beatmapUpdated);
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy(); managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(beatmapRemoved); managerRemoved.BindValueChanged(beatmapRemoved);
@ -98,14 +98,14 @@ namespace osu.Game.Overlays
/// </summary> /// </summary>
public bool IsPlaying => current?.Track.IsRunning ?? false; public bool IsPlaying => current?.Track.IsRunning ?? false;
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet) private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
{ {
if (weakSet.NewValue.TryGetTarget(out var set)) if (weakSet.NewValue.TryGetTarget(out var set))
{ {
Schedule(() => Schedule(() =>
{ {
if (!beatmapSets.Contains(set)) beatmapSets.Remove(set);
beatmapSets.Add(set); beatmapSets.Add(set);
}); });
} }
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections
[Resolved] [Resolved]
private SkinManager skins { get; set; } private SkinManager skins { get; set; }
private IBindable<WeakReference<SkinInfo>> managerAdded; private IBindable<WeakReference<SkinInfo>> managerUpdated;
private IBindable<WeakReference<SkinInfo>> managerRemoved; private IBindable<WeakReference<SkinInfo>> managerRemoved;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -73,8 +73,8 @@ namespace osu.Game.Overlays.Settings.Sections
}, },
}; };
managerAdded = skins.ItemAdded.GetBoundCopy(); managerUpdated = skins.ItemUpdated.GetBoundCopy();
managerAdded.BindValueChanged(itemAdded); managerUpdated.BindValueChanged(itemUpdated);
managerRemoved = skins.ItemRemoved.GetBoundCopy(); managerRemoved = skins.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(itemRemoved); managerRemoved.BindValueChanged(itemRemoved);
@ -92,10 +92,10 @@ namespace osu.Game.Overlays.Settings.Sections
dropdownBindable.BindValueChanged(skin => configBindable.Value = skin.NewValue.ID); dropdownBindable.BindValueChanged(skin => configBindable.Value = skin.NewValue.ID);
} }
private void itemAdded(ValueChangedEvent<WeakReference<SkinInfo>> weakItem) private void itemUpdated(ValueChangedEvent<WeakReference<SkinInfo>> weakItem)
{ {
if (weakItem.NewValue.TryGetTarget(out var item)) if (weakItem.NewValue.TryGetTarget(out var item))
Schedule(() => skinDropdown.Items = skinDropdown.Items.Append(item).ToArray()); Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => !i.Equals(item)).Append(item).ToArray());
} }
private void itemRemoved(ValueChangedEvent<WeakReference<SkinInfo>> weakItem) private void itemRemoved(ValueChangedEvent<WeakReference<SkinInfo>> weakItem)

View File

@ -48,6 +48,8 @@ namespace osu.Game.Rulesets.Edit
protected ComposeBlueprintContainer BlueprintContainer { get; private set; } protected ComposeBlueprintContainer BlueprintContainer { get; private set; }
public override Playfield Playfield => drawableRulesetWrapper.Playfield;
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper; private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
protected readonly Container LayerBelowRuleset = new Container { RelativeSizeAxes = Axes.Both }; protected readonly Container LayerBelowRuleset = new Container { RelativeSizeAxes = Axes.Both };
@ -102,6 +104,7 @@ namespace osu.Game.Rulesets.Edit
{ {
Name = "Content", Name = "Content",
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
// layers below playfield // layers below playfield
@ -260,11 +263,13 @@ namespace osu.Game.Rulesets.Edit
[Cached(typeof(IPositionSnapProvider))] [Cached(typeof(IPositionSnapProvider))]
public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider public abstract class HitObjectComposer : CompositeDrawable, IPositionSnapProvider
{ {
internal HitObjectComposer() protected HitObjectComposer()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
public abstract Playfield Playfield { get; }
/// <summary> /// <summary>
/// All the <see cref="DrawableHitObject"/>s. /// All the <see cref="DrawableHitObject"/>s.
/// </summary> /// </summary>

View File

@ -15,7 +15,12 @@ namespace osu.Game.Rulesets.Edit
/// </summary> /// </summary>
public readonly DrawableHitObject DrawableObject; public readonly DrawableHitObject DrawableObject;
protected override bool ShouldBeAlive => (DrawableObject.IsAlive && DrawableObject.IsPresent) || State == SelectionState.Selected; /// <summary>
/// Whether the blueprint should be shown even when the <see cref="DrawableObject"/> is not alive.
/// </summary>
protected virtual bool AlwaysShowWhenSelected => false;
protected override bool ShouldBeAlive => (DrawableObject.IsAlive && DrawableObject.IsPresent) || (AlwaysShowWhenSelected && State == SelectionState.Selected);
protected OverlaySelectionBlueprint(DrawableHitObject drawableObject) protected OverlaySelectionBlueprint(DrawableHitObject drawableObject)
: base(drawableObject.HitObject) : base(drawableObject.HitObject)

View File

@ -44,6 +44,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
private readonly BindableList<HitObject> selectedHitObjects = new BindableList<HitObject>(); private readonly BindableList<HitObject> selectedHitObjects = new BindableList<HitObject>();
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private IPositionSnapProvider snapProvider { get; set; } private IPositionSnapProvider snapProvider { get; set; }

View File

@ -32,14 +32,14 @@ namespace osu.Game.Screens.Multi.Match.Components
Text = "Start"; Text = "Start";
} }
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded; private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved; private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
managerAdded = beatmaps.ItemAdded.GetBoundCopy(); managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
managerAdded.BindValueChanged(beatmapAdded); managerUpdated.BindValueChanged(beatmapUpdated);
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy(); managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(beatmapRemoved); managerRemoved.BindValueChanged(beatmapRemoved);
@ -61,7 +61,7 @@ namespace osu.Game.Screens.Multi.Match.Components
hasBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId) != null; hasBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId) != null;
} }
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet) private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
{ {
if (weakSet.NewValue.TryGetTarget(out var set)) if (weakSet.NewValue.TryGetTarget(out var set))
{ {

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Multi.Match
private LeaderboardChatDisplay leaderboardChatDisplay; private LeaderboardChatDisplay leaderboardChatDisplay;
private MatchSettingsOverlay settingsOverlay; private MatchSettingsOverlay settingsOverlay;
private IBindable<WeakReference<BeatmapSetInfo>> managerAdded; private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
public MatchSubScreen(Room room) public MatchSubScreen(Room room)
{ {
@ -183,8 +183,8 @@ namespace osu.Game.Screens.Multi.Match
SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged)); SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged));
SelectedItem.Value = playlist.FirstOrDefault(); SelectedItem.Value = playlist.FirstOrDefault();
managerAdded = beatmapManager.ItemAdded.GetBoundCopy(); managerUpdated = beatmapManager.ItemUpdated.GetBoundCopy();
managerAdded.BindValueChanged(beatmapAdded); managerUpdated.BindValueChanged(beatmapUpdated);
} }
public override bool OnExiting(IScreen next) public override bool OnExiting(IScreen next)
@ -217,7 +217,7 @@ namespace osu.Game.Screens.Multi.Match
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap); Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
} }
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet) private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
{ {
Schedule(() => Schedule(() =>
{ {

View File

@ -131,7 +131,7 @@ namespace osu.Game.Screens.Select
private CarouselRoot root; private CarouselRoot root;
private IBindable<WeakReference<BeatmapSetInfo>> itemAdded; private IBindable<WeakReference<BeatmapSetInfo>> itemUpdated;
private IBindable<WeakReference<BeatmapSetInfo>> itemRemoved; private IBindable<WeakReference<BeatmapSetInfo>> itemRemoved;
private IBindable<WeakReference<BeatmapInfo>> itemHidden; private IBindable<WeakReference<BeatmapInfo>> itemHidden;
private IBindable<WeakReference<BeatmapInfo>> itemRestored; private IBindable<WeakReference<BeatmapInfo>> itemRestored;
@ -166,8 +166,8 @@ namespace osu.Game.Screens.Select
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue; RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.TriggerChange(); RightClickScrollingEnabled.TriggerChange();
itemAdded = beatmaps.ItemAdded.GetBoundCopy(); itemUpdated = beatmaps.ItemUpdated.GetBoundCopy();
itemAdded.BindValueChanged(beatmapAdded); itemUpdated.BindValueChanged(beatmapUpdated);
itemRemoved = beatmaps.ItemRemoved.GetBoundCopy(); itemRemoved = beatmaps.ItemRemoved.GetBoundCopy();
itemRemoved.BindValueChanged(beatmapRemoved); itemRemoved.BindValueChanged(beatmapRemoved);
itemHidden = beatmaps.BeatmapHidden.GetBoundCopy(); itemHidden = beatmaps.BeatmapHidden.GetBoundCopy();
@ -582,7 +582,7 @@ namespace osu.Game.Screens.Select
RemoveBeatmapSet(item); RemoveBeatmapSet(item);
} }
private void beatmapAdded(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakItem) private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakItem)
{ {
if (weakItem.NewValue.TryGetTarget(out var item)) if (weakItem.NewValue.TryGetTarget(out var item))
UpdateBeatmapSet(item); UpdateBeatmapSet(item);

View File

@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select.Carousel
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
private IBindable<WeakReference<ScoreInfo>> itemAdded; private IBindable<WeakReference<ScoreInfo>> itemUpdated;
private IBindable<WeakReference<ScoreInfo>> itemRemoved; private IBindable<WeakReference<ScoreInfo>> itemRemoved;
public TopLocalRank(BeatmapInfo beatmap) public TopLocalRank(BeatmapInfo beatmap)
@ -40,8 +40,8 @@ namespace osu.Game.Screens.Select.Carousel
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
itemAdded = scores.ItemAdded.GetBoundCopy(); itemUpdated = scores.ItemUpdated.GetBoundCopy();
itemAdded.BindValueChanged(scoreChanged); itemUpdated.BindValueChanged(scoreChanged);
itemRemoved = scores.ItemRemoved.GetBoundCopy(); itemRemoved = scores.ItemRemoved.GetBoundCopy();
itemRemoved.BindValueChanged(scoreChanged); itemRemoved.BindValueChanged(scoreChanged);

View File

@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.525.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.528.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" />
<PackageReference Include="Sentry" Version="2.1.1" /> <PackageReference Include="Sentry" Version="2.1.1" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.25.1" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.525.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.528.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.512.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.525.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.528.0" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.25.1" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />