mirror of
https://github.com/ppy/osu
synced 2024-12-26 17:02:59 +00:00
Add beatmap set online status and display it in direct panels and the beatmap set overlay.
This commit is contained in:
parent
c9276ce2b8
commit
eb374c5774
@ -52,6 +52,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
FavouriteCount = 356,
|
FavouriteCount = 356,
|
||||||
Submitted = new DateTime(2016, 2, 10),
|
Submitted = new DateTime(2016, 2, 10),
|
||||||
Ranked = new DateTime(2016, 6, 19),
|
Ranked = new DateTime(2016, 6, 19),
|
||||||
|
Status = BeatmapSetOnlineStatus.Ranked,
|
||||||
BPM = 236,
|
BPM = 236,
|
||||||
HasVideo = true,
|
HasVideo = true,
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Covers = new BeatmapSetOnlineCovers
|
||||||
@ -222,6 +223,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
FavouriteCount = 58,
|
FavouriteCount = 58,
|
||||||
Submitted = new DateTime(2016, 6, 11),
|
Submitted = new DateTime(2016, 6, 11),
|
||||||
Ranked = new DateTime(2016, 7, 12),
|
Ranked = new DateTime(2016, 7, 12),
|
||||||
|
Status = BeatmapSetOnlineStatus.Pending,
|
||||||
BPM = 160,
|
BPM = 160,
|
||||||
HasVideo = false,
|
HasVideo = false,
|
||||||
Covers = new BeatmapSetOnlineCovers
|
Covers = new BeatmapSetOnlineCovers
|
||||||
|
@ -26,6 +26,11 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTimeOffset? LastUpdated { get; set; }
|
public DateTimeOffset? LastUpdated { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The status of this beatmap set.
|
||||||
|
/// </summary>
|
||||||
|
public BeatmapSetOnlineStatus Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not this beatmap set has a background video.
|
/// Whether or not this beatmap set has a background video.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
17
osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs
Normal file
17
osu.Game/Beatmaps/BeatmapSetOnlineStatus.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public enum BeatmapSetOnlineStatus
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Graveyard = -2,
|
||||||
|
WIP = -1,
|
||||||
|
Pending = 0,
|
||||||
|
Ranked = 1,
|
||||||
|
Approved = 2,
|
||||||
|
Qualified = 3,
|
||||||
|
Loved = 4,
|
||||||
|
}
|
||||||
|
}
|
53
osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
Normal file
53
osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
|
{
|
||||||
|
public class BeatmapSetOnlineStatusPill : CircularContainer
|
||||||
|
{
|
||||||
|
private readonly OsuSpriteText statusText;
|
||||||
|
|
||||||
|
private BeatmapSetOnlineStatus status = BeatmapSetOnlineStatus.None;
|
||||||
|
public BeatmapSetOnlineStatus Status
|
||||||
|
{
|
||||||
|
get { return status; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
status = value;
|
||||||
|
|
||||||
|
statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
|
statusText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
|
TextSize = textSize,
|
||||||
|
Padding = textPadding,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
[JsonProperty(@"video")]
|
[JsonProperty(@"video")]
|
||||||
private bool hasVideo { get; set; }
|
private bool hasVideo { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty(@"status")]
|
||||||
|
private BeatmapSetOnlineStatus status { get; set; }
|
||||||
|
|
||||||
[JsonProperty(@"submitted_date")]
|
[JsonProperty(@"submitted_date")]
|
||||||
private DateTimeOffset submitted { get; set; }
|
private DateTimeOffset submitted { get; set; }
|
||||||
|
|
||||||
@ -60,6 +63,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
PlayCount = playCount,
|
PlayCount = playCount,
|
||||||
FavouriteCount = favouriteCount,
|
FavouriteCount = favouriteCount,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
|
Status = status,
|
||||||
HasVideo = hasVideo,
|
HasVideo = hasVideo,
|
||||||
Submitted = submitted,
|
Submitted = submitted,
|
||||||
Ranked = ranked,
|
Ranked = ranked,
|
||||||
|
@ -30,6 +30,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly FillFlowContainer videoButtons;
|
private readonly FillFlowContainer videoButtons;
|
||||||
private readonly AuthorInfo author;
|
private readonly AuthorInfo author;
|
||||||
private readonly Container downloadButtonsContainer;
|
private readonly Container downloadButtonsContainer;
|
||||||
|
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
||||||
public Details Details;
|
public Details Details;
|
||||||
|
|
||||||
private BeatmapManager beatmaps;
|
private BeatmapManager beatmaps;
|
||||||
@ -50,6 +51,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet;
|
Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = BeatmapSet;
|
||||||
title.Text = BeatmapSet.Metadata.Title;
|
title.Text = BeatmapSet.Metadata.Title;
|
||||||
artist.Text = BeatmapSet.Metadata.Artist;
|
artist.Text = BeatmapSet.Metadata.Artist;
|
||||||
|
onlineStatusPill.Status = BeatmapSet.OnlineInfo.Status;
|
||||||
|
|
||||||
downloadButtonsContainer.FadeIn();
|
downloadButtonsContainer.FadeIn();
|
||||||
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
|
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
|
||||||
@ -204,11 +206,23 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Details = new Details
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Margin = new MarginPadding { Right = BeatmapSetOverlay.X_PADDING },
|
Margin = new MarginPadding { Right = BeatmapSetOverlay.X_PADDING },
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(10),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
onlineStatusPill = new BeatmapSetOnlineStatusPill(14, new MarginPadding { Horizontal = 25, Vertical = 8 })
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
},
|
||||||
|
Details = new Details(),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,9 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Direct
|
namespace osu.Game.Overlays.Direct
|
||||||
{
|
{
|
||||||
@ -20,7 +22,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
private const float horizontal_padding = 10;
|
private const float horizontal_padding = 10;
|
||||||
private const float vertical_padding = 5;
|
private const float vertical_padding = 5;
|
||||||
|
|
||||||
private FillFlowContainer bottomPanel;
|
private FillFlowContainer bottomPanel, statusContainer;
|
||||||
private PlayButton playButton;
|
private PlayButton playButton;
|
||||||
private Box progressBar;
|
private Box progressBar;
|
||||||
|
|
||||||
@ -199,7 +201,37 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Size = new Vector2(30),
|
Size = new Vector2(30),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
|
statusContainer = new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Margin = new MarginPadding { Top = 5, Left = 5 },
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (SetInfo.OnlineInfo?.HasVideo ?? false)
|
||||||
|
{
|
||||||
|
statusContainer.Add(new IconPill(FontAwesome.fa_film));
|
||||||
|
}
|
||||||
|
|
||||||
|
statusContainer.Add(new BeatmapSetOnlineStatusPill(12, new MarginPadding { Horizontal = 10, Vertical = 5 })
|
||||||
|
{
|
||||||
|
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
statusContainer.FadeOut(120, Easing.InOutQuint);
|
||||||
|
|
||||||
|
return base.OnHover(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
|
||||||
|
statusContainer.FadeIn(120, Easing.InOutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
43
osu.Game/Overlays/Direct/IconPill.cs
Normal file
43
osu.Game/Overlays/Direct/IconPill.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Direct
|
||||||
|
{
|
||||||
|
public class IconPill : CircularContainer
|
||||||
|
{
|
||||||
|
public IconPill(FontAwesome icon)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Margin = new MarginPadding(5),
|
||||||
|
Child = new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Icon = icon,
|
||||||
|
Size = new Vector2(12),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -257,6 +257,7 @@
|
|||||||
<Compile Include="Beatmaps\BeatmapSetFileInfo.cs" />
|
<Compile Include="Beatmaps\BeatmapSetFileInfo.cs" />
|
||||||
<Compile Include="Beatmaps\BeatmapSetInfo.cs" />
|
<Compile Include="Beatmaps\BeatmapSetInfo.cs" />
|
||||||
<Compile Include="Beatmaps\BeatmapSetOnlineInfo.cs" />
|
<Compile Include="Beatmaps\BeatmapSetOnlineInfo.cs" />
|
||||||
|
<Compile Include="Beatmaps\BeatmapSetOnlineStatus.cs" />
|
||||||
<Compile Include="Beatmaps\BeatmapStatistic.cs" />
|
<Compile Include="Beatmaps\BeatmapStatistic.cs" />
|
||||||
<Compile Include="Beatmaps\BeatmapStore.cs" />
|
<Compile Include="Beatmaps\BeatmapStore.cs" />
|
||||||
<Compile Include="Beatmaps\ControlPoints\ControlPoint.cs" />
|
<Compile Include="Beatmaps\ControlPoints\ControlPoint.cs" />
|
||||||
@ -268,6 +269,7 @@
|
|||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
||||||
|
<Compile Include="Beatmaps\Drawables\BeatmapSetOnlineStatusPill.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\IHasComboColours.cs" />
|
<Compile Include="Beatmaps\Formats\IHasComboColours.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\IHasCustomColours.cs" />
|
<Compile Include="Beatmaps\Formats\IHasCustomColours.cs" />
|
||||||
<Compile Include="Beatmaps\Formats\JsonBeatmapDecoder.cs" />
|
<Compile Include="Beatmaps\Formats\JsonBeatmapDecoder.cs" />
|
||||||
@ -306,6 +308,7 @@
|
|||||||
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
<DependentUpon>20180125143340_Settings.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Migrations\20180131154205_AddMuteBinding.cs" />
|
<Compile Include="Migrations\20180131154205_AddMuteBinding.cs" />
|
||||||
|
<Compile Include="Overlays\Direct\IconPill.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\Recent\DrawableRecentActivity.cs" />
|
<Compile Include="Overlays\Profile\Sections\Recent\DrawableRecentActivity.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\Recent\MedalIcon.cs" />
|
<Compile Include="Overlays\Profile\Sections\Recent\MedalIcon.cs" />
|
||||||
<Compile Include="Overlays\Profile\Sections\Recent\PaginatedRecentActivityContainer.cs" />
|
<Compile Include="Overlays\Profile\Sections\Recent\PaginatedRecentActivityContainer.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user