1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 01:47:33 +08:00

Merge branch 'master' into osu-prefixed-text

This commit is contained in:
Dan Balasescu 2017-12-26 15:40:29 +09:00 committed by GitHub
commit d089e27cad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 311 additions and 112 deletions

View File

@ -70,6 +70,7 @@ namespace osu.Game.Tests.Visual
testRemoveAll(); testRemoveAll();
testEmptyTraversal(); testEmptyTraversal();
testHiding();
} }
private void ensureRandomFetchSuccess() => private void ensureRandomFetchSuccess() =>
@ -295,6 +296,40 @@ namespace osu.Game.Tests.Visual
checkNoSelection(); checkNoSelection();
} }
private void testHiding()
{
var hidingSet = createTestBeatmapSet(1);
hidingSet.Beatmaps[1].Hidden = true;
AddStep("Add set with diff 2 hidden", () => carousel.UpdateBeatmapSet(hidingSet));
setSelected(1, 1);
checkVisibleItemCount(true, 2);
advanceSelection(true);
checkSelected(1, 3);
setHidden(3);
checkSelected(1, 1);
setHidden(2, false);
advanceSelection(true);
checkSelected(1, 2);
setHidden(1);
checkSelected(1, 2);
setHidden(2);
checkNoSelection();
void setHidden(int diff, bool hidden = true)
{
AddStep((hidden ? "" : "un") + $"hide diff {diff}", () =>
{
hidingSet.Beatmaps[diff - 1].Hidden = hidden;
carousel.UpdateBeatmapSet(hidingSet);
});
}
}
private BeatmapSetInfo createTestBeatmapSet(int i) private BeatmapSetInfo createTestBeatmapSet(int i)
{ {
return new BeatmapSetInfo return new BeatmapSetInfo

View File

@ -4,6 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
@ -25,6 +26,12 @@ namespace osu.Game.Tests.Visual
Origin = Anchor.TopRight Origin = Anchor.TopRight
}); });
SpriteText displayedCount = new SpriteText();
Content.Add(displayedCount);
manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; };
AddStep(@"toggle", manager.ToggleVisibility); AddStep(@"toggle", manager.ToggleVisibility);
AddStep(@"simple #1", sendHelloNotification); AddStep(@"simple #1", sendHelloNotification);
AddStep(@"simple #2", sendAmazingNotification); AddStep(@"simple #2", sendAmazingNotification);

View File

@ -0,0 +1,39 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays.Toolbar;
namespace osu.Game.Tests.Visual
{
public class TestCaseToolbar : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ToolbarButton),
typeof(ToolbarModeSelector),
typeof(ToolbarModeButton),
typeof(ToolbarNotificationButton),
};
public TestCaseToolbar()
{
var toolbar = new Toolbar { State = Visibility.Visible };
Add(toolbar);
var notificationButton = toolbar.Children.OfType<FillFlowContainer>().Last().Children.OfType<ToolbarNotificationButton>().First();
void setNotifications(int count) => AddStep($"set notification count to {count}", () => notificationButton.NotificationCount.Value = count);
setNotifications(1);
setNotifications(2);
setNotifications(3);
setNotifications(0);
setNotifications(144);
}
}
}

View File

@ -13,6 +13,8 @@ namespace osu.Game.Tests.Visual
{ {
public class TestCaseUserProfile : OsuTestCase public class TestCaseUserProfile : OsuTestCase
{ {
private readonly TestUserProfileOverlay profile;
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(ProfileHeader), typeof(ProfileHeader),
@ -23,8 +25,12 @@ namespace osu.Game.Tests.Visual
public TestCaseUserProfile() public TestCaseUserProfile()
{ {
var profile = new UserProfileOverlay(); Add(profile = new TestUserProfileOverlay());
Add(profile); }
protected override void LoadComplete()
{
base.LoadComplete();
AddStep("Show offline dummy", () => profile.ShowUser(new User AddStep("Show offline dummy", () => profile.ShowUser(new User
{ {
@ -48,6 +54,9 @@ namespace osu.Game.Tests.Visual
Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray()
} }
}, false)); }, false));
checkSupporterTag(false);
AddStep("Show ppy", () => profile.ShowUser(new User AddStep("Show ppy", () => profile.ShowUser(new User
{ {
Username = @"peppy", Username = @"peppy",
@ -55,6 +64,9 @@ namespace osu.Game.Tests.Visual
Country = new Country { FullName = @"Australia", FlagName = @"AU" }, Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
})); }));
checkSupporterTag(true);
AddStep("Show flyte", () => profile.ShowUser(new User AddStep("Show flyte", () => profile.ShowUser(new User
{ {
Username = @"flyte", Username = @"flyte",
@ -62,8 +74,23 @@ namespace osu.Game.Tests.Visual
Country = new Country { FullName = @"Japan", FlagName = @"JP" }, Country = new Country { FullName = @"Japan", FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
})); }));
AddStep("Hide", profile.Hide); AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show); AddStep("Show without reload", profile.Show);
} }
private void checkSupporterTag(bool isSupporter)
{
AddUntilStep(() => profile.Header.User != null, "wait for load");
if (isSupporter)
AddAssert("is supporter", () => profile.Header.SupporterTag.Alpha == 1);
else
AddAssert("no supporter", () => profile.Header.SupporterTag.Alpha == 0);
}
private class TestUserProfileOverlay : UserProfileOverlay
{
public new ProfileHeader Header => base.Header;
}
} }
} }

View File

@ -148,6 +148,7 @@
<Compile Include="Visual\TestCaseStoryboard.cs" /> <Compile Include="Visual\TestCaseStoryboard.cs" />
<Compile Include="Visual\TestCaseTabControl.cs" /> <Compile Include="Visual\TestCaseTabControl.cs" />
<Compile Include="Visual\TestCaseTextAwesome.cs" /> <Compile Include="Visual\TestCaseTextAwesome.cs" />
<Compile Include="Visual\TestCaseToolbar.cs" />
<Compile Include="Visual\TestCaseTwoLayerButton.cs" /> <Compile Include="Visual\TestCaseTwoLayerButton.cs" />
<Compile Include="Visual\TestCaseUserPanel.cs" /> <Compile Include="Visual\TestCaseUserPanel.cs" />
<Compile Include="Visual\TestCaseUserProfile.cs" /> <Compile Include="Visual\TestCaseUserProfile.cs" />

View File

@ -272,7 +272,7 @@ namespace osu.Game
}; };
} }
Action<Visibility> stateChanged = delegate void updateScreenOffset()
{ {
float offset = 0; float offset = 0;
@ -281,11 +281,11 @@ namespace osu.Game
if (notifications.State == Visibility.Visible) if (notifications.State == Visibility.Visible)
offset -= ToolbarButton.WIDTH / 2; offset -= ToolbarButton.WIDTH / 2;
intro.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); screenStack.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint);
}; }
settings.StateChanged += stateChanged; settings.StateChanged += _ => updateScreenOffset();
notifications.StateChanged += stateChanged; notifications.StateChanged += _ => updateScreenOffset();
Cursor.State = Visibility.Hidden; Cursor.State = Visibility.Hidden;
} }

View File

@ -11,6 +11,7 @@ using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using System; using System;
using osu.Framework.Configuration;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -75,34 +76,38 @@ namespace osu.Game.Overlays
}; };
} }
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
public readonly BindableInt UnreadCount = new BindableInt();
private int runningDepth; private int runningDepth;
private void notificationClosed() private void notificationClosed()
{ {
// hide ourselves if all notifications have been dismissed. // hide ourselves if all notifications have been dismissed.
if (sections.Select(c => c.DisplayedCount).Sum() == 0) if (totalCount == 0)
State = Visibility.Hidden; State = Visibility.Hidden;
updateCounts();
} }
public void Post(Notification notification) public void Post(Notification notification) => Schedule(() =>
{ {
Schedule(() => ++runningDepth;
{ notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;
State = Visibility.Visible;
++runningDepth; notification.Closed += notificationClosed;
notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth;
notification.Closed += notificationClosed; var hasCompletionTarget = notification as IHasCompletionTarget;
if (hasCompletionTarget != null)
hasCompletionTarget.CompletionTarget = Post;
var hasCompletionTarget = notification as IHasCompletionTarget; var ourType = notification.GetType();
if (hasCompletionTarget != null) sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification);
hasCompletionTarget.CompletionTarget = Post;
var ourType = notification.GetType(); updateCounts();
sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification); });
});
}
protected override void PopIn() protected override void PopIn()
{ {
@ -122,9 +127,16 @@ namespace osu.Game.Overlays
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
} }
private void updateCounts()
{
UnreadCount.Value = unreadCount;
}
private void markAllRead() private void markAllRead()
{ {
sections.Children.ForEach(s => s.MarkAllRead()); sections.Children.ForEach(s => s.MarkAllRead());
updateCounts();
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()

View File

@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Notifications
public int DisplayedCount => notifications.Count(n => !n.WasClosed); public int DisplayedCount => notifications.Count(n => !n.WasClosed);
public int UnreadCount => notifications.Count(n => !n.WasClosed && !n.Read);
public void Add(Notification notification) => notifications.Add(notification); public void Add(Notification notification) => notifications.Add(notification);
public IEnumerable<Type> AcceptTypes; public IEnumerable<Type> AcceptTypes;
@ -157,4 +159,4 @@ namespace osu.Game.Overlays.Notifications
notifications?.Children.ForEach(n => n.Read = true); notifications?.Children.ForEach(n => n.Read = true);
} }
} }
} }

View File

@ -29,7 +29,8 @@ namespace osu.Game.Overlays.Profile
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText; private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
private readonly RankGraph rankGraph; private readonly RankGraph rankGraph;
private readonly Container coverContainer, supporterTag; public readonly SupporterIcon SupporterTag;
private readonly Container coverContainer;
private readonly Sprite levelBadge; private readonly Sprite levelBadge;
private readonly SpriteText levelText; private readonly SpriteText levelText;
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
@ -94,32 +95,13 @@ namespace osu.Game.Overlays.Profile
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
supporterTag = new CircularContainer SupporterTag = new SupporterIcon
{ {
Alpha = 0,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Y = -75, Y = -75,
Size = new Vector2(25, 25), Size = new Vector2(25, 25)
Masking = true,
BorderThickness = 3,
BorderColour = Color4.White,
Alpha = 0,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
},
new SpriteIcon
{
Icon = FontAwesome.fa_heart,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(12),
}
}
}, },
new LinkFlowContainer.ProfileLink(user) new LinkFlowContainer.ProfileLink(user)
{ {
@ -328,7 +310,8 @@ namespace osu.Game.Overlays.Profile
Depth = float.MaxValue, Depth = float.MaxValue,
}, coverContainer.Add); }, coverContainer.Add);
if (user.IsSupporter) supporterTag.Show(); if (user.IsSupporter)
SupporterTag.Show();
if (!string.IsNullOrEmpty(user.Colour)) if (!string.IsNullOrEmpty(user.Colour))
{ {

View File

@ -0,0 +1,61 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Overlays.Profile
{
public class SupporterIcon : CircularContainer
{
private readonly Box background;
public SupporterIcon()
{
Masking = true;
Children = new Drawable[]
{
new Box { RelativeSizeAxes = Axes.Both },
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.8f),
Masking = true,
Children = new Drawable[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
new Triangles
{
TriangleScale = 0.2f,
ColourLight = OsuColour.FromHex(@"ff7db7"),
ColourDark = OsuColour.FromHex(@"de5b95"),
RelativeSizeAxes = Axes.Both,
Velocity = 0.3f,
},
}
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_heart,
Scale = new Vector2(0.45f),
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Pink;
}
}
}

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
SetIcon(FontAwesome.fa_comments); SetIcon(FontAwesome.fa_comments);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(ChatOverlay chat) private void load(ChatOverlay chat)
{ {
StateContainer = chat; StateContainer = chat;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
SetIcon(FontAwesome.fa_osu_chevron_down_o); SetIcon(FontAwesome.fa_osu_chevron_down_o);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(DirectOverlay direct) private void load(DirectOverlay direct)
{ {
StateContainer = direct; StateContainer = direct;

View File

@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Toolbar
}; };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(RulesetStore rulesets, OsuGame game) private void load(RulesetStore rulesets, OsuGame game)
{ {
foreach (var r in rulesets.AvailableRulesets) foreach (var r in rulesets.AvailableRulesets)
@ -81,7 +81,10 @@ namespace osu.Game.Overlays.Toolbar
ruleset.ValueChanged += rulesetChanged; ruleset.ValueChanged += rulesetChanged;
ruleset.DisabledChanged += disabledChanged; ruleset.DisabledChanged += disabledChanged;
ruleset.BindTo(game.Ruleset); if (game != null)
ruleset.BindTo(game.Ruleset);
else
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
} }
public override bool HandleInput => !ruleset.Disabled; public override bool HandleInput => !ruleset.Disabled;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
Icon = FontAwesome.fa_music; Icon = FontAwesome.fa_music;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(MusicController music) private void load(MusicController music)
{ {
StateContainer = music; StateContainer = music;

View File

@ -2,8 +2,14 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
{ {
@ -11,17 +17,85 @@ namespace osu.Game.Overlays.Toolbar
{ {
protected override Anchor TooltipAnchor => Anchor.TopRight; protected override Anchor TooltipAnchor => Anchor.TopRight;
public BindableInt NotificationCount = new BindableInt();
private readonly CountCircle countDisplay;
public ToolbarNotificationButton() public ToolbarNotificationButton()
{ {
Icon = FontAwesome.fa_bars; Icon = FontAwesome.fa_bars;
TooltipMain = "Notifications"; TooltipMain = "Notifications";
TooltipSub = "Waiting for 'ya"; TooltipSub = "Waiting for 'ya";
Add(countDisplay = new CountCircle
{
Alpha = 0,
Height = 16,
RelativePositionAxes = Axes.Both,
Origin = Anchor.Centre,
Position = new Vector2(0.7f, 0.25f),
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(NotificationOverlay notificationOverlay) private void load(NotificationOverlay notificationOverlay)
{ {
StateContainer = notificationOverlay; StateContainer = notificationOverlay;
if (notificationOverlay != null)
NotificationCount.BindTo(notificationOverlay.UnreadCount);
NotificationCount.ValueChanged += count =>
{
if (count == 0)
countDisplay.FadeOut(200, Easing.OutQuint);
else
{
countDisplay.Count = count;
countDisplay.FadeIn(200, Easing.OutQuint);
}
};
}
private class CountCircle : CompositeDrawable
{
private readonly OsuSpriteText count;
private readonly Circle circle;
public int Count
{
set
{
count.Text = value.ToString("#,0");
circle.FlashColour(Color4.White, 600, Easing.OutQuint);
this.ScaleTo(1.1f).Then().ScaleTo(1, 600, Easing.OutElastic);
}
}
public CountCircle()
{
AutoSizeAxes = Axes.X;
InternalChildren = new Drawable[]
{
circle = new Circle
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Red
},
count = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Y = -1,
TextSize = 14,
Padding = new MarginPadding(5),
Colour = Color4.White,
UseFullGlyphHeight = true,
Font = "Exo2.0-Bold",
}
};
}
} }
} }
} }

View File

@ -21,8 +21,11 @@ namespace osu.Game.Overlays.Toolbar
set set
{ {
stateContainer = value; stateContainer = value;
Action = stateContainer.ToggleVisibility; if (stateContainer != null)
stateContainer.StateChanged += stateChanged; {
Action = stateContainer.ToggleVisibility;
stateContainer.StateChanged += stateChanged;
}
} }
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar
TooltipSub = "Change your settings"; TooltipSub = "Change your settings";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(SettingsOverlay settings) private void load(SettingsOverlay settings)
{ {
StateContainer = settings; StateContainer = settings;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
Icon = FontAwesome.fa_users; Icon = FontAwesome.fa_users;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(SocialOverlay chat) private void load(SocialOverlay chat)
{ {
StateContainer = chat; StateContainer = chat;

View File

@ -28,7 +28,7 @@ namespace osu.Game.Overlays
private ProfileSection[] sections; private ProfileSection[] sections;
private GetUserRequest userReq; private GetUserRequest userReq;
private APIAccess api; private APIAccess api;
private ProfileHeader header; protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer; private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileTabControl tabs; private ProfileTabControl tabs;
@ -113,12 +113,12 @@ namespace osu.Game.Overlays
Colour = OsuColour.Gray(0.2f) Colour = OsuColour.Gray(0.2f)
}); });
header = new ProfileHeader(user); Header = new ProfileHeader(user);
Add(sectionsContainer = new SectionsContainer<ProfileSection> Add(sectionsContainer = new SectionsContainer<ProfileSection>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ExpandableHeader = header, ExpandableHeader = Header,
FixedHeader = tabs, FixedHeader = tabs,
HeaderBackground = new Box HeaderBackground = new Box
{ {
@ -169,7 +169,7 @@ namespace osu.Game.Overlays
private void userLoadComplete(User user) private void userLoadComplete(User user)
{ {
header.User = user; Header.User = user;
foreach (string id in user.ProfileOrder) foreach (string id in user.ProfileOrder)
{ {

View File

@ -142,7 +142,6 @@ namespace osu.Game.Screens.Select
if (newSet == null) if (newSet == null)
{ {
itemsCache.Invalidate(); itemsCache.Invalidate();
SelectNext();
return; return;
} }
@ -512,7 +511,7 @@ namespace osu.Game.Screens.Select
currentY += DrawHeight / 2; currentY += DrawHeight / 2;
scrollableContent.Height = currentY; scrollableContent.Height = currentY;
if (selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) if (selectedBeatmapSet != null && (selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected))
{ {
selectedBeatmapSet = null; selectedBeatmapSet = null;
SelectionChanged?.Invoke(null); SelectionChanged?.Invoke(null);

View File

@ -16,8 +16,8 @@ using osu.Game.Overlays;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Overlays.Profile;
namespace osu.Game.Users namespace osu.Game.Users
{ {
@ -220,53 +220,5 @@ namespace osu.Game.Users
{ {
new OsuMenuItem("View Profile", MenuItemType.Highlighted, ViewProfile), new OsuMenuItem("View Profile", MenuItemType.Highlighted, ViewProfile),
}; };
private class SupporterIcon : CircularContainer
{
private readonly Box background;
public SupporterIcon()
{
Masking = true;
Children = new Drawable[]
{
new Box { RelativeSizeAxes = Axes.Both },
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.8f),
Masking = true,
Children = new Drawable[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
new Triangles
{
TriangleScale = 0.2f,
ColourLight = OsuColour.FromHex(@"ff7db7"),
ColourDark = OsuColour.FromHex(@"de5b95"),
RelativeSizeAxes = Axes.Both,
Velocity = 0.3f,
},
}
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_heart,
Scale = new Vector2(0.45f),
}
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Pink;
}
}
} }
} }

View File

@ -268,6 +268,7 @@
<Compile Include="Beatmaps\Formats\LegacyStoryboardDecoder.cs" /> <Compile Include="Beatmaps\Formats\LegacyStoryboardDecoder.cs" />
<Compile Include="Database\DatabaseContextFactory.cs" /> <Compile Include="Database\DatabaseContextFactory.cs" />
<Compile Include="Database\IHasPrimaryKey.cs" /> <Compile Include="Database\IHasPrimaryKey.cs" />
<Compile Include="Overlays\Profile\SupporterIcon.cs" />
<Compile Include="Overlays\Settings\DangerousSettingsButton.cs" /> <Compile Include="Overlays\Settings\DangerousSettingsButton.cs" />
<Compile Include="Graphics\UserInterface\HoverClickSounds.cs" /> <Compile Include="Graphics\UserInterface\HoverClickSounds.cs" />
<Compile Include="Graphics\UserInterface\HoverSounds.cs" /> <Compile Include="Graphics\UserInterface\HoverSounds.cs" />