mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into fix-transform-mutation-mod-selection
This commit is contained in:
@ -34,6 +34,12 @@ namespace osu.Game.Screens
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply arbitrary changes to this background in a thread safe manner.
|
||||
/// </summary>
|
||||
/// <param name="action">The operation to perform.</param>
|
||||
public void ApplyToBackground(Action<BackgroundScreen> action) => Schedule(() => action.Invoke(this));
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
@ -444,11 +444,14 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
|
||||
Background.FadeColour(Color4.DarkGray, 500);
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
|
||||
b.FadeColour(Color4.DarkGray, 500);
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.BlurAmount.Value = 0;
|
||||
b.EnableUserDim.Value = false;
|
||||
b.BlurAmount.Value = 0;
|
||||
});
|
||||
|
||||
resetTrack(true);
|
||||
}
|
||||
@ -480,7 +483,7 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
}
|
||||
|
||||
Background.FadeColour(Color4.White, 500);
|
||||
ApplyToBackground(b => b.FadeColour(Color4.White, 500));
|
||||
resetTrack();
|
||||
|
||||
return base.OnExiting(next);
|
||||
|
@ -129,8 +129,8 @@ namespace osu.Game.Screens.Menu
|
||||
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
|
||||
|
||||
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", OsuIcon.Logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
|
||||
buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", OsuIcon.EditCircle, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
|
||||
buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", OsuIcon.ChevronDownCircle, new Color4(165, 204, 0, 255), () => OnBeatmapListing?.Invoke(), 0, Key.D));
|
||||
buttonsTopLevel.Add(new Button(@"edit", @"button-generic-select", OsuIcon.EditCircle, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
|
||||
buttonsTopLevel.Add(new Button(@"browse", @"button-direct-select", OsuIcon.ChevronDownCircle, new Color4(165, 204, 0, 255), () => OnBeatmapListing?.Invoke(), 0, Key.D));
|
||||
|
||||
if (host.CanExit)
|
||||
buttonsTopLevel.Add(new Button(@"exit", string.Empty, OsuIcon.CrossCircle, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q));
|
||||
|
@ -201,7 +201,7 @@ namespace osu.Game.Screens.Menu
|
||||
"New features are coming online every update. Make sure to stay up-to-date!",
|
||||
"If you find the UI too large or small, try adjusting UI scale in settings!",
|
||||
"Try adjusting the \"Screen Scaling\" mode to change your gameplay or UI area, even in fullscreen!",
|
||||
"For now, osu!direct is available to all users on lazer. You can access it anywhere using Ctrl-D!",
|
||||
"For now, what used to be \"osu!direct\" is available to all users on lazer. You can access it anywhere using Ctrl-D!",
|
||||
"Seeking in replays is available by dragging on the difficulty bar at the bottom of the screen!",
|
||||
"Multithreading support means that even with low \"FPS\" your input and judgements will be accurate!",
|
||||
"Try scrolling down in the mod select panel to find a bunch of new fun mods!",
|
||||
|
@ -127,11 +127,11 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
case ButtonSystemState.Initial:
|
||||
case ButtonSystemState.Exit:
|
||||
Background.FadeColour(Color4.White, 500, Easing.OutSine);
|
||||
ApplyToBackground(b => b.FadeColour(Color4.White, 500, Easing.OutSine));
|
||||
break;
|
||||
|
||||
default:
|
||||
Background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine);
|
||||
ApplyToBackground(b => b.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine));
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -256,7 +256,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
(Background as BackgroundScreenDefault)?.Next();
|
||||
ApplyToBackground(b => (b as BackgroundScreenDefault)?.Next());
|
||||
|
||||
// we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
@ -2,8 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -41,38 +39,21 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true);
|
||||
}
|
||||
|
||||
private void updateSelectedItem(PlaylistItem item)
|
||||
{
|
||||
hasBeatmap = findBeatmap(expr => beatmaps.QueryBeatmap(expr));
|
||||
}
|
||||
private void updateSelectedItem(PlaylistItem _) => Scheduler.AddOnce(updateBeatmapState);
|
||||
private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> _) => Scheduler.AddOnce(updateBeatmapState);
|
||||
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> _) => Scheduler.AddOnce(updateBeatmapState);
|
||||
|
||||
private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||
{
|
||||
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||
{
|
||||
if (findBeatmap(expr => set.Beatmaps.AsQueryable().FirstOrDefault(expr)))
|
||||
Schedule(() => hasBeatmap = true);
|
||||
}
|
||||
}
|
||||
|
||||
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||
{
|
||||
if (weakSet.NewValue.TryGetTarget(out var set))
|
||||
{
|
||||
if (findBeatmap(expr => set.Beatmaps.AsQueryable().FirstOrDefault(expr)))
|
||||
Schedule(() => hasBeatmap = false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool findBeatmap(Func<Expression<Func<BeatmapInfo, bool>>, BeatmapInfo> expression)
|
||||
private void updateBeatmapState()
|
||||
{
|
||||
int? beatmapId = SelectedItem.Value?.Beatmap.Value?.OnlineBeatmapID;
|
||||
string checksum = SelectedItem.Value?.Beatmap.Value?.MD5Hash;
|
||||
|
||||
if (beatmapId == null || checksum == null)
|
||||
return false;
|
||||
return;
|
||||
|
||||
return expression(b => b.OnlineBeatmapID == beatmapId && b.MD5Hash == checksum) != null;
|
||||
var databasedBeatmap = beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == beatmapId && b.MD5Hash == checksum);
|
||||
|
||||
hasBeatmap = databasedBeatmap?.BeatmapSet?.DeletePending == false;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
Padding = new MarginPadding(10),
|
||||
Child = roomsContainer = new RoomsContainer { JoinRequested = joinRequested }
|
||||
},
|
||||
loadingLayer = new LoadingLayer(roomsContainer),
|
||||
loadingLayer = new LoadingLayer(true),
|
||||
}
|
||||
},
|
||||
new RoomInspector
|
||||
|
@ -71,201 +71,192 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Container dimContent;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
dimContent = new Container
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
Colour = Color4Extensions.FromHex(@"28242d"),
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Box
|
||||
new Dimension(GridSizeMode.Distributed),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d"),
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
new OsuScrollContainer
|
||||
{
|
||||
new Dimension(GridSizeMode.Distributed),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
new OsuScrollContainer
|
||||
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||
Vertical = 10
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Padding = new MarginPadding
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||
Vertical = 10
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
new SectionContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
Padding = new MarginPadding { Right = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new SectionContainer
|
||||
new Section("Room name")
|
||||
{
|
||||
Padding = new MarginPadding { Right = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
Child = NameField = new SettingsTextBox
|
||||
{
|
||||
new Section("Room name")
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
},
|
||||
},
|
||||
new Section("Room visibility")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = AvailabilityPicker = new RoomAvailabilityPicker
|
||||
{
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
},
|
||||
new Section("Game type")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Child = NameField = new SettingsTextBox
|
||||
TypePicker = new GameTypePicker
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
},
|
||||
},
|
||||
new Section("Room visibility")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = AvailabilityPicker = new RoomAvailabilityPicker
|
||||
{
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
},
|
||||
new Section("Game type")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new FillFlowContainer
|
||||
typeLabel = new OsuSpriteText
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
TypePicker = new GameTypePicker
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
typeLabel = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Colour = colours.Yellow
|
||||
},
|
||||
},
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Colour = colours.Yellow
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new SectionContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Padding = new MarginPadding { Left = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new Section("Max participants")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = MaxParticipantsField = new SettingsNumberTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
new Section("Password (optional)")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new SettingsPasswordTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
initialBeatmapControl = new BeatmapSelectionControl
|
||||
new SectionContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Padding = new MarginPadding { Left = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new Section("Max participants")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = MaxParticipantsField = new SettingsNumberTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
new Section("Password (optional)")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new SettingsPasswordTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
initialBeatmapControl = new BeatmapSelectionControl
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
},
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = 2,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = 2,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Margin = new MarginPadding { Vertical = 20 },
|
||||
Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
ApplyButton = new CreateOrUpdateButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(230, 55),
|
||||
Enabled = { Value = false },
|
||||
Action = apply,
|
||||
},
|
||||
new FillFlowContainer
|
||||
ErrorText = new OsuSpriteText
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Margin = new MarginPadding { Vertical = 20 },
|
||||
Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ApplyButton = new CreateOrUpdateButton
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(230, 55),
|
||||
Enabled = { Value = false },
|
||||
Action = apply,
|
||||
},
|
||||
ErrorText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Alpha = 0,
|
||||
Depth = 1,
|
||||
Colour = colours.RedDark
|
||||
}
|
||||
}
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Alpha = 0,
|
||||
Depth = 1,
|
||||
Colour = colours.RedDark
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
loadingLayer = new LoadingLayer(dimContent)
|
||||
loadingLayer = new LoadingLayer(true)
|
||||
};
|
||||
|
||||
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(loadingLayer = new LoadingLayer(Carousel));
|
||||
AddInternal(loadingLayer = new LoadingLayer(true));
|
||||
initialBeatmap = Beatmap.Value;
|
||||
initialRuleset = Ruleset.Value;
|
||||
initialMods = Mods.Value.ToList();
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, userIds), HUDOverlay.Add);
|
||||
|
||||
HUDOverlay.Add(loadingDisplay = new LoadingLayer(DrawableRuleset) { Depth = float.MaxValue });
|
||||
HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue });
|
||||
|
||||
if (Token == null)
|
||||
return; // Todo: Somehow handle token retrieval failure.
|
||||
|
@ -64,243 +64,234 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Container dimContent;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
dimContent = new Container
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
Colour = Color4Extensions.FromHex(@"28242d"),
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Box
|
||||
new Dimension(GridSizeMode.Distributed),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d"),
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
new OsuScrollContainer
|
||||
{
|
||||
new Dimension(GridSizeMode.Distributed),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
new OsuScrollContainer
|
||||
{
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||
Vertical = 10
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SectionContainer
|
||||
{
|
||||
Padding = new MarginPadding { Right = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new Section("Room name")
|
||||
{
|
||||
Child = NameField = new SettingsTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
LengthLimit = 100
|
||||
},
|
||||
},
|
||||
new Section("Duration")
|
||||
{
|
||||
Child = DurationField = new DurationDropdown
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Items = new[]
|
||||
{
|
||||
TimeSpan.FromMinutes(30),
|
||||
TimeSpan.FromHours(1),
|
||||
TimeSpan.FromHours(2),
|
||||
TimeSpan.FromHours(4),
|
||||
TimeSpan.FromHours(8),
|
||||
TimeSpan.FromHours(12),
|
||||
//TimeSpan.FromHours(16),
|
||||
TimeSpan.FromHours(24),
|
||||
TimeSpan.FromDays(3),
|
||||
TimeSpan.FromDays(7)
|
||||
}
|
||||
}
|
||||
},
|
||||
new Section("Room visibility")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = AvailabilityPicker = new RoomAvailabilityPicker
|
||||
{
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
},
|
||||
new Section("Game type")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
TypePicker = new GameTypePicker
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
typeLabel = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Colour = colours.Yellow
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new Section("Max participants")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = MaxParticipantsField = new SettingsNumberTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
new Section("Password (optional)")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new SettingsPasswordTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new SectionContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Padding = new MarginPadding { Left = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new Section("Playlist")
|
||||
{
|
||||
Child = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 300,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
playlist = new DrawableRoomPlaylist(true, true) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
playlistLength = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Vertical = 5 },
|
||||
Colour = colours.Yellow,
|
||||
Font = OsuFont.GetFont(size: 12),
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new PurpleTriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Text = "Edit playlist",
|
||||
Action = () => EditPlaylist?.Invoke()
|
||||
}
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
|
||||
Vertical = 10
|
||||
},
|
||||
new Drawable[]
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = 2,
|
||||
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
new SectionContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Margin = new MarginPadding { Vertical = 20 },
|
||||
Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Children = new Drawable[]
|
||||
Padding = new MarginPadding { Right = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
ApplyButton = new CreateRoomButton
|
||||
new Section("Room name")
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(230, 55),
|
||||
Enabled = { Value = false },
|
||||
Action = apply,
|
||||
Child = NameField = new SettingsTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
LengthLimit = 100
|
||||
},
|
||||
},
|
||||
ErrorText = new OsuSpriteText
|
||||
new Section("Duration")
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Alpha = 0,
|
||||
Depth = 1,
|
||||
Colour = colours.RedDark
|
||||
}
|
||||
}
|
||||
Child = DurationField = new DurationDropdown
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Items = new[]
|
||||
{
|
||||
TimeSpan.FromMinutes(30),
|
||||
TimeSpan.FromHours(1),
|
||||
TimeSpan.FromHours(2),
|
||||
TimeSpan.FromHours(4),
|
||||
TimeSpan.FromHours(8),
|
||||
TimeSpan.FromHours(12),
|
||||
//TimeSpan.FromHours(16),
|
||||
TimeSpan.FromHours(24),
|
||||
TimeSpan.FromDays(3),
|
||||
TimeSpan.FromDays(7)
|
||||
}
|
||||
}
|
||||
},
|
||||
new Section("Room visibility")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = AvailabilityPicker = new RoomAvailabilityPicker
|
||||
{
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
},
|
||||
new Section("Game type")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
TypePicker = new GameTypePicker
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Enabled = { Value = false }
|
||||
},
|
||||
typeLabel = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.GetFont(size: 14),
|
||||
Colour = colours.Yellow
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new Section("Max participants")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = MaxParticipantsField = new SettingsNumberTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
new Section("Password (optional)")
|
||||
{
|
||||
Alpha = disabled_alpha,
|
||||
Child = new SettingsPasswordTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new SectionContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Padding = new MarginPadding { Left = FIELD_PADDING / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
new Section("Playlist")
|
||||
{
|
||||
Child = new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 300,
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
playlist = new DrawableRoomPlaylist(true, true) { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
playlistLength = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Vertical = 5 },
|
||||
Colour = colours.Yellow,
|
||||
Font = OsuFont.GetFont(size: 12),
|
||||
}
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new PurpleTriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 40,
|
||||
Text = "Edit playlist",
|
||||
Action = () => EditPlaylist?.Invoke()
|
||||
}
|
||||
}
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = 2,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Margin = new MarginPadding { Vertical = 20 },
|
||||
Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ApplyButton = new CreateRoomButton
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(230, 55),
|
||||
Enabled = { Value = false },
|
||||
Action = apply,
|
||||
},
|
||||
ErrorText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Alpha = 0,
|
||||
Depth = 1,
|
||||
Colour = colours.RedDark
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
loadingLayer = new LoadingLayer(dimContent)
|
||||
loadingLayer = new LoadingLayer(true)
|
||||
};
|
||||
|
||||
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -114,11 +115,17 @@ namespace osu.Game.Screens
|
||||
Mods = screenDependencies.Mods;
|
||||
}
|
||||
|
||||
protected BackgroundScreen Background => backgroundStack?.CurrentScreen as BackgroundScreen;
|
||||
/// <summary>
|
||||
/// The background created and owned by this screen. May be null if the background didn't change.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
private BackgroundScreen ownedBackground;
|
||||
|
||||
private BackgroundScreen localBackground;
|
||||
[CanBeNull]
|
||||
private BackgroundScreen background;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
[CanBeNull]
|
||||
private BackgroundScreenStack backgroundStack { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
@ -140,6 +147,21 @@ namespace osu.Game.Screens
|
||||
Activity.Value ??= InitialActivity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply arbitrary changes to the current background screen in a thread safe manner.
|
||||
/// </summary>
|
||||
/// <param name="action">The operation to perform.</param>
|
||||
public void ApplyToBackground(Action<BackgroundScreen> action)
|
||||
{
|
||||
if (backgroundStack == null)
|
||||
throw new InvalidOperationException("Attempted to apply to background without a background stack being available.");
|
||||
|
||||
if (background == null)
|
||||
throw new InvalidOperationException("Attempted to apply to background before screen is pushed.");
|
||||
|
||||
background.ApplyToBackground(action);
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
if (PlayResumeSound)
|
||||
@ -160,7 +182,16 @@ namespace osu.Game.Screens
|
||||
{
|
||||
applyArrivingDefaults(false);
|
||||
|
||||
backgroundStack?.Push(localBackground = CreateBackground());
|
||||
backgroundStack?.Push(ownedBackground = CreateBackground());
|
||||
|
||||
background = backgroundStack?.CurrentScreen as BackgroundScreen;
|
||||
|
||||
if (background != ownedBackground)
|
||||
{
|
||||
// background may have not been replaced, at which point we don't want to track the background lifetime.
|
||||
ownedBackground?.Dispose();
|
||||
ownedBackground = null;
|
||||
}
|
||||
|
||||
base.OnEntering(last);
|
||||
}
|
||||
@ -173,7 +204,7 @@ namespace osu.Game.Screens
|
||||
if (base.OnExiting(next))
|
||||
return true;
|
||||
|
||||
if (localBackground != null && backgroundStack?.CurrentScreen == localBackground)
|
||||
if (ownedBackground != null && backgroundStack?.CurrentScreen == ownedBackground)
|
||||
backgroundStack?.Exit();
|
||||
|
||||
return false;
|
||||
|
@ -53,7 +53,6 @@ namespace osu.Game.Screens.Play
|
||||
private readonly Bindable<IReadOnlyList<Mod>> mods;
|
||||
private readonly Drawable facade;
|
||||
private LoadingSpinner loading;
|
||||
private Sprite backgroundSprite;
|
||||
|
||||
public IBindable<IReadOnlyList<Mod>> Mods => mods;
|
||||
|
||||
@ -123,7 +122,7 @@ namespace osu.Game.Screens.Play
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
backgroundSprite = new Sprite
|
||||
new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = beatmap?.Background,
|
||||
@ -131,7 +130,7 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.Centre,
|
||||
FillMode = FillMode.Fill,
|
||||
},
|
||||
loading = new LoadingLayer(backgroundSprite)
|
||||
loading = new LoadingLayer(true)
|
||||
}
|
||||
},
|
||||
new OsuSpriteText
|
||||
|
@ -24,7 +24,19 @@ namespace osu.Game.Screens.Play
|
||||
Alpha = 0f;
|
||||
}
|
||||
|
||||
public BackgroundScreenBeatmap DimmableBackground { get; set; }
|
||||
private BackgroundScreenBeatmap dimmableBackground;
|
||||
|
||||
public BackgroundScreenBeatmap DimmableBackground
|
||||
{
|
||||
get => dimmableBackground;
|
||||
set
|
||||
{
|
||||
dimmableBackground = value;
|
||||
|
||||
if (IsLoaded)
|
||||
updateBackgroundFade();
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, IBindable<WorkingBeatmap> beatmap)
|
||||
@ -75,11 +87,16 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
||||
updateBackgroundFade();
|
||||
|
||||
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void updateBackgroundFade()
|
||||
{
|
||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
||||
}
|
||||
}
|
||||
|
@ -721,15 +721,20 @@ namespace osu.Game.Screens.Play
|
||||
.Delay(250)
|
||||
.FadeIn(250);
|
||||
|
||||
Background.EnableUserDim.Value = true;
|
||||
Background.BlurAmount.Value = 0;
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
b.EnableUserDim.Value = true;
|
||||
b.BlurAmount.Value = 0;
|
||||
|
||||
// bind component bindables.
|
||||
b.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||
|
||||
b.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||
});
|
||||
|
||||
// bind component bindables.
|
||||
Background.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||
HUDOverlay.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||
DimmableStoryboard.IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||
|
||||
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||
|
||||
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
|
||||
@ -875,7 +880,7 @@ namespace osu.Game.Screens.Play
|
||||
float fadeOutDuration = instant ? 0 : 250;
|
||||
this.FadeOut(fadeOutDuration);
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
ApplyToBackground(b => b.EnableUserDim.Value = false);
|
||||
storyboardReplacesBackground.Value = false;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
backgroundBrightnessReduction = value;
|
||||
|
||||
Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200);
|
||||
ApplyToBackground(b => b.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200));
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,12 +176,17 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
if (epilepsyWarning != null)
|
||||
epilepsyWarning.DimmableBackground = Background;
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
if (epilepsyWarning != null)
|
||||
epilepsyWarning.DimmableBackground = b;
|
||||
|
||||
b?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||
});
|
||||
|
||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
|
||||
content.ScaleTo(0.7f);
|
||||
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||
|
||||
contentIn();
|
||||
|
||||
@ -225,7 +230,8 @@ namespace osu.Game.Screens.Play
|
||||
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
||||
this.FadeOut(150);
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
ApplyToBackground(b => b.EnableUserDim.Value = false);
|
||||
|
||||
BackgroundBrightnessReduction = false;
|
||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
|
||||
@ -270,16 +276,22 @@ namespace osu.Game.Screens.Play
|
||||
if (inputManager.HoveredDrawables.Contains(VisualSettings))
|
||||
{
|
||||
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||
Background.EnableUserDim.Value = true;
|
||||
Background.BlurAmount.Value = 0;
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
b.EnableUserDim.Value = true;
|
||||
b.BlurAmount.Value = 0;
|
||||
});
|
||||
|
||||
BackgroundBrightnessReduction = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||
b.EnableUserDim.Value = false;
|
||||
b.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
});
|
||||
|
||||
BackgroundBrightnessReduction = true;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
@ -9,6 +10,6 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
public new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
||||
public void ApplyToBackground(Action<BackgroundScreenBeatmap> action) => base.ApplyToBackground(b => action.Invoke((BackgroundScreenBeatmap)b));
|
||||
}
|
||||
}
|
||||
|
@ -18,14 +18,13 @@ using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking.Statistics;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public abstract class ResultsScreen : OsuScreen, IKeyBindingHandler<GlobalAction>
|
||||
public abstract class ResultsScreen : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
protected const float BACKGROUND_BLUR = 20;
|
||||
private static readonly float screen_height = 768 - TwoLayerButton.SIZE_EXTENDED.Y;
|
||||
@ -35,8 +34,6 @@ namespace osu.Game.Screens.Ranking
|
||||
// Temporary for now to stop dual transitions. Should respect the current toolbar mode, but there's no way to do so currently.
|
||||
public override bool HideOverlaysOnEnter => true;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
public readonly Bindable<ScoreInfo> SelectedScore = new Bindable<ScoreInfo>();
|
||||
|
||||
public readonly ScoreInfo Score;
|
||||
@ -237,15 +234,18 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
((BackgroundScreenBeatmap)Background).BlurAmount.Value = BACKGROUND_BLUR;
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
b.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
b.FadeTo(0.5f, 250);
|
||||
});
|
||||
|
||||
Background.FadeTo(0.5f, 250);
|
||||
bottomPanel.FadeTo(1, 250);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
Background.FadeTo(1, 250);
|
||||
ApplyToBackground(b => b.FadeTo(1, 250));
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
@ -295,7 +295,7 @@ namespace osu.Game.Screens.Ranking
|
||||
ScorePanelList.HandleInput = false;
|
||||
|
||||
// Dim background.
|
||||
Background.FadeTo(0.1f, 150);
|
||||
ApplyToBackground(b => b.FadeTo(0.1f, 150));
|
||||
|
||||
detachedPanel = expandedPanel;
|
||||
}
|
||||
@ -319,7 +319,7 @@ namespace osu.Game.Screens.Ranking
|
||||
ScorePanelList.HandleInput = true;
|
||||
|
||||
// Un-dim background.
|
||||
Background.FadeTo(0.5f, 150);
|
||||
ApplyToBackground(b => b.FadeTo(0.5f, 150));
|
||||
|
||||
detachedPanel = null;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Layout;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -124,6 +125,8 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
BeatmapSetsLoaded = true;
|
||||
|
||||
itemsCache.Invalidate();
|
||||
});
|
||||
}
|
||||
|
||||
@ -567,6 +570,15 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
#endregion
|
||||
|
||||
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
|
||||
{
|
||||
// handles the vertical size of the carousel changing (ie. on window resize when aspect ratio has changed).
|
||||
if ((invalidation & Invalidation.Layout) > 0)
|
||||
itemsCache.Invalidate();
|
||||
|
||||
return base.OnInvalidate(invalidation, source);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -777,13 +789,19 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
Scroll.ScrollContent.Height = currentY;
|
||||
|
||||
if (BeatmapSetsLoaded && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected))
|
||||
{
|
||||
selectedBeatmapSet = null;
|
||||
SelectionChanged?.Invoke(null);
|
||||
}
|
||||
|
||||
itemsCache.Validate();
|
||||
|
||||
// update and let external consumers know about selection loss.
|
||||
if (BeatmapSetsLoaded)
|
||||
{
|
||||
bool selectionLost = selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected;
|
||||
|
||||
if (selectionLost)
|
||||
{
|
||||
selectedBeatmapSet = null;
|
||||
SelectionChanged?.Invoke(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool firstScroll = true;
|
||||
@ -806,14 +824,13 @@ namespace osu.Game.Screens.Select
|
||||
break;
|
||||
|
||||
case PendingScrollOperation.Immediate:
|
||||
|
||||
// in order to simplify animation logic, rather than using the animated version of ScrollTo,
|
||||
// we take the difference in scroll height and apply to all visible panels.
|
||||
// this avoids edge cases like when the visible panels is reduced suddenly, causing ScrollContainer
|
||||
// to enter clamp-special-case mode where it animates completely differently to normal.
|
||||
float scrollChange = scrollTarget.Value - Scroll.Current;
|
||||
|
||||
Scroll.ScrollTo(scrollTarget.Value, false);
|
||||
|
||||
foreach (var i in Scroll.Children)
|
||||
i.Y += scrollChange;
|
||||
break;
|
||||
@ -919,7 +936,6 @@ namespace osu.Game.Screens.Select
|
||||
Masking = false;
|
||||
}
|
||||
|
||||
// ReSharper disable once OptionalParameterHierarchyMismatch 2020.3 EAP4 bug. (https://youtrack.jetbrains.com/issue/RSRP-481535?p=RIDER-51910)
|
||||
protected override void OnUserScroll(float value, bool animated = true, double? distanceDecay = default)
|
||||
{
|
||||
UserScrolling = true;
|
||||
|
@ -63,8 +63,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public BeatmapDetails()
|
||||
{
|
||||
Container content;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -72,7 +70,7 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
content = new Container
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Horizontal = spacing },
|
||||
@ -159,7 +157,7 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
},
|
||||
},
|
||||
loading = new LoadingLayer(content),
|
||||
loading = new LoadingLayer(true),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -36,10 +38,14 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty<DrawableCarouselItem>();
|
||||
|
||||
[CanBeNull]
|
||||
private Container<DrawableCarouselItem> beatmapContainer;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
|
||||
[CanBeNull]
|
||||
private Task beatmapsLoadTask;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager manager { get; set; }
|
||||
|
||||
@ -85,7 +91,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
base.UpdateItem();
|
||||
|
||||
Content.Clear();
|
||||
|
||||
beatmapContainer = null;
|
||||
beatmapsLoadTask = null;
|
||||
|
||||
if (Item == null)
|
||||
return;
|
||||
@ -122,11 +130,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
MovementContainer.MoveToX(0, 500, Easing.OutExpo);
|
||||
|
||||
if (beatmapContainer != null)
|
||||
{
|
||||
foreach (var beatmap in beatmapContainer)
|
||||
beatmap.MoveToY(0, 800, Easing.OutQuint);
|
||||
}
|
||||
updateBeatmapYPositions();
|
||||
}
|
||||
|
||||
protected override void Selected()
|
||||
@ -163,7 +167,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation())
|
||||
};
|
||||
|
||||
LoadComponentAsync(beatmapContainer, loaded =>
|
||||
beatmapsLoadTask = LoadComponentAsync(beatmapContainer, loaded =>
|
||||
{
|
||||
// make sure the pooled target hasn't changed.
|
||||
if (beatmapContainer != loaded)
|
||||
@ -173,16 +177,29 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
updateBeatmapYPositions();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void updateBeatmapYPositions()
|
||||
private void updateBeatmapYPositions()
|
||||
{
|
||||
if (beatmapContainer == null)
|
||||
return;
|
||||
|
||||
if (beatmapsLoadTask == null || !beatmapsLoadTask.IsCompleted)
|
||||
return;
|
||||
|
||||
float yPos = DrawableCarouselBeatmap.CAROUSEL_BEATMAP_SPACING;
|
||||
|
||||
bool isSelected = Item.State.Value == CarouselItemState.Selected;
|
||||
|
||||
foreach (var panel in beatmapContainer.Children)
|
||||
{
|
||||
float yPos = DrawableCarouselBeatmap.CAROUSEL_BEATMAP_SPACING;
|
||||
|
||||
foreach (var panel in beatmapContainer.Children)
|
||||
if (isSelected)
|
||||
{
|
||||
panel.MoveToY(yPos, 800, Easing.OutQuint);
|
||||
yPos += panel.Item.TotalHeight;
|
||||
}
|
||||
else
|
||||
panel.MoveToY(0, 800, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
@ -38,10 +37,11 @@ using osu.Game.Collections;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Scoring;
|
||||
using System.Diagnostics;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen, IKeyBindingHandler<GlobalAction>
|
||||
public abstract class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public static readonly float WEDGE_HEIGHT = 245;
|
||||
|
||||
@ -76,8 +76,6 @@ namespace osu.Game.Screens.Select
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; }
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
protected BeatmapCarousel Carousel { get; private set; }
|
||||
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
@ -428,16 +426,21 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void updateSelectedBeatmap(BeatmapInfo beatmap)
|
||||
{
|
||||
if (beatmap == null && beatmapNoDebounce == null)
|
||||
return;
|
||||
|
||||
if (beatmap?.Equals(beatmapNoDebounce) == true)
|
||||
return;
|
||||
|
||||
beatmapNoDebounce = beatmap;
|
||||
|
||||
performUpdateSelected();
|
||||
}
|
||||
|
||||
private void updateSelectedRuleset(RulesetInfo ruleset)
|
||||
{
|
||||
if (ruleset == null && rulesetNoDebounce == null)
|
||||
return;
|
||||
|
||||
if (ruleset?.Equals(rulesetNoDebounce) == true)
|
||||
return;
|
||||
|
||||
@ -684,12 +687,12 @@ namespace osu.Game.Screens.Select
|
||||
/// <param name="beatmap">The working beatmap.</param>
|
||||
private void updateComponentFromBeatmap(WorkingBeatmap beatmap)
|
||||
{
|
||||
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
||||
ApplyToBackground(backgroundModeBeatmap =>
|
||||
{
|
||||
backgroundModeBeatmap.Beatmap = beatmap;
|
||||
backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
||||
}
|
||||
});
|
||||
|
||||
beatmapInfoWedge.Beatmap = beatmap;
|
||||
|
||||
|
Reference in New Issue
Block a user