mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Merge pull request #7951 from EVAST9919/beatmapset-comments
Add CommentsContainer to BeatmapSetOverlay
This commit is contained in:
commit
627870fa07
29
osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs
Normal file
29
osu.Game/Overlays/BeatmapSet/BeatmapSetLayoutSection.cs
Normal 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),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,17 +3,14 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
@ -43,14 +40,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = base_height;
|
Height = base_height;
|
||||||
Masking = true;
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Colour = Color4.Black.Opacity(0.25f),
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Radius = 3,
|
|
||||||
Offset = new Vector2(0f, 1f),
|
|
||||||
};
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||||
{
|
{
|
||||||
public class ScoresContainer : CompositeDrawable
|
public class ScoresContainer : BeatmapSetLayoutSection
|
||||||
{
|
{
|
||||||
private const int spacing = 15;
|
private const int spacing = 15;
|
||||||
|
|
||||||
@ -34,7 +34,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
private readonly LoadingLayer loading;
|
private readonly LoadingLayer loading;
|
||||||
private readonly LeaderboardModSelector modSelector;
|
private readonly LeaderboardModSelector modSelector;
|
||||||
private readonly NoScoresPlaceholder noScoresPlaceholder;
|
private readonly NoScoresPlaceholder noScoresPlaceholder;
|
||||||
private readonly FillFlowContainer content;
|
|
||||||
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
|
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -76,15 +75,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
public ScoresContainer()
|
public ScoresContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
AddRange(new Drawable[]
|
||||||
AutoSizeAxes = Axes.Y;
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
content = new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -164,8 +161,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -223,7 +220,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
if (Beatmap.Value?.OnlineBeatmapID.HasValue != true || Beatmap.Value.Status <= BeatmapSetOnlineStatus.Pending)
|
if (Beatmap.Value?.OnlineBeatmapID.HasValue != true || Beatmap.Value.Status <= BeatmapSetOnlineStatus.Pending)
|
||||||
{
|
{
|
||||||
Scores = null;
|
Scores = null;
|
||||||
content.Hide();
|
Hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +234,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
notSupporterPlaceholder.Hide();
|
notSupporterPlaceholder.Hide();
|
||||||
|
|
||||||
content.Show();
|
Show();
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
|
||||||
getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods);
|
getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods);
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||||
|
using osu.Game.Overlays.Comments;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
OsuScrollContainer scroll;
|
OsuScrollContainer scroll;
|
||||||
Info info;
|
Info info;
|
||||||
|
CommentsSection comments;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -51,29 +53,33 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ScrollbarVisible = false,
|
ScrollbarVisible = false,
|
||||||
Child = new ReverseChildIDFillFlowContainer<Drawable>
|
Child = new ReverseChildIDFillFlowContainer<BeatmapSetLayoutSection>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0, 20),
|
Spacing = new Vector2(0, 20),
|
||||||
Children = new Drawable[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new ReverseChildIDFillFlowContainer<Drawable>
|
new BeatmapSetLayoutSection
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
Child = new ReverseChildIDFillFlowContainer<Drawable>
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
Header = new Header(),
|
AutoSizeAxes = Axes.Y,
|
||||||
info = new Info()
|
RelativeSizeAxes = Axes.X,
|
||||||
}
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
Header = new Header(),
|
||||||
|
info = new Info()
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new ScoresContainer
|
new ScoresContainer
|
||||||
{
|
{
|
||||||
Beatmap = { BindTarget = Header.Picker.Beatmap }
|
Beatmap = { BindTarget = Header.Picker.Beatmap }
|
||||||
}
|
},
|
||||||
|
comments = new CommentsSection()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -81,6 +87,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
Header.BeatmapSet.BindTo(beatmapSet);
|
Header.BeatmapSet.BindTo(beatmapSet);
|
||||||
info.BeatmapSet.BindTo(beatmapSet);
|
info.BeatmapSet.BindTo(beatmapSet);
|
||||||
|
comments.BeatmapSet.BindTo(beatmapSet);
|
||||||
|
|
||||||
Header.Picker.Beatmap.ValueChanged += b =>
|
Header.Picker.Beatmap.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
@ -143,5 +150,30 @@ namespace osu.Game.Overlays
|
|||||||
beatmapSet.Value = set;
|
beatmapSet.Value = set;
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class CommentsSection : BeatmapSetLayoutSection
|
||||||
|
{
|
||||||
|
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
||||||
|
|
||||||
|
public CommentsSection()
|
||||||
|
{
|
||||||
|
CommentsContainer comments;
|
||||||
|
|
||||||
|
Add(comments = new CommentsContainer());
|
||||||
|
|
||||||
|
BeatmapSet.BindValueChanged(beatmapSet =>
|
||||||
|
{
|
||||||
|
if (beatmapSet.NewValue?.OnlineBeatmapSetID is int onlineBeatmapSetID)
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
comments.ShowComments(CommentableType.Beatmapset, onlineBeatmapSetID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user