1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Merge branch 'master' into shift-delete-all-selected

This commit is contained in:
Dean Herbert 2020-11-01 23:03:01 +09:00 committed by GitHub
commit 1f8d627af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 30 deletions

View File

@ -149,18 +149,14 @@ namespace osu.Game.Tests.Visual.Background
=> AddStep($"set seasonal mode to {mode}", () => config.Set(OsuSetting.SeasonalBackgroundMode, mode));
private void createLoader()
{
AddStep("create loader", () =>
=> AddStep("create loader", () =>
{
if (backgroundLoader != null)
Remove(backgroundLoader);
LoadComponentAsync(backgroundLoader = new SeasonalBackgroundLoader(), Add);
Add(backgroundLoader = new SeasonalBackgroundLoader());
});
AddUntilStep("wait for loaded", () => backgroundLoader.IsLoaded);
}
private void loadNextBackground()
{
SeasonalBackground background = null;

View File

@ -15,7 +15,6 @@ using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Graphics.Backgrounds
{
[LongRunningLoad]
public class SeasonalBackgroundLoader : Component
{
/// <summary>

View File

@ -44,6 +44,8 @@ namespace osu.Game.Screens.Backgrounds
mode = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource);
introSequence = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence);
AddInternal(seasonalBackgroundLoader);
user.ValueChanged += _ => Next();
skin.ValueChanged += _ => Next();
mode.ValueChanged += _ => Next();
@ -53,7 +55,6 @@ namespace osu.Game.Screens.Backgrounds
currentDisplay = RNG.Next(0, background_count);
LoadComponentAsync(seasonalBackgroundLoader);
Next();
}

View File

@ -210,10 +210,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
}
if (DragBox.State == Visibility.Visible)
{
DragBox.Hide();
SelectionHandler.UpdateVisibility();
}
}
protected override bool OnKeyDown(KeyDownEvent e)
@ -352,11 +349,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// Selects all <see cref="SelectionBlueprint"/>s.
/// </summary>
private void selectAll()
{
SelectionBlueprints.ToList().ForEach(m => m.Select());
SelectionHandler.UpdateVisibility();
}
private void selectAll() => SelectionBlueprints.ToList().ForEach(m => m.Select());
/// <summary>
/// Deselects all selected <see cref="SelectionBlueprint"/>s.

View File

@ -201,8 +201,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
// there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
UpdateVisibility();
}
/// <summary>
@ -214,8 +212,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
selectedBlueprints.Remove(blueprint);
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
UpdateVisibility();
}
/// <summary>
@ -262,23 +258,18 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// Updates whether this <see cref="SelectionHandler"/> is visible.
/// </summary>
internal void UpdateVisibility()
private void updateVisibility()
{
int count = selectedBlueprints.Count;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;
if (count > 0)
{
Show();
OnSelectionChanged();
}
else
Hide();
this.FadeTo(count > 0 ? 1 : 0);
OnSelectionChanged();
}
/// <summary>
/// Triggered whenever more than one object is selected, on each change.
/// Triggered whenever the set of selected objects changes.
/// Should update the selection box's state to match supported operations.
/// </summary>
protected virtual void OnSelectionChanged()
@ -429,7 +420,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
// bring in updates from selection changes
EditorBeatmap.HitObjectUpdated += _ => UpdateTernaryStates();
EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) => UpdateTernaryStates();
EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) =>
{
Scheduler.AddOnce(updateVisibility);
UpdateTernaryStates();
};
}
/// <summary>