mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Disable beatmap card expansion on solo spectator screen
This commit is contained in:
parent
af10223ac4
commit
af35652b8b
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -253,7 +254,13 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
createTestCase(beatmapSetInfo => new BeatmapCard(beatmapSetInfo));
|
||||
|
||||
AddToggleStep("toggle expanded state", expanded => this.ChildrenOfType<BeatmapCard>().Last().Expanded.Value = expanded);
|
||||
AddToggleStep("toggle expanded state", expanded =>
|
||||
{
|
||||
var card = this.ChildrenOfType<BeatmapCard>().Last();
|
||||
if (!card.Expanded.Disabled)
|
||||
card.Expanded.Value = expanded;
|
||||
});
|
||||
AddToggleStep("disable/enable expansion", disabled => this.ChildrenOfType<BeatmapCard>().ForEach(card => card.Expanded.Disabled = disabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,23 +109,34 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
public void ScheduleShow()
|
||||
{
|
||||
scheduledExpandedChange?.Cancel();
|
||||
if (Expanded.Value)
|
||||
if (Expanded.Disabled || Expanded.Value)
|
||||
return;
|
||||
|
||||
scheduledExpandedChange = Scheduler.AddDelayed(() => Expanded.Value = true, 100);
|
||||
scheduledExpandedChange = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
if (!Expanded.Disabled)
|
||||
Expanded.Value = true;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
public void ScheduleHide()
|
||||
{
|
||||
scheduledExpandedChange?.Cancel();
|
||||
if (!Expanded.Value)
|
||||
if (Expanded.Disabled || !Expanded.Value)
|
||||
return;
|
||||
|
||||
scheduledExpandedChange = Scheduler.AddDelayed(() => Expanded.Value = false, 500);
|
||||
scheduledExpandedChange = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
if (!Expanded.Disabled)
|
||||
Expanded.Value = false;
|
||||
}, 500);
|
||||
}
|
||||
|
||||
private void checkForHide()
|
||||
{
|
||||
if (Expanded.Disabled)
|
||||
return;
|
||||
|
||||
if (content.IsHovered || dropdownContent.IsHovered)
|
||||
return;
|
||||
|
||||
@ -135,6 +146,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
|
||||
private void keep()
|
||||
{
|
||||
if (Expanded.Disabled)
|
||||
return;
|
||||
|
||||
scheduledExpandedChange?.Cancel();
|
||||
Expanded.Value = true;
|
||||
}
|
||||
|
@ -228,7 +228,10 @@ namespace osu.Game.Screens.Play
|
||||
onlineBeatmapRequest.Success += beatmapSet => Schedule(() =>
|
||||
{
|
||||
this.beatmapSet = beatmapSet;
|
||||
beatmapPanelContainer.Child = new BeatmapCard(this.beatmapSet);
|
||||
beatmapPanelContainer.Child = new BeatmapCard(this.beatmapSet)
|
||||
{
|
||||
Expanded = { Disabled = true }
|
||||
};
|
||||
checkForAutomaticDownload();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user