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

Refactor to avoid visual inconsistency for beatmaps with no leaderboard

This commit is contained in:
Andrei Zavatski 2020-02-22 03:40:59 +03:00
parent 894b50f955
commit 63006e8672
3 changed files with 49 additions and 45 deletions

View File

@ -0,0 +1,29 @@
// 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 osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
public class BeatmapSetLayoutSection : Container
{
public BeatmapSetLayoutSection()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0.25f),
Type = EdgeEffectType.Shadow,
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
}

View File

@ -19,7 +19,7 @@ using osu.Game.Users;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class ScoresContainer : CompositeDrawable
public class ScoresContainer : BeatmapSetLayoutSection
{
private const int spacing = 15;
@ -34,7 +34,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly LoadingLayer loading;
private readonly LeaderboardModSelector modSelector;
private readonly NoScoresPlaceholder noScoresPlaceholder;
private readonly FillFlowContainer content;
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
[Resolved]
@ -76,15 +75,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public ScoresContainer()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[]
AddRange(new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
content = new FillFlowContainer
new FillFlowContainer
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -164,8 +161,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
}
}
},
};
}
});
}
[BackgroundDependencyLoader]
@ -223,7 +220,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (Beatmap.Value?.OnlineBeatmapID.HasValue != true || Beatmap.Value.Status <= BeatmapSetOnlineStatus.Pending)
{
Scores = null;
content.Hide();
Hide();
return;
}
@ -237,7 +234,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
notSupporterPlaceholder.Hide();
content.Show();
Show();
loading.Show();
getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods);

View File

@ -4,10 +4,8 @@
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Beatmaps;
@ -18,7 +16,6 @@ using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Overlays.Comments;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays
{
@ -44,7 +41,7 @@ namespace osu.Game.Overlays
{
OsuScrollContainer scroll;
Info info;
BeatmapSetCommentsContainer comments;
CommentsSection comments;
Children = new Drawable[]
{
@ -56,7 +53,7 @@ namespace osu.Game.Overlays
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = new ReverseChildIDFillFlowContainer<Section>
Child = new ReverseChildIDFillFlowContainer<BeatmapSetLayoutSection>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@ -64,7 +61,7 @@ namespace osu.Game.Overlays
Spacing = new Vector2(0, 20),
Children = new[]
{
new Section
new BeatmapSetLayoutSection
{
Child = new ReverseChildIDFillFlowContainer<Drawable>
{
@ -78,17 +75,11 @@ namespace osu.Game.Overlays
}
},
},
new Section
new ScoresContainer
{
Child = new ScoresContainer
{
Beatmap = { BindTarget = Header.Picker.Beatmap }
}
Beatmap = { BindTarget = Header.Picker.Beatmap }
},
new Section
{
Child = comments = new BeatmapSetCommentsContainer()
}
comments = new CommentsSection()
},
},
},
@ -160,29 +151,16 @@ namespace osu.Game.Overlays
Show();
}
private class Section : Container
{
public Section()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Masking = true;
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0.25f),
Type = EdgeEffectType.Shadow,
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
}
private class BeatmapSetCommentsContainer : CommentsContainer
private class CommentsSection : BeatmapSetLayoutSection
{
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
public BeatmapSetCommentsContainer()
public CommentsSection()
{
CommentsContainer comments;
Add(comments = new CommentsContainer());
BeatmapSet.BindValueChanged(beatmapSet =>
{
if (beatmapSet.NewValue?.OnlineBeatmapSetID.HasValue != true)
@ -192,7 +170,7 @@ namespace osu.Game.Overlays
else
{
Show();
ShowComments(CommentableType.Beatmapset, beatmapSet.NewValue.OnlineBeatmapSetID.Value);
comments.ShowComments(CommentableType.Beatmapset, beatmapSet.NewValue.OnlineBeatmapSetID.Value);
}
}, true);
}