mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Reduce memory allocations in MenuCursorContainer
This commit is contained in:
parent
fb5a54d242
commit
72ace508b6
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -55,7 +54,15 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newTarget = inputManager.HoveredDrawables.OfType<IProvideCursor>().FirstOrDefault(t => t.ProvidingUserCursor) ?? this;
|
IProvideCursor newTarget = this;
|
||||||
|
|
||||||
|
foreach (var d in inputManager.HoveredDrawables)
|
||||||
|
{
|
||||||
|
if (!(d is IProvideCursor p) || !p.ProvidingUserCursor) continue;
|
||||||
|
|
||||||
|
newTarget = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentTarget == newTarget)
|
if (currentTarget == newTarget)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user