2021-10-18 00:24:17 +08:00
|
|
|
// 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.
|
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
#nullable enable
|
|
|
|
|
2021-10-18 02:50:44 +08:00
|
|
|
using System.Collections.Generic;
|
2021-10-18 00:24:17 +08:00
|
|
|
using osu.Framework.Allocation;
|
2021-11-08 00:42:32 +08:00
|
|
|
using osu.Framework.Bindables;
|
2021-10-18 00:24:17 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-10-18 00:59:31 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2021-10-18 00:24:17 +08:00
|
|
|
using osu.Framework.Localisation;
|
2021-10-18 03:34:31 +08:00
|
|
|
using osu.Game.Beatmaps.Drawables.Cards.Buttons;
|
2021-10-18 02:50:44 +08:00
|
|
|
using osu.Game.Beatmaps.Drawables.Cards.Statistics;
|
2021-10-18 00:24:17 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2021-11-13 22:38:04 +08:00
|
|
|
using osu.Game.Online;
|
2021-10-18 00:24:17 +08:00
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
using osu.Game.Overlays.BeatmapSet;
|
|
|
|
using osuTK;
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2021-10-18 03:34:31 +08:00
|
|
|
using DownloadButton = osu.Game.Beatmaps.Drawables.Cards.Buttons.DownloadButton;
|
2021-10-18 00:24:17 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables.Cards
|
|
|
|
{
|
|
|
|
public class BeatmapCard : OsuClickableContainer
|
|
|
|
{
|
2021-10-23 04:03:37 +08:00
|
|
|
public const float TRANSITION_DURATION = 400;
|
2021-12-05 22:04:44 +08:00
|
|
|
public const float CORNER_RADIUS = 10;
|
|
|
|
|
2021-12-15 15:19:47 +08:00
|
|
|
public IBindable<bool> Expanded { get; }
|
2021-10-23 04:03:37 +08:00
|
|
|
|
2021-10-18 00:24:17 +08:00
|
|
|
private const float width = 408;
|
|
|
|
private const float height = 100;
|
2021-11-13 22:40:47 +08:00
|
|
|
private const float icon_area_width = 30;
|
2021-10-18 00:24:17 +08:00
|
|
|
|
|
|
|
private readonly APIBeatmapSet beatmapSet;
|
2021-11-08 00:42:32 +08:00
|
|
|
private readonly Bindable<BeatmapSetFavouriteState> favouriteState;
|
2021-10-18 00:59:31 +08:00
|
|
|
|
2021-11-13 22:38:04 +08:00
|
|
|
private readonly BeatmapDownloadTracker downloadTracker;
|
|
|
|
|
2021-12-07 03:49:29 +08:00
|
|
|
private BeatmapCardContent content = null!;
|
2021-12-05 23:31:45 +08:00
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
private BeatmapCardThumbnail thumbnail = null!;
|
2021-10-18 00:59:31 +08:00
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
private Container rightAreaBackground = null!;
|
|
|
|
private Container<BeatmapCardIconButton> rightAreaButtons = null!;
|
2021-10-18 00:59:31 +08:00
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
private Container mainContent = null!;
|
|
|
|
private BeatmapCardContentBackground mainContentBackground = null!;
|
|
|
|
private FillFlowContainer<BeatmapCardStatistic> statisticsContainer = null!;
|
2021-10-18 00:24:17 +08:00
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
private FillFlowContainer idleBottomContent = null!;
|
|
|
|
private BeatmapCardDownloadProgressBar downloadProgressBar = null!;
|
2021-11-10 23:03:48 +08:00
|
|
|
|
2021-11-13 22:40:47 +08:00
|
|
|
[Resolved]
|
2021-10-23 22:48:54 +08:00
|
|
|
private OsuColour colours { get; set; } = null!;
|
2021-11-13 22:40:47 +08:00
|
|
|
|
2021-10-18 00:24:17 +08:00
|
|
|
[Resolved]
|
2021-10-23 22:48:54 +08:00
|
|
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
2021-10-18 00:24:17 +08:00
|
|
|
|
2021-12-15 15:19:47 +08:00
|
|
|
public BeatmapCard(APIBeatmapSet beatmapSet, bool allowExpansion = true)
|
2021-10-18 00:24:17 +08:00
|
|
|
: base(HoverSampleSet.Submit)
|
|
|
|
{
|
2021-12-15 15:19:47 +08:00
|
|
|
Expanded = new BindableBool { Disabled = !allowExpansion };
|
|
|
|
|
2021-10-18 00:24:17 +08:00
|
|
|
this.beatmapSet = beatmapSet;
|
2021-11-08 00:42:32 +08:00
|
|
|
favouriteState = new Bindable<BeatmapSetFavouriteState>(new BeatmapSetFavouriteState(beatmapSet.HasFavourited, beatmapSet.FavouriteCount));
|
2021-11-13 22:38:04 +08:00
|
|
|
downloadTracker = new BeatmapDownloadTracker(beatmapSet);
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
[BackgroundDependencyLoader(true)]
|
|
|
|
private void load(BeatmapSetOverlay? beatmapSetOverlay)
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
|
|
|
Width = width;
|
|
|
|
Height = height;
|
|
|
|
|
2021-10-23 22:48:54 +08:00
|
|
|
FillFlowContainer leftIconArea;
|
|
|
|
GridContainer titleContainer;
|
|
|
|
GridContainer artistContainer;
|
|
|
|
|
2021-12-07 03:49:29 +08:00
|
|
|
InternalChild = content = new BeatmapCardContent(height)
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-07 03:49:29 +08:00
|
|
|
MainContent = new Container
|
2021-10-18 03:34:31 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
2021-10-18 03:34:31 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
downloadTracker,
|
|
|
|
rightAreaBackground = new Container
|
2021-10-18 03:34:31 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Width = icon_area_width + 2 * CORNER_RADIUS,
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
// workaround for masking artifacts at the top & bottom of card,
|
|
|
|
// which become especially visible on downloaded beatmaps (when the icon area has a lime background).
|
|
|
|
Padding = new MarginPadding { Vertical = 1 },
|
|
|
|
Child = new Box
|
2021-11-19 05:28:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Colour4.White
|
2021-11-19 05:28:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
},
|
|
|
|
thumbnail = new BeatmapCardThumbnail(beatmapSet)
|
|
|
|
{
|
|
|
|
Name = @"Left (icon) area",
|
|
|
|
Size = new Vector2(height),
|
|
|
|
Padding = new MarginPadding { Right = CORNER_RADIUS },
|
|
|
|
Child = leftIconArea = new FillFlowContainer
|
2021-11-19 05:28:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Margin = new MarginPadding(5),
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Spacing = new Vector2(1)
|
2021-11-19 05:28:17 +08:00
|
|
|
}
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
new Container
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Name = @"Right (button) area",
|
|
|
|
Width = 30,
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
Padding = new MarginPadding { Vertical = 17.5f },
|
|
|
|
Child = rightAreaButtons = new Container<BeatmapCardIconButton>
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Children = new BeatmapCardIconButton[]
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
new FavouriteButton(beatmapSet)
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Current = favouriteState,
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
new DownloadButton(beatmapSet)
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
State = { BindTarget = downloadTracker.State }
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
new GoToBeatmapButton(beatmapSet)
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
State = { BindTarget = downloadTracker.State }
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
2021-12-05 22:04:44 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mainContent = new Container
|
|
|
|
{
|
|
|
|
Name = @"Main content",
|
|
|
|
X = height - CORNER_RADIUS,
|
|
|
|
Height = height,
|
|
|
|
CornerRadius = CORNER_RADIUS,
|
|
|
|
Masking = true,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
mainContentBackground = new BeatmapCardContentBackground(beatmapSet)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
new FillFlowContainer
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Horizontal = 10,
|
|
|
|
Vertical = 4
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Children = new Drawable[]
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
titleContainer = new GridContainer
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
ColumnDimensions = new[]
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.AutoSize)
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize)
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = new RomanisableString(beatmapSet.TitleUnicode, beatmapSet.Title),
|
|
|
|
Font = OsuFont.Default.With(size: 22.5f, weight: FontWeight.SemiBold),
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Truncate = true
|
|
|
|
},
|
|
|
|
Empty()
|
|
|
|
}
|
|
|
|
}
|
2021-10-18 00:24:17 +08:00
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
artistContainer = new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.AutoSize)
|
|
|
|
},
|
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize)
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Text = createArtistText(),
|
|
|
|
Font = OsuFont.Default.With(size: 17.5f, weight: FontWeight.SemiBold),
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Truncate = true
|
|
|
|
},
|
|
|
|
Empty()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new LinkFlowContainer(s =>
|
|
|
|
{
|
|
|
|
s.Shadow = false;
|
|
|
|
s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold);
|
|
|
|
}).With(d =>
|
|
|
|
{
|
|
|
|
d.AutoSizeAxes = Axes.Both;
|
|
|
|
d.Margin = new MarginPadding { Top = 2 };
|
|
|
|
d.AddText("mapped by ", t => t.Colour = colourProvider.Content2);
|
|
|
|
d.AddUserLink(beatmapSet.Author);
|
|
|
|
}),
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
|
|
|
},
|
2021-12-05 22:04:44 +08:00
|
|
|
new Container
|
2021-10-18 00:24:17 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
Name = @"Bottom content",
|
2021-11-10 23:03:48 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2021-12-05 22:04:44 +08:00
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
Padding = new MarginPadding
|
|
|
|
{
|
|
|
|
Horizontal = 10,
|
|
|
|
Vertical = 4
|
|
|
|
},
|
2021-11-10 23:03:48 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
idleBottomContent = new FillFlowContainer
|
2021-11-10 23:03:48 +08:00
|
|
|
{
|
2021-11-11 01:38:52 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2021-12-05 22:04:44 +08:00
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 3),
|
2021-11-11 01:38:52 +08:00
|
|
|
AlwaysPresent = true,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
statisticsContainer = new FillFlowContainer<BeatmapCardStatistic>
|
2021-11-11 01:38:52 +08:00
|
|
|
{
|
2021-12-05 22:04:44 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
Alpha = 0,
|
|
|
|
AlwaysPresent = true,
|
|
|
|
ChildrenEnumerable = createStatistics()
|
2021-11-11 01:38:52 +08:00
|
|
|
},
|
2021-11-29 03:25:23 +08:00
|
|
|
new BeatmapCardExtraInfoRow(beatmapSet)
|
2021-12-05 23:31:45 +08:00
|
|
|
{
|
|
|
|
Hovered = _ =>
|
|
|
|
{
|
2021-12-15 15:02:43 +08:00
|
|
|
content.ExpandAfterDelay();
|
2021-12-05 23:31:45 +08:00
|
|
|
return false;
|
|
|
|
},
|
2021-12-06 13:26:11 +08:00
|
|
|
Unhovered = _ =>
|
|
|
|
{
|
|
|
|
// This hide should only trigger if the expanded content has not shown yet.
|
|
|
|
// ie. if the user has not shown intent to want to see it (quickly moved over the info row area).
|
|
|
|
if (!Expanded.Value)
|
2021-12-15 15:02:43 +08:00
|
|
|
content.CollapseAfterDelay();
|
2021-12-06 13:26:11 +08:00
|
|
|
}
|
2021-12-05 23:31:45 +08:00
|
|
|
}
|
2021-11-11 01:38:52 +08:00
|
|
|
}
|
2021-12-05 22:04:44 +08:00
|
|
|
},
|
|
|
|
downloadProgressBar = new BeatmapCardDownloadProgressBar
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 6,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
State = { BindTarget = downloadTracker.State },
|
|
|
|
Progress = { BindTarget = downloadTracker.Progress }
|
2021-11-10 23:03:48 +08:00
|
|
|
}
|
|
|
|
}
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-05 22:04:44 +08:00
|
|
|
},
|
2021-12-07 03:49:29 +08:00
|
|
|
ExpandedContent = new Container
|
2021-12-05 22:04:44 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Padding = new MarginPadding { Horizontal = 10, Vertical = 13 },
|
|
|
|
Child = new BeatmapCardDifficultyList(beatmapSet)
|
|
|
|
},
|
|
|
|
Expanded = { BindTarget = Expanded }
|
2021-10-18 00:24:17 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
if (beatmapSet.HasVideo)
|
2021-10-24 01:27:07 +08:00
|
|
|
leftIconArea.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) });
|
2021-10-18 00:24:17 +08:00
|
|
|
|
|
|
|
if (beatmapSet.HasStoryboard)
|
2021-10-24 01:27:07 +08:00
|
|
|
leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) });
|
2021-10-18 00:24:17 +08:00
|
|
|
|
|
|
|
if (beatmapSet.HasExplicitContent)
|
|
|
|
{
|
|
|
|
titleContainer.Content[0][1] = new ExplicitContentBeatmapPill
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
Margin = new MarginPadding { Left = 5 }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
if (beatmapSet.TrackId != null)
|
|
|
|
{
|
|
|
|
artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
Margin = new MarginPadding { Left = 5 }
|
|
|
|
};
|
|
|
|
}
|
2021-10-23 22:48:54 +08:00
|
|
|
|
|
|
|
Action = () => beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmapSet.OnlineID);
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-18 00:59:31 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
2021-11-10 23:03:48 +08:00
|
|
|
|
2021-12-05 22:48:02 +08:00
|
|
|
downloadTracker.State.BindValueChanged(_ => updateState());
|
|
|
|
Expanded.BindValueChanged(_ => updateState(), true);
|
2021-10-18 00:59:31 +08:00
|
|
|
FinishTransforms(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
{
|
|
|
|
updateState();
|
|
|
|
return base.OnHover(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
{
|
2021-12-15 15:02:43 +08:00
|
|
|
content.CollapseAfterDelay();
|
2021-12-06 13:26:11 +08:00
|
|
|
|
2021-10-18 00:59:31 +08:00
|
|
|
updateState();
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
}
|
|
|
|
|
2021-11-03 07:10:50 +08:00
|
|
|
private LocalisableString createArtistText()
|
|
|
|
{
|
|
|
|
var romanisableArtist = new RomanisableString(beatmapSet.ArtistUnicode, beatmapSet.Artist);
|
|
|
|
return BeatmapsetsStrings.ShowDetailsByArtist(romanisableArtist);
|
|
|
|
}
|
|
|
|
|
2021-10-18 02:50:44 +08:00
|
|
|
private IEnumerable<BeatmapCardStatistic> createStatistics()
|
|
|
|
{
|
2021-10-18 03:05:26 +08:00
|
|
|
if (beatmapSet.HypeStatus != null)
|
|
|
|
yield return new HypesStatistic(beatmapSet.HypeStatus);
|
|
|
|
|
2021-11-08 04:20:21 +08:00
|
|
|
// web does not show nominations unless hypes are also present.
|
|
|
|
// see: https://github.com/ppy/osu-web/blob/8ed7d071fd1d3eaa7e43cf0e4ff55ca2fef9c07c/resources/assets/lib/beatmapset-panel.tsx#L443
|
|
|
|
if (beatmapSet.HypeStatus != null && beatmapSet.NominationStatus != null)
|
2021-10-18 03:05:26 +08:00
|
|
|
yield return new NominationsStatistic(beatmapSet.NominationStatus);
|
|
|
|
|
2021-11-08 00:42:32 +08:00
|
|
|
yield return new FavouritesStatistic(beatmapSet) { Current = favouriteState };
|
2021-10-18 02:50:44 +08:00
|
|
|
yield return new PlayCountStatistic(beatmapSet);
|
|
|
|
|
|
|
|
var dateStatistic = BeatmapCardDateStatistic.CreateFor(beatmapSet);
|
|
|
|
if (dateStatistic != null)
|
|
|
|
yield return dateStatistic;
|
|
|
|
}
|
|
|
|
|
2021-10-18 00:59:31 +08:00
|
|
|
private void updateState()
|
|
|
|
{
|
2021-12-05 22:48:02 +08:00
|
|
|
bool showDetails = IsHovered || Expanded.Value;
|
|
|
|
|
2021-10-18 00:59:31 +08:00
|
|
|
float targetWidth = width - height;
|
2021-12-05 22:48:02 +08:00
|
|
|
if (showDetails)
|
2021-12-05 22:04:44 +08:00
|
|
|
targetWidth = targetWidth - icon_area_width + CORNER_RADIUS;
|
2021-10-18 00:59:31 +08:00
|
|
|
|
2021-12-05 22:48:02 +08:00
|
|
|
thumbnail.Dimmed.Value = showDetails;
|
2021-10-23 23:59:52 +08:00
|
|
|
|
2021-12-06 13:26:11 +08:00
|
|
|
// Scale value is intentionally chosen to fit in the spacing of listing displays, as to not overlap horizontally with adjacent cards.
|
|
|
|
// This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left.
|
|
|
|
content.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint);
|
|
|
|
|
2021-10-23 04:03:37 +08:00
|
|
|
mainContent.ResizeWidthTo(targetWidth, TRANSITION_DURATION, Easing.OutQuint);
|
2021-12-05 22:48:02 +08:00
|
|
|
mainContentBackground.Dimmed.Value = showDetails;
|
2021-10-18 00:59:31 +08:00
|
|
|
|
2021-12-05 22:48:02 +08:00
|
|
|
statisticsContainer.FadeTo(showDetails ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint);
|
2021-11-10 23:03:48 +08:00
|
|
|
|
2021-11-13 22:40:47 +08:00
|
|
|
rightAreaBackground.FadeColour(downloadTracker.State.Value == DownloadState.LocallyAvailable ? colours.Lime0 : colourProvider.Background3, TRANSITION_DURATION, Easing.OutQuint);
|
2021-12-05 22:48:02 +08:00
|
|
|
rightAreaButtons.FadeTo(showDetails ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint);
|
2021-11-19 05:28:17 +08:00
|
|
|
|
|
|
|
foreach (var button in rightAreaButtons)
|
|
|
|
{
|
|
|
|
button.IdleColour = downloadTracker.State.Value != DownloadState.LocallyAvailable ? colourProvider.Light1 : colourProvider.Background3;
|
|
|
|
button.HoverColour = downloadTracker.State.Value != DownloadState.LocallyAvailable ? colourProvider.Content1 : colourProvider.Foreground1;
|
|
|
|
}
|
|
|
|
|
2021-11-13 22:38:04 +08:00
|
|
|
bool showProgress = downloadTracker.State.Value == DownloadState.Downloading || downloadTracker.State.Value == DownloadState.Importing;
|
|
|
|
|
|
|
|
idleBottomContent.FadeTo(showProgress ? 0 : 1, TRANSITION_DURATION, Easing.OutQuint);
|
|
|
|
downloadProgressBar.FadeTo(showProgress ? 1 : 0, TRANSITION_DURATION, Easing.OutQuint);
|
2021-10-18 00:59:31 +08:00
|
|
|
}
|
2021-10-18 00:24:17 +08:00
|
|
|
}
|
|
|
|
}
|