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)); => AddStep($"set seasonal mode to {mode}", () => config.Set(OsuSetting.SeasonalBackgroundMode, mode));
private void createLoader() private void createLoader()
{ => AddStep("create loader", () =>
AddStep("create loader", () =>
{ {
if (backgroundLoader != null) if (backgroundLoader != null)
Remove(backgroundLoader); Remove(backgroundLoader);
LoadComponentAsync(backgroundLoader = new SeasonalBackgroundLoader(), Add); Add(backgroundLoader = new SeasonalBackgroundLoader());
}); });
AddUntilStep("wait for loaded", () => backgroundLoader.IsLoaded);
}
private void loadNextBackground() private void loadNextBackground()
{ {
SeasonalBackground background = null; SeasonalBackground background = null;

View File

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

View File

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

View File

@ -210,10 +210,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
} }
if (DragBox.State == Visibility.Visible) if (DragBox.State == Visibility.Visible)
{
DragBox.Hide(); DragBox.Hide();
SelectionHandler.UpdateVisibility();
}
} }
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)
@ -352,11 +349,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary> /// <summary>
/// Selects all <see cref="SelectionBlueprint"/>s. /// Selects all <see cref="SelectionBlueprint"/>s.
/// </summary> /// </summary>
private void selectAll() private void selectAll() => SelectionBlueprints.ToList().ForEach(m => m.Select());
{
SelectionBlueprints.ToList().ForEach(m => m.Select());
SelectionHandler.UpdateVisibility();
}
/// <summary> /// <summary>
/// Deselects all selected <see cref="SelectionBlueprint"/>s. /// 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. // there are potentially multiple SelectionHandlers active, but we only want to add hitobjects to the selected list once.
if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject)) if (!EditorBeatmap.SelectedHitObjects.Contains(blueprint.HitObject))
EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject); EditorBeatmap.SelectedHitObjects.Add(blueprint.HitObject);
UpdateVisibility();
} }
/// <summary> /// <summary>
@ -214,8 +212,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
selectedBlueprints.Remove(blueprint); selectedBlueprints.Remove(blueprint);
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject); EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
UpdateVisibility();
} }
/// <summary> /// <summary>
@ -262,23 +258,18 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary> /// <summary>
/// Updates whether this <see cref="SelectionHandler"/> is visible. /// Updates whether this <see cref="SelectionHandler"/> is visible.
/// </summary> /// </summary>
internal void UpdateVisibility() private void updateVisibility()
{ {
int count = selectedBlueprints.Count; int count = selectedBlueprints.Count;
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty; selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;
if (count > 0) this.FadeTo(count > 0 ? 1 : 0);
{ OnSelectionChanged();
Show();
OnSelectionChanged();
}
else
Hide();
} }
/// <summary> /// <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. /// Should update the selection box's state to match supported operations.
/// </summary> /// </summary>
protected virtual void OnSelectionChanged() protected virtual void OnSelectionChanged()
@ -429,7 +420,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
// bring in updates from selection changes // bring in updates from selection changes
EditorBeatmap.HitObjectUpdated += _ => UpdateTernaryStates(); EditorBeatmap.HitObjectUpdated += _ => UpdateTernaryStates();
EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) => UpdateTernaryStates(); EditorBeatmap.SelectedHitObjects.CollectionChanged += (sender, args) =>
{
Scheduler.AddOnce(updateVisibility);
UpdateTernaryStates();
};
} }
/// <summary> /// <summary>