1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Merge branch 'master' into remove-osu-direct

This commit is contained in:
Bartłomiej Dach 2021-01-06 16:49:38 +01:00 committed by GitHub
commit 4c2caec72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 25 deletions

View File

@ -26,9 +26,11 @@ namespace osu.Desktop.Overlays
Alpha = 0; Alpha = 0;
FillFlowContainer mainFill;
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer mainFill = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
@ -55,23 +57,30 @@ namespace osu.Desktop.Overlays
}, },
} }
}, },
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Font = OsuFont.Numeric.With(size: 12),
Colour = colours.Yellow,
Text = @"Development Build"
},
new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
},
} }
} }
}; };
if (!game.IsDeployedBuild)
{
mainFill.AddRange(new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Font = OsuFont.Numeric.With(size: 12),
Colour = colours.Yellow,
Text = @"Development Build"
},
new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
},
});
}
} }
protected override void PopIn() protected override void PopIn()

View File

@ -5,6 +5,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -36,10 +38,14 @@ namespace osu.Game.Screens.Select.Carousel
public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty<DrawableCarouselItem>(); public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.Children ?? Enumerable.Empty<DrawableCarouselItem>();
[CanBeNull]
private Container<DrawableCarouselItem> beatmapContainer; private Container<DrawableCarouselItem> beatmapContainer;
private BeatmapSetInfo beatmapSet; private BeatmapSetInfo beatmapSet;
[CanBeNull]
private Task beatmapsLoadTask;
[Resolved] [Resolved]
private BeatmapManager manager { get; set; } private BeatmapManager manager { get; set; }
@ -85,7 +91,9 @@ namespace osu.Game.Screens.Select.Carousel
base.UpdateItem(); base.UpdateItem();
Content.Clear(); Content.Clear();
beatmapContainer = null; beatmapContainer = null;
beatmapsLoadTask = null;
if (Item == null) if (Item == null)
return; return;
@ -122,11 +130,7 @@ namespace osu.Game.Screens.Select.Carousel
MovementContainer.MoveToX(0, 500, Easing.OutExpo); MovementContainer.MoveToX(0, 500, Easing.OutExpo);
if (beatmapContainer != null) updateBeatmapYPositions();
{
foreach (var beatmap in beatmapContainer)
beatmap.MoveToY(0, 800, Easing.OutQuint);
}
} }
protected override void Selected() protected override void Selected()
@ -163,7 +167,7 @@ namespace osu.Game.Screens.Select.Carousel
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation()) ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation())
}; };
LoadComponentAsync(beatmapContainer, loaded => beatmapsLoadTask = LoadComponentAsync(beatmapContainer, loaded =>
{ {
// make sure the pooled target hasn't changed. // make sure the pooled target hasn't changed.
if (beatmapContainer != loaded) if (beatmapContainer != loaded)
@ -173,16 +177,29 @@ namespace osu.Game.Screens.Select.Carousel
updateBeatmapYPositions(); 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; if (isSelected)
foreach (var panel in beatmapContainer.Children)
{ {
panel.MoveToY(yPos, 800, Easing.OutQuint); panel.MoveToY(yPos, 800, Easing.OutQuint);
yPos += panel.Item.TotalHeight; yPos += panel.Item.TotalHeight;
} }
else
panel.MoveToY(0, 800, Easing.OutQuint);
} }
} }