mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Optimise how often we update the display
This commit is contained in:
@ -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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
@ -18,17 +17,20 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
internal partial class HitObjectInspector : CompositeDrawable
|
internal partial class HitObjectInspector : CompositeDrawable
|
||||||
{
|
{
|
||||||
private OsuTextFlowContainer inspectorText;
|
private OsuTextFlowContainer inspectorText = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected EditorBeatmap EditorBeatmap { get; private set; }
|
protected EditorBeatmap EditorBeatmap { get; private set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
InternalChild = inspectorText = new OsuTextFlowContainer
|
InternalChild = inspectorText = new OsuTextFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -36,10 +38,13 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.LoadComplete();
|
||||||
updateInspectorText();
|
|
||||||
|
EditorBeatmap.SelectedHitObjects.CollectionChanged += (_, _) => updateInspectorText();
|
||||||
|
EditorBeatmap.TransactionBegan += updateInspectorText;
|
||||||
|
EditorBeatmap.TransactionEnded += updateInspectorText;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateInspectorText()
|
private void updateInspectorText()
|
||||||
@ -49,7 +54,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
switch (EditorBeatmap.SelectedHitObjects.Count)
|
switch (EditorBeatmap.SelectedHitObjects.Count)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
addHeader("No selection");
|
addValue("No selection");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@ -115,6 +120,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EditorBeatmap.TransactionActive)
|
||||||
|
Scheduler.AddDelayed(updateInspectorText, 100);
|
||||||
|
|
||||||
void addHeader(string header) => inspectorText.AddParagraph($"{header}: ", s =>
|
void addHeader(string header) => inspectorText.AddParagraph($"{header}: ", s =>
|
||||||
{
|
{
|
||||||
s.Padding = new MarginPadding { Top = 2 };
|
s.Padding = new MarginPadding { Top = 2 };
|
||||||
|
Reference in New Issue
Block a user