1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 08:13:10 +08:00

Merge branch 'master' into add-info-wedge-icons

This commit is contained in:
Dean Herbert 2020-09-03 21:57:58 +09:00
commit a99e7a1dc2
65 changed files with 324 additions and 523 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.903.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.903.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.903.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual.Online
[TestFixture] [TestFixture]
public class TestSceneFullscreenOverlay : OsuTestScene public class TestSceneFullscreenOverlay : OsuTestScene
{ {
private FullscreenOverlay overlay; private FullscreenOverlay<OverlayHeader> overlay;
protected override void LoadComplete() protected override void LoadComplete()
{ {
@ -38,10 +38,10 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("fire count 3", () => fireCount == 3); AddAssert("fire count 3", () => fireCount == 3);
} }
private class TestFullscreenOverlay : FullscreenOverlay private class TestFullscreenOverlay : FullscreenOverlay<OverlayHeader>
{ {
public TestFullscreenOverlay() public TestFullscreenOverlay()
: base(OverlayColourScheme.Pink) : base(OverlayColourScheme.Pink, null)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -5,9 +5,9 @@ using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards; using osu.Game.Online.Leaderboards;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Leaderboards;
@ -53,53 +53,46 @@ namespace osu.Game.Tests.Visual.SongSelect
private void showPersonalBestWithNullPosition() private void showPersonalBestWithNullPosition()
{ {
leaderboard.TopScore = new APILegacyUserTopScoreInfo leaderboard.TopScore = new ScoreInfo
{ {
Position = null, Rank = ScoreRank.XH,
Score = new APILegacyScoreInfo Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock() },
User = new User
{ {
Rank = ScoreRank.XH, Id = 6602580,
Accuracy = 1, Username = @"waaiiru",
MaxCombo = 244, Country = new Country
TotalScore = 1707827,
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
User = new User
{ {
Id = 6602580, FullName = @"Spain",
Username = @"waaiiru", FlagName = @"ES",
Country = new Country
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
} },
}; };
} }
private void showPersonalBest() private void showPersonalBest()
{ {
leaderboard.TopScore = new APILegacyUserTopScoreInfo leaderboard.TopScore = new ScoreInfo
{ {
Position = 999, Position = 999,
Score = new APILegacyScoreInfo Rank = ScoreRank.XH,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{ {
Rank = ScoreRank.XH, Id = 6602580,
Accuracy = 1, Username = @"waaiiru",
MaxCombo = 244, Country = new Country
TotalScore = 1707827,
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
User = new User
{ {
Id = 6602580, FullName = @"Spain",
Username = @"waaiiru", FlagName = @"ES",
Country = new Country
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
} },
}; };
} }

View File

@ -6,11 +6,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Tests.Visual.SongSelect namespace osu.Game.Tests.Visual.SongSelect
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.SongSelect
public TestSceneUserTopScoreContainer() public TestSceneUserTopScoreContainer()
{ {
UserTopScoreContainer topScoreContainer; UserTopScoreContainer<ScoreInfo> topScoreContainer;
Add(dialogOverlay = new DialogOverlay Add(dialogOverlay = new DialogOverlay
{ {
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.SongSelect
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.DarkGreen, Colour = Color4.DarkGreen,
}, },
topScoreContainer = new UserTopScoreContainer topScoreContainer = new UserTopScoreContainer<ScoreInfo>(s => new LeaderboardScore(s, s.Position, false))
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
@ -52,69 +52,60 @@ namespace osu.Game.Tests.Visual.SongSelect
var scores = new[] var scores = new[]
{ {
new APILegacyUserTopScoreInfo new ScoreInfo
{ {
Position = 999, Position = 999,
Score = new APILegacyScoreInfo Rank = ScoreRank.XH,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{ {
Rank = ScoreRank.XH, Id = 6602580,
Accuracy = 1, Username = @"waaiiru",
MaxCombo = 244, Country = new Country
TotalScore = 1707827,
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
User = new User
{ {
Id = 6602580, FullName = @"Spain",
Username = @"waaiiru", FlagName = @"ES",
Country = new Country
{
FullName = @"Spain",
FlagName = @"ES",
},
}, },
} },
}, },
new APILegacyUserTopScoreInfo new ScoreInfo
{ {
Position = 110000, Position = 110000,
Score = new APILegacyScoreInfo Rank = ScoreRank.X,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
User = new User
{ {
Rank = ScoreRank.X, Id = 4608074,
Accuracy = 1, Username = @"Skycries",
MaxCombo = 244, Country = new Country
TotalScore = 1707827,
User = new User
{ {
Id = 4608074, FullName = @"Brazil",
Username = @"Skycries", FlagName = @"BR",
Country = new Country
{
FullName = @"Brazil",
FlagName = @"BR",
},
}, },
} },
}, },
new APILegacyUserTopScoreInfo new ScoreInfo
{ {
Position = 22333, Position = 22333,
Score = new APILegacyScoreInfo Rank = ScoreRank.S,
Accuracy = 1,
MaxCombo = 244,
TotalScore = 1707827,
User = new User
{ {
Rank = ScoreRank.S, Id = 1541390,
Accuracy = 1, Username = @"Toukai",
MaxCombo = 244, Country = new Country
TotalScore = 1707827,
User = new User
{ {
Id = 1541390, FullName = @"Canada",
Username = @"Toukai", FlagName = @"CA",
Country = new Country
{
FullName = @"Canada",
FlagName = @"CA",
},
}, },
} },
} }
}; };

View File

@ -26,8 +26,11 @@ namespace osu.Game.Graphics.Containers
{ {
if (value == expandableHeader) return; if (value == expandableHeader) return;
expandableHeader?.Expire(); if (expandableHeader != null)
RemoveInternal(expandableHeader);
expandableHeader = value; expandableHeader = value;
if (value == null) return; if (value == null) return;
AddInternal(expandableHeader); AddInternal(expandableHeader);

View File

@ -3,6 +3,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Game.Rulesets;
using osu.Game.Scoring;
namespace osu.Game.Online.API.Requests.Responses namespace osu.Game.Online.API.Requests.Responses
{ {
@ -22,5 +24,12 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"score")] [JsonProperty(@"score")]
public APILegacyScoreInfo Score; public APILegacyScoreInfo Score;
public ScoreInfo CreateScoreInfo(RulesetStore rulesets)
{
var score = Score.CreateScoreInfo(rulesets);
score.Position = Position;
return score;
}
} }
} }

View File

@ -33,6 +33,9 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty("user")] [JsonProperty("user")]
public User User { get; set; } public User User { get; set; }
[JsonProperty("position")]
public int? Position { get; set; }
public ScoreInfo CreateScoreInfo() => public ScoreInfo CreateScoreInfo() =>
new ScoreInfo new ScoreInfo
{ {
@ -40,6 +43,7 @@ namespace osu.Game.Online.API.Requests.Responses
PP = PP, PP = PP,
TotalScore = TotalScore, TotalScore = TotalScore,
User = User, User = User,
Position = Position
}; };
} }
} }

View File

@ -27,6 +27,7 @@ namespace osu.Game.Online.Leaderboards
private readonly OsuScrollContainer scrollContainer; private readonly OsuScrollContainer scrollContainer;
private readonly Container placeholderContainer; private readonly Container placeholderContainer;
private readonly UserTopScoreContainer<TScoreInfo> topScoreContainer;
private FillFlowContainer<LeaderboardScore> scrollFlow; private FillFlowContainer<LeaderboardScore> scrollFlow;
@ -87,6 +88,20 @@ namespace osu.Game.Online.Leaderboards
} }
} }
public TScoreInfo TopScore
{
get => topScoreContainer.Score.Value;
set
{
topScoreContainer.Score.Value = value;
if (value == null)
topScoreContainer.Hide();
else
topScoreContainer.Show();
}
}
protected virtual FillFlowContainer<LeaderboardScore> CreateScoreFlow() protected virtual FillFlowContainer<LeaderboardScore> CreateScoreFlow()
=> new FillFlowContainer<LeaderboardScore> => new FillFlowContainer<LeaderboardScore>
{ {
@ -198,8 +213,9 @@ namespace osu.Game.Online.Leaderboards
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Child = topScoreContainer = new UserTopScoreContainer<TScoreInfo>(CreateDrawableTopScore)
}, },
} },
}, },
}, },
}, },
@ -367,5 +383,7 @@ namespace osu.Game.Online.Leaderboards
} }
protected abstract LeaderboardScore CreateDrawableScore(TScoreInfo model, int index); protected abstract LeaderboardScore CreateDrawableScore(TScoreInfo model, int index);
protected abstract LeaderboardScore CreateDrawableTopScore(TScoreInfo model);
} }
} }

View File

@ -9,31 +9,29 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Scoring;
using osuTK; using osuTK;
namespace osu.Game.Screens.Select.Leaderboards namespace osu.Game.Online.Leaderboards
{ {
public class UserTopScoreContainer : VisibilityContainer public class UserTopScoreContainer<TScoreInfo> : VisibilityContainer
{ {
private const int duration = 500; private const int duration = 500;
public Bindable<TScoreInfo> Score = new Bindable<TScoreInfo>();
private readonly Container scoreContainer; private readonly Container scoreContainer;
private readonly Func<TScoreInfo, LeaderboardScore> createScoreDelegate;
public Bindable<APILegacyUserTopScoreInfo> Score = new Bindable<APILegacyUserTopScoreInfo>();
public Action<ScoreInfo> ScoreSelected;
protected override bool StartHidden => true; protected override bool StartHidden => true;
[Resolved] [Resolved]
private RulesetStore rulesets { get; set; } private RulesetStore rulesets { get; set; }
public UserTopScoreContainer() public UserTopScoreContainer(Func<TScoreInfo, LeaderboardScore> createScoreDelegate)
{ {
this.createScoreDelegate = createScoreDelegate;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
@ -72,7 +70,7 @@ namespace osu.Game.Screens.Select.Leaderboards
private CancellationTokenSource loadScoreCancellation; private CancellationTokenSource loadScoreCancellation;
private void onScoreChanged(ValueChangedEvent<APILegacyUserTopScoreInfo> score) private void onScoreChanged(ValueChangedEvent<TScoreInfo> score)
{ {
var newScore = score.NewValue; var newScore = score.NewValue;
@ -82,12 +80,7 @@ namespace osu.Game.Screens.Select.Leaderboards
if (newScore == null) if (newScore == null)
return; return;
var scoreInfo = newScore.Score.CreateScoreInfo(rulesets); LoadComponentAsync(createScoreDelegate(newScore), drawableScore =>
LoadComponentAsync(new LeaderboardScore(scoreInfo, newScore.Position, false)
{
Action = () => ScoreSelected?.Invoke(scoreInfo)
}, drawableScore =>
{ {
scoreContainer.Child = drawableScore; scoreContainer.Child = drawableScore;
drawableScore.FadeInFromZero(duration, Easing.OutQuint); drawableScore.FadeInFromZero(duration, Easing.OutQuint);

View File

@ -0,0 +1,18 @@
// 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 System.Collections.Generic;
using Newtonsoft.Json;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.Multiplayer
{
public class APILeaderboard
{
[JsonProperty("leaderboard")]
public List<APIUserScoreAggregate> Leaderboard;
[JsonProperty("user_score")]
public APIUserScoreAggregate UserScore;
}
}

View File

@ -1,17 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.Multiplayer namespace osu.Game.Online.Multiplayer
{ {
public class GetRoomScoresRequest : APIRequest<List<APIUserScoreAggregate>> public class GetRoomLeaderboardRequest : APIRequest<APILeaderboard>
{ {
private readonly int roomId; private readonly int roomId;
public GetRoomScoresRequest(int roomId) public GetRoomLeaderboardRequest(int roomId)
{ {
this.roomId = roomId; this.roomId = roomId;
} }

View File

@ -698,9 +698,9 @@ namespace osu.Game
float offset = 0; float offset = 0;
if (Settings.State.Value == Visibility.Visible) if (Settings.State.Value == Visibility.Visible)
offset += ToolbarButton.WIDTH / 2; offset += Toolbar.HEIGHT / 2;
if (notifications.State.Value == Visibility.Visible) if (notifications.State.Value == Visibility.Visible)
offset -= ToolbarButton.WIDTH / 2; offset -= Toolbar.HEIGHT / 2;
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint); screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
} }

View File

@ -12,7 +12,8 @@ namespace osu.Game.Overlays.BeatmapListing
public BeatmapListingTitle() public BeatmapListingTitle()
{ {
Title = "beatmap listing"; Title = "beatmap listing";
IconTexture = "Icons/changelog"; Description = "Browse for new beatmaps";
IconTexture = "Icons/Hexacons/beatmap";
} }
} }
} }

View File

@ -24,7 +24,7 @@ using osuTK;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class BeatmapListingOverlay : FullscreenOverlay public class BeatmapListingOverlay : FullscreenOverlay<BeatmapListingHeader>
{ {
[Resolved] [Resolved]
private PreviewTrackManager previewTrackManager { get; set; } private PreviewTrackManager previewTrackManager { get; set; }
@ -38,7 +38,7 @@ namespace osu.Game.Overlays
private OverlayScrollContainer resultScrollContainer; private OverlayScrollContainer resultScrollContainer;
public BeatmapListingOverlay() public BeatmapListingOverlay()
: base(OverlayColourScheme.Blue) : base(OverlayColourScheme.Blue, new BeatmapListingHeader())
{ {
} }
@ -65,7 +65,7 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new BeatmapListingHeader(), Header,
filterControl = new BeatmapListingFilterControl filterControl = new BeatmapListingFilterControl
{ {
SearchStarted = onSearchStarted, SearchStarted = onSearchStarted,

View File

@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet
public BeatmapHeaderTitle() public BeatmapHeaderTitle()
{ {
Title = "beatmap info"; Title = "beatmap info";
IconTexture = "Icons/changelog"; IconTexture = "Icons/Hexacons/beatmap";
} }
} }
} }

View File

@ -19,12 +19,14 @@ using osuTK;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class BeatmapSetOverlay : FullscreenOverlay public class BeatmapSetOverlay : FullscreenOverlay<OverlayHeader> // we don't provide a standard header for now.
{ {
public const float X_PADDING = 40; public const float X_PADDING = 40;
public const float Y_PADDING = 25; public const float Y_PADDING = 25;
public const float RIGHT_WIDTH = 275; public const float RIGHT_WIDTH = 275;
protected readonly Header Header;
//todo: should be an OverlayHeader? or maybe not?
protected new readonly Header Header;
[Resolved] [Resolved]
private RulesetStore rulesets { get; set; } private RulesetStore rulesets { get; set; }
@ -37,7 +39,7 @@ namespace osu.Game.Overlays
private readonly Box background; private readonly Box background;
public BeatmapSetOverlay() public BeatmapSetOverlay()
: base(OverlayColourScheme.Blue) : base(OverlayColourScheme.Blue, null)
{ {
OverlayScrollContainer scroll; OverlayScrollContainer scroll;
Info info; Info info;

View File

@ -115,7 +115,8 @@ namespace osu.Game.Overlays.Changelog
public ChangelogHeaderTitle() public ChangelogHeaderTitle()
{ {
Title = "changelog"; Title = "changelog";
IconTexture = "Icons/changelog"; Description = "Track recent dev updates in the osu! ecosystem";
IconTexture = "Icons/Hexacons/devtools";
} }
} }
} }

View File

@ -21,12 +21,10 @@ using osu.Game.Overlays.Changelog;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class ChangelogOverlay : FullscreenOverlay public class ChangelogOverlay : FullscreenOverlay<ChangelogHeader>
{ {
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>(); public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
protected ChangelogHeader Header;
private Container<ChangelogContent> content; private Container<ChangelogContent> content;
private SampleChannel sampleBack; private SampleChannel sampleBack;
@ -36,7 +34,7 @@ namespace osu.Game.Overlays
protected List<APIUpdateStream> Streams; protected List<APIUpdateStream> Streams;
public ChangelogOverlay() public ChangelogOverlay()
: base(OverlayColourScheme.Purple) : base(OverlayColourScheme.Purple, new ChangelogHeader())
{ {
} }
@ -61,10 +59,11 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
Header = new ChangelogHeader Header.With(h =>
{ {
ListingSelected = ShowListing, h.ListingSelected = ShowListing;
}, h.Build.BindTarget = Current;
}),
content = new Container<ChangelogContent> content = new Container<ChangelogContent>
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -77,8 +76,6 @@ namespace osu.Game.Overlays
sampleBack = audio.Samples.Get(@"UI/generic-select-soft"); sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
Header.Build.BindTo(Current);
Current.BindValueChanged(e => Current.BindValueChanged(e =>
{ {
if (e.NewValue != null) if (e.NewValue != null)

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Chat.Selection
{ {
public class ChannelSelectionOverlay : WaveOverlayContainer public class ChannelSelectionOverlay : WaveOverlayContainer
{ {
public const float WIDTH_PADDING = 170; public new const float WIDTH_PADDING = 170;
private const float transition_duration = 500; private const float transition_duration = 500;

View File

@ -26,8 +26,12 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class ChatOverlay : OsuFocusedOverlayContainer public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
{ {
public string IconTexture => "Icons/Hexacons/messaging";
public string Title => "chat";
public string Description => "Join the real-time discussion";
private const float textbox_height = 60; private const float textbox_height = 60;
private const float channel_selection_min_height = 0.3f; private const float channel_selection_min_height = 0.3f;

View File

@ -12,7 +12,8 @@ namespace osu.Game.Overlays.Dashboard
public DashboardTitle() public DashboardTitle()
{ {
Title = "dashboard"; Title = "dashboard";
IconTexture = "Icons/changelog"; Description = "View your friends and other information";
IconTexture = "Icons/Hexacons/social";
} }
} }
} }

View File

@ -15,17 +15,21 @@ using osu.Game.Overlays.Dashboard.Friends;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class DashboardOverlay : FullscreenOverlay public class DashboardOverlay : FullscreenOverlay<DashboardOverlayHeader>
{ {
private CancellationTokenSource cancellationToken; private CancellationTokenSource cancellationToken;
private Container content; private Container content;
private DashboardOverlayHeader header;
private LoadingLayer loading; private LoadingLayer loading;
private OverlayScrollContainer scrollFlow; private OverlayScrollContainer scrollFlow;
public DashboardOverlay() public DashboardOverlay()
: base(OverlayColourScheme.Purple) : base(OverlayColourScheme.Purple, new DashboardOverlayHeader
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Depth = -float.MaxValue
})
{ {
} }
@ -50,12 +54,7 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
header = new DashboardOverlayHeader Header,
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Depth = -float.MaxValue
},
content = new Container content = new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -72,7 +71,7 @@ namespace osu.Game.Overlays
{ {
base.LoadComplete(); base.LoadComplete();
header.Current.BindValueChanged(onTabChanged); Header.Current.BindValueChanged(onTabChanged);
} }
private bool displayUpdateRequired = true; private bool displayUpdateRequired = true;
@ -84,7 +83,7 @@ namespace osu.Game.Overlays
// We don't want to create a new display on every call, only when exiting from fully closed state. // We don't want to create a new display on every call, only when exiting from fully closed state.
if (displayUpdateRequired) if (displayUpdateRequired)
{ {
header.Current.TriggerChange(); Header.Current.TriggerChange();
displayUpdateRequired = false; displayUpdateRequired = false;
} }
} }
@ -136,7 +135,7 @@ namespace osu.Game.Overlays
if (State.Value == Visibility.Hidden) if (State.Value == Visibility.Hidden)
return; return;
header.Current.TriggerChange(); Header.Current.TriggerChange();
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)

View File

@ -12,16 +12,25 @@ using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public abstract class FullscreenOverlay : WaveOverlayContainer, IOnlineComponent public abstract class FullscreenOverlay<T> : WaveOverlayContainer, IOnlineComponent, INamedOverlayComponent
where T : OverlayHeader
{ {
public virtual string IconTexture => Header?.Title.IconTexture ?? string.Empty;
public virtual string Title => Header?.Title.Title ?? string.Empty;
public virtual string Description => Header?.Title.Description ?? string.Empty;
public T Header { get; }
[Resolved] [Resolved]
protected IAPIProvider API { get; private set; } protected IAPIProvider API { get; private set; }
[Cached] [Cached]
protected readonly OverlayColourProvider ColourProvider; protected readonly OverlayColourProvider ColourProvider;
protected FullscreenOverlay(OverlayColourScheme colourScheme) protected FullscreenOverlay(OverlayColourScheme colourScheme, T header)
{ {
Header = header;
ColourProvider = new OverlayColourProvider(colourScheme); ColourProvider = new OverlayColourProvider(colourScheme);
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;

View File

@ -0,0 +1,14 @@
// 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.
namespace osu.Game.Overlays
{
public interface INamedOverlayComponent
{
string IconTexture { get; }
string Title { get; }
string Description { get; }
}
}

View File

@ -57,7 +57,8 @@ namespace osu.Game.Overlays.News
public NewsHeaderTitle() public NewsHeaderTitle()
{ {
Title = "news"; Title = "news";
IconTexture = "Icons/news"; Description = "Get up-to-date on community happenings";
IconTexture = "Icons/Hexacons/news";
} }
} }
} }

View File

@ -13,17 +13,16 @@ using osu.Game.Overlays.News.Displays;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class NewsOverlay : FullscreenOverlay public class NewsOverlay : FullscreenOverlay<NewsHeader>
{ {
private readonly Bindable<string> article = new Bindable<string>(null); private readonly Bindable<string> article = new Bindable<string>(null);
private Container content; private Container content;
private LoadingLayer loading; private LoadingLayer loading;
private NewsHeader header;
private OverlayScrollContainer scrollFlow; private OverlayScrollContainer scrollFlow;
public NewsOverlay() public NewsOverlay()
: base(OverlayColourScheme.Purple) : base(OverlayColourScheme.Purple, new NewsHeader())
{ {
} }
@ -48,10 +47,10 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
header = new NewsHeader Header.With(h =>
{ {
ShowFrontPage = ShowFrontPage h.ShowFrontPage = ShowFrontPage;
}, }),
content = new Container content = new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -112,12 +111,12 @@ namespace osu.Game.Overlays
if (e.NewValue == null) if (e.NewValue == null)
{ {
header.SetFrontPage(); Header.SetFrontPage();
LoadDisplay(new FrontPageDisplay()); LoadDisplay(new FrontPageDisplay());
return; return;
} }
header.SetArticle(e.NewValue); Header.SetArticle(e.NewValue);
LoadDisplay(Empty()); LoadDisplay(Empty());
} }

View File

@ -16,8 +16,12 @@ using osu.Framework.Threading;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class NotificationOverlay : OsuFocusedOverlayContainer public class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
{ {
public string IconTexture => "Icons/Hexacons/notification";
public string Title => "Notifications";
public string Description => "Waiting for 'ya";
private const float width = 320; private const float width = 320;
public const float TRANSITION_LENGTH = 600; public const float TRANSITION_LENGTH = 600;

View File

@ -25,8 +25,12 @@ using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class NowPlayingOverlay : OsuFocusedOverlayContainer public class NowPlayingOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
{ {
public string IconTexture => "Icons/Hexacons/music";
public string Title => "now playing";
public string Description => "Manage the currently playing track";
private const float player_height = 130; private const float player_height = 130;
private const float transition_length = 800; private const float transition_length = 800;
private const float progress_height = 10; private const float progress_height = 10;

View File

@ -12,6 +12,8 @@ namespace osu.Game.Overlays
{ {
public abstract class OverlayHeader : Container public abstract class OverlayHeader : Container
{ {
public OverlayTitle Title { get; }
private float contentSidePadding; private float contentSidePadding;
/// <summary> /// <summary>
@ -73,7 +75,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new[] Children = new[]
{ {
CreateTitle().With(title => Title = CreateTitle().With(title =>
{ {
title.Anchor = Anchor.CentreLeft; title.Anchor = Anchor.CentreLeft;
title.Origin = Anchor.CentreLeft; title.Origin = Anchor.CentreLeft;

View File

@ -17,7 +17,7 @@ using osuTK.Graphics;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
/// <summary> /// <summary>
/// <see cref="OsuScrollContainer"/> which provides <see cref="ScrollToTopButton"/>. Mostly used in <see cref="FullscreenOverlay"/>. /// <see cref="OsuScrollContainer"/> which provides <see cref="ScrollToTopButton"/>. Mostly used in <see cref="FullscreenOverlay{T}"/>.
/// </summary> /// </summary>
public class OverlayScrollContainer : OsuScrollContainer public class OverlayScrollContainer : OsuScrollContainer
{ {

View File

@ -12,19 +12,27 @@ using osuTK;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public abstract class OverlayTitle : CompositeDrawable public abstract class OverlayTitle : CompositeDrawable, INamedOverlayComponent
{ {
private readonly OsuSpriteText title; private readonly OsuSpriteText titleText;
private readonly Container icon; private readonly Container icon;
protected string Title private string title;
public string Title
{ {
set => title.Text = value; get => title;
protected set => titleText.Text = title = value;
} }
protected string IconTexture public string Description { get; protected set; }
private string iconTexture;
public string IconTexture
{ {
set => icon.Child = new OverlayTitleIcon(value); get => iconTexture;
protected set => icon.Child = new OverlayTitleIcon(iconTexture = value);
} }
protected OverlayTitle() protected OverlayTitle()
@ -45,7 +53,7 @@ namespace osu.Game.Overlays
Margin = new MarginPadding { Horizontal = 5 }, // compensates for osu-web sprites having around 5px of whitespace on each side Margin = new MarginPadding { Horizontal = 5 }, // compensates for osu-web sprites having around 5px of whitespace on each side
Size = new Vector2(30) Size = new Vector2(30)
}, },
title = new OsuSpriteText titleText = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -9,7 +9,7 @@ using osu.Game.Online.API;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
/// <summary> /// <summary>
/// A subview containing online content, to be displayed inside a <see cref="FullscreenOverlay"/>. /// A subview containing online content, to be displayed inside a <see cref="FullscreenOverlay{T}"/>.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Automatically performs a data fetch on load. /// Automatically performs a data fetch on load.

View File

@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Profile
public ProfileHeaderTitle() public ProfileHeaderTitle()
{ {
Title = "player info"; Title = "player info";
IconTexture = "Icons/profile"; IconTexture = "Icons/Hexacons/profile";
} }
} }

View File

@ -30,7 +30,8 @@ namespace osu.Game.Overlays.Rankings
public RankingsTitle() public RankingsTitle()
{ {
Title = "ranking"; Title = "ranking";
IconTexture = "Icons/rankings"; Description = "Find out who's the best right now";
IconTexture = "Icons/Hexacons/rankings";
} }
} }
} }

View File

@ -17,17 +17,16 @@ using osu.Game.Overlays.Rankings.Tables;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class RankingsOverlay : FullscreenOverlay public class RankingsOverlay : FullscreenOverlay<RankingsOverlayHeader>
{ {
protected Bindable<Country> Country => header.Country; protected Bindable<Country> Country => Header.Country;
protected Bindable<RankingsScope> Scope => header.Current; protected Bindable<RankingsScope> Scope => Header.Current;
private readonly OverlayScrollContainer scrollFlow; private readonly OverlayScrollContainer scrollFlow;
private readonly Container contentContainer; private readonly Container contentContainer;
private readonly LoadingLayer loading; private readonly LoadingLayer loading;
private readonly Box background; private readonly Box background;
private readonly RankingsOverlayHeader header;
private APIRequest lastRequest; private APIRequest lastRequest;
private CancellationTokenSource cancellationToken; private CancellationTokenSource cancellationToken;
@ -36,7 +35,12 @@ namespace osu.Game.Overlays
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
public RankingsOverlay() public RankingsOverlay()
: base(OverlayColourScheme.Green) : base(OverlayColourScheme.Green, new RankingsOverlayHeader
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Depth = -float.MaxValue
})
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
@ -55,12 +59,7 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
header = new RankingsOverlayHeader Header,
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Depth = -float.MaxValue
},
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -97,7 +96,7 @@ namespace osu.Game.Overlays
{ {
base.LoadComplete(); base.LoadComplete();
header.Ruleset.BindTo(ruleset); Header.Ruleset.BindTo(ruleset);
Country.BindValueChanged(_ => Country.BindValueChanged(_ =>
{ {

View File

@ -36,7 +36,7 @@ namespace osu.Game.Overlays.SearchableList
/// <summary> /// <summary>
/// The amount of padding added to content (does not affect background or tab control strip). /// The amount of padding added to content (does not affect background or tab control strip).
/// </summary> /// </summary>
protected virtual float ContentHorizontalPadding => SearchableListOverlay.WIDTH_PADDING; protected virtual float ContentHorizontalPadding => WaveOverlayContainer.WIDTH_PADDING;
protected SearchableListFilterControl() protected SearchableListFilterControl()
{ {

View File

@ -1,82 +0,0 @@
// 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 System;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.SearchableList
{
public abstract class SearchableListHeader<T> : Container
where T : struct, Enum
{
public readonly HeaderTabControl<T> Tabs;
protected abstract Color4 BackgroundColour { get; }
protected abstract T DefaultTab { get; }
protected abstract Drawable CreateHeaderText();
protected abstract IconUsage Icon { get; }
protected SearchableListHeader()
{
RelativeSizeAxes = Axes.X;
Height = 90;
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = BackgroundColour,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING },
Children = new Drawable[]
{
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomLeft,
Position = new Vector2(-35f, 5f),
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10f, 0f),
Children = new[]
{
new SpriteIcon
{
Size = new Vector2(25),
Icon = Icon,
},
CreateHeaderText(),
},
},
Tabs = new HeaderTabControl<T>
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
},
},
},
};
Tabs.Current.Value = DefaultTab;
Tabs.Current.TriggerChange();
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Tabs.StripColour = colours.Green;
}
}
}

View File

@ -1,128 +0,0 @@
// 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 System;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Cursor;
namespace osu.Game.Overlays.SearchableList
{
public abstract class SearchableListOverlay : FullscreenOverlay
{
public const float WIDTH_PADDING = 80;
protected SearchableListOverlay(OverlayColourScheme colourScheme)
: base(colourScheme)
{
}
}
public abstract class SearchableListOverlay<THeader, TTab, TCategory> : SearchableListOverlay
where THeader : struct, Enum
where TTab : struct, Enum
where TCategory : struct, Enum
{
private readonly Container scrollContainer;
protected readonly SearchableListHeader<THeader> Header;
protected readonly SearchableListFilterControl<TTab, TCategory> Filter;
protected readonly FillFlowContainer ScrollFlow;
protected abstract Color4 BackgroundColour { get; }
protected abstract Color4 TrianglesColourLight { get; }
protected abstract Color4 TrianglesColourDark { get; }
protected abstract SearchableListHeader<THeader> CreateHeader();
protected abstract SearchableListFilterControl<TTab, TCategory> CreateFilterControl();
protected SearchableListOverlay(OverlayColourScheme colourScheme)
: base(colourScheme)
{
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = BackgroundColour,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new[]
{
new Triangles
{
RelativeSizeAxes = Axes.Both,
TriangleScale = 5,
ColourLight = TrianglesColourLight,
ColourDark = TrianglesColourDark,
},
},
},
scrollContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Child = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Child = new OverlayScrollContainer
{
RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false,
Child = ScrollFlow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 10, Bottom = 50 },
Direction = FillDirection.Vertical,
},
},
},
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Header = CreateHeader(),
Filter = CreateFilterControl(),
},
},
};
}
protected override void Update()
{
base.Update();
scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height };
}
protected override void OnFocus(FocusEvent e)
{
Filter.Search.TakeFocus();
}
protected override void PopIn()
{
base.PopIn();
Filter.Search.HoldFocus = true;
}
protected override void PopOut()
{
base.PopOut();
Filter.Search.HoldFocus = false;
}
}
}

View File

@ -4,22 +4,21 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework; using osu.Framework;
using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Overlays.Toolbar; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Settings namespace osu.Game.Overlays.Settings
{ {
public class Sidebar : Container<SidebarButton>, IStateful<ExpandedState> public class Sidebar : Container<SidebarButton>, IStateful<ExpandedState>
{ {
private readonly FillFlowContainer<SidebarButton> content; private readonly FillFlowContainer<SidebarButton> content;
public const float DEFAULT_WIDTH = ToolbarButton.WIDTH; public const float DEFAULT_WIDTH = Toolbar.Toolbar.HEIGHT * 1.4f;
public const int EXPANDED_WIDTH = 200; public const int EXPANDED_WIDTH = 200;
public event Action<ExpandedState> StateChanged; public event Action<ExpandedState> StateChanged;

View File

@ -13,8 +13,12 @@ using osu.Framework.Bindables;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class SettingsOverlay : SettingsPanel public class SettingsOverlay : SettingsPanel, INamedOverlayComponent
{ {
public string IconTexture => "Icons/Hexacons/settings";
public string Title => "settings";
public string Description => "Change the way osu! behaves";
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[] protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
{ {
new GeneralSection(), new GeneralSection(),
@ -30,7 +34,7 @@ namespace osu.Game.Overlays
private readonly List<SettingsSubPanel> subPanels = new List<SettingsSubPanel>(); private readonly List<SettingsSubPanel> subPanels = new List<SettingsSubPanel>();
protected override Drawable CreateHeader() => new SettingsHeader("settings", "Change the way osu! behaves"); protected override Drawable CreateHeader() => new SettingsHeader(Title, Description);
protected override Drawable CreateFooter() => new SettingsFooter(); protected override Drawable CreateFooter() => new SettingsFooter();
public SettingsOverlay() public SettingsOverlay()

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
{ {
public ToolbarBeatmapListingButton() public ToolbarBeatmapListingButton()
{ {
SetIcon(OsuIcon.ChevronDownCircle);
TooltipMain = "Beatmap listing";
TooltipSub = "Browse for new beatmaps";
Hotkey = GlobalAction.ToggleDirect; Hotkey = GlobalAction.ToggleDirect;
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -25,8 +26,6 @@ namespace osu.Game.Overlays.Toolbar
{ {
public abstract class ToolbarButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction> public abstract class ToolbarButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
{ {
public const float WIDTH = Toolbar.HEIGHT * 1.4f;
protected GlobalAction? Hotkey { get; set; } protected GlobalAction? Hotkey { get; set; }
public void SetIcon(Drawable icon) public void SetIcon(Drawable icon)
@ -35,16 +34,14 @@ namespace osu.Game.Overlays.Toolbar
IconContainer.Show(); IconContainer.Show();
} }
public void SetIcon(IconUsage icon) => SetIcon(new SpriteIcon [Resolved]
{ private TextureStore textures { get; set; }
Size = new Vector2(20),
Icon = icon
});
public IconUsage Icon public void SetIcon(string texture) =>
{ SetIcon(new Sprite
set => SetIcon(value); {
} Texture = textures.Get(texture),
});
public string Text public string Text
{ {
@ -82,7 +79,7 @@ namespace osu.Game.Overlays.Toolbar
protected ToolbarButton() protected ToolbarButton()
: base(HoverSampleSet.Loud) : base(HoverSampleSet.Loud)
{ {
Width = WIDTH; Width = Toolbar.HEIGHT;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Children = new Drawable[] Children = new Drawable[]
@ -116,7 +113,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Size = new Vector2(20), Size = new Vector2(26),
Alpha = 0, Alpha = 0,
}, },
DrawableText = new OsuSpriteText DrawableText = new OsuSpriteText

View File

@ -2,19 +2,11 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
{ {
public class ToolbarChangelogButton : ToolbarOverlayToggleButton public class ToolbarChangelogButton : ToolbarOverlayToggleButton
{ {
public ToolbarChangelogButton()
{
SetIcon(FontAwesome.Solid.Bullhorn);
TooltipMain = "Changelog";
TooltipSub = "Track recent dev updates in the osu! ecosystem";
}
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(ChangelogOverlay changelog) private void load(ChangelogOverlay changelog)
{ {

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
{ {
public ToolbarChatButton() public ToolbarChatButton()
{ {
SetIcon(FontAwesome.Solid.Comments);
TooltipMain = "Chat";
TooltipSub = "Join the real-time discussion";
Hotkey = GlobalAction.ToggleChat; Hotkey = GlobalAction.ToggleChat;
} }

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Sprites; using osu.Framework.Allocation;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -10,11 +10,16 @@ namespace osu.Game.Overlays.Toolbar
{ {
public ToolbarHomeButton() public ToolbarHomeButton()
{ {
Icon = FontAwesome.Solid.Home; Width *= 1.4f;
Hotkey = GlobalAction.Home;
}
[BackgroundDependencyLoader]
private void load()
{
TooltipMain = "Home"; TooltipMain = "Home";
TooltipSub = "Return to the main menu"; TooltipSub = "Return to the main menu";
SetIcon("Icons/Hexacons/home");
Hotkey = GlobalAction.Home;
} }
} }
} }

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -14,10 +13,6 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarMusicButton() public ToolbarMusicButton()
{ {
Icon = FontAwesome.Solid.Music;
TooltipMain = "Now playing";
TooltipSub = "Manage the currently playing track";
Hotkey = GlobalAction.ToggleNowPlaying; Hotkey = GlobalAction.ToggleNowPlaying;
} }

View File

@ -2,19 +2,11 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
{ {
public class ToolbarNewsButton : ToolbarOverlayToggleButton public class ToolbarNewsButton : ToolbarOverlayToggleButton
{ {
public ToolbarNewsButton()
{
Icon = FontAwesome.Solid.Newspaper;
TooltipMain = "News";
TooltipSub = "Get up-to-date on community happenings";
}
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(NewsOverlay news) private void load(NewsOverlay news)
{ {

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
@ -25,10 +24,6 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarNotificationButton() public ToolbarNotificationButton()
{ {
Icon = FontAwesome.Solid.Bars;
TooltipMain = "Notifications";
TooltipSub = "Waiting for 'ya";
Hotkey = GlobalAction.ToggleNotifications; Hotkey = GlobalAction.ToggleNotifications;
Add(countDisplay = new CountCircle Add(countDisplay = new CountCircle

View File

@ -32,6 +32,13 @@ namespace osu.Game.Overlays.Toolbar
Action = stateContainer.ToggleVisibility; Action = stateContainer.ToggleVisibility;
overlayState.BindTo(stateContainer.State); overlayState.BindTo(stateContainer.State);
} }
if (stateContainer is INamedOverlayComponent named)
{
TooltipMain = named.Title;
TooltipSub = named.Description;
SetIcon(named.IconTexture);
}
} }
} }

View File

@ -2,19 +2,11 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
{ {
public class ToolbarRankingsButton : ToolbarOverlayToggleButton public class ToolbarRankingsButton : ToolbarOverlayToggleButton
{ {
public ToolbarRankingsButton()
{
SetIcon(FontAwesome.Regular.ChartBar);
TooltipMain = "Ranking";
TooltipSub = "Find out who's the best right now";
}
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(RankingsOverlay rankings) private void load(RankingsOverlay rankings)
{ {

View File

@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Toolbar
}, },
ModeButtonLine = new Container ModeButtonLine = new Container
{ {
Size = new Vector2(ToolbarButton.WIDTH, 3), Size = new Vector2(Toolbar.HEIGHT, 3),
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Masking = true, Masking = true,

View File

@ -65,12 +65,6 @@ namespace osu.Game.Overlays.Toolbar
Parent.Click(); Parent.Click();
return base.OnClick(e); return base.OnClick(e);
} }
protected override void LoadComplete()
{
base.LoadComplete();
IconContainer.Scale *= 1.4f;
}
} }
} }
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -11,10 +10,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
public ToolbarSettingsButton() public ToolbarSettingsButton()
{ {
Icon = FontAwesome.Solid.Cog; Width *= 1.4f;
TooltipMain = "Settings";
TooltipSub = "Change your settings";
Hotkey = GlobalAction.ToggleSettings; Hotkey = GlobalAction.ToggleSettings;
} }

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar namespace osu.Game.Overlays.Toolbar
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
{ {
public ToolbarSocialButton() public ToolbarSocialButton()
{ {
Icon = FontAwesome.Solid.Users;
TooltipMain = "Friends";
TooltipSub = "Interact with those close to you";
Hotkey = GlobalAction.ToggleSocial; Hotkey = GlobalAction.ToggleSocial;
} }

View File

@ -17,19 +17,18 @@ using osuTK;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
public class UserProfileOverlay : FullscreenOverlay public class UserProfileOverlay : FullscreenOverlay<ProfileHeader>
{ {
private ProfileSection lastSection; private ProfileSection lastSection;
private ProfileSection[] sections; private ProfileSection[] sections;
private GetUserRequest userReq; private GetUserRequest userReq;
protected ProfileHeader Header;
private ProfileSectionsContainer sectionsContainer; private ProfileSectionsContainer sectionsContainer;
private ProfileSectionTabControl tabs; private ProfileSectionTabControl tabs;
public const float CONTENT_X_MARGIN = 70; public const float CONTENT_X_MARGIN = 70;
public UserProfileOverlay() public UserProfileOverlay()
: base(OverlayColourScheme.Pink) : base(OverlayColourScheme.Pink, new ProfileHeader())
{ {
} }
@ -45,6 +44,9 @@ namespace osu.Game.Overlays
if (user.Id == Header?.User.Value?.Id) if (user.Id == Header?.User.Value?.Id)
return; return;
if (sectionsContainer != null)
sectionsContainer.ExpandableHeader = null;
userReq?.Cancel(); userReq?.Cancel();
Clear(); Clear();
lastSection = null; lastSection = null;
@ -77,7 +79,7 @@ namespace osu.Game.Overlays
Add(sectionsContainer = new ProfileSectionsContainer Add(sectionsContainer = new ProfileSectionsContainer
{ {
ExpandableHeader = Header = new ProfileHeader(), ExpandableHeader = Header,
FixedHeader = tabs, FixedHeader = tabs,
HeaderBackground = new Box HeaderBackground = new Box
{ {

View File

@ -14,6 +14,8 @@ namespace osu.Game.Overlays
protected override bool BlockNonPositionalInput => true; protected override bool BlockNonPositionalInput => true;
protected override Container<Drawable> Content => Waves; protected override Container<Drawable> Content => Waves;
public const float WIDTH_PADDING = 80;
protected override bool StartHidden => true; protected override bool StartHidden => true;
protected WaveOverlayContainer() protected WaveOverlayContainer()

View File

@ -11,8 +11,8 @@ using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.SearchableList;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Multi
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, Padding = new MarginPadding { Left = WaveOverlayContainer.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
title = new MultiHeaderTitle title = new MultiHeaderTitle

View File

@ -12,7 +12,6 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Match; using osu.Game.Screens.Multi.Match;
@ -102,8 +101,8 @@ namespace osu.Game.Screens.Multi.Lounge
content.Padding = new MarginPadding content.Padding = new MarginPadding
{ {
Top = Filter.DrawHeight, Top = Filter.DrawHeight,
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING, Left = WaveOverlayContainer.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING,
Right = SearchableListOverlay.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING, Right = WaveOverlayContainer.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING,
}; };
} }

View File

@ -14,8 +14,6 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
public class MatchLeaderboard : Leaderboard<MatchLeaderboardScope, APIUserScoreAggregate> public class MatchLeaderboard : Leaderboard<MatchLeaderboardScope, APIUserScoreAggregate>
{ {
public Action<IEnumerable<APIUserScoreAggregate>> ScoresLoaded;
[Resolved(typeof(Room), nameof(Room.RoomID))] [Resolved(typeof(Room), nameof(Room.RoomID))]
private Bindable<int?> roomId { get; set; } private Bindable<int?> roomId { get; set; }
@ -39,18 +37,20 @@ namespace osu.Game.Screens.Multi.Match.Components
if (roomId.Value == null) if (roomId.Value == null)
return null; return null;
var req = new GetRoomScoresRequest(roomId.Value ?? 0); var req = new GetRoomLeaderboardRequest(roomId.Value ?? 0);
req.Success += r => req.Success += r =>
{ {
scoresCallback?.Invoke(r); scoresCallback?.Invoke(r.Leaderboard);
ScoresLoaded?.Invoke(r); TopScore = r.UserScore;
}; };
return req; return req;
} }
protected override LeaderboardScore CreateDrawableScore(APIUserScoreAggregate model, int index) => new MatchLeaderboardScore(model, index); protected override LeaderboardScore CreateDrawableScore(APIUserScoreAggregate model, int index) => new MatchLeaderboardScore(model, index);
protected override LeaderboardScore CreateDrawableTopScore(APIUserScoreAggregate model) => new MatchLeaderboardScore(model, model.Position, false);
} }
public enum MatchLeaderboardScope public enum MatchLeaderboardScope

View File

@ -14,8 +14,8 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
private readonly APIUserScoreAggregate score; private readonly APIUserScoreAggregate score;
public MatchLeaderboardScore(APIUserScoreAggregate score, int rank) public MatchLeaderboardScore(APIUserScoreAggregate score, int? rank, bool allowHighlight = true)
: base(score.CreateScoreInfo(), rank) : base(score.CreateScoreInfo(), rank, allowHighlight)
{ {
this.score = score; this.score = score;
} }

View File

@ -14,7 +14,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.SearchableList; using osu.Game.Overlays;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -117,7 +117,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
new Container new Container
{ {
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]

View File

@ -172,7 +172,7 @@ namespace osu.Game.Screens.Multi.Match
new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize),
new Dimension(), new Dimension(),
new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Relative, size: 0.4f, minSize: 240), new Dimension(GridSizeMode.Relative, size: 0.4f, minSize: 120),
} }
}, },
null null

View File

@ -9,7 +9,6 @@ using osu.Framework.Bindables;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards; using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -41,25 +40,8 @@ namespace osu.Game.Screens.Select.Leaderboards
} }
} }
public APILegacyUserTopScoreInfo TopScore
{
get => topScoreContainer.Score.Value;
set
{
if (value == null)
topScoreContainer.Hide();
else
{
topScoreContainer.Show();
topScoreContainer.Score.Value = value;
}
}
}
private bool filterMods; private bool filterMods;
private UserTopScoreContainer topScoreContainer;
private IBindable<WeakReference<ScoreInfo>> itemRemoved; private IBindable<WeakReference<ScoreInfo>> itemRemoved;
/// <summary> /// <summary>
@ -101,11 +83,6 @@ namespace osu.Game.Screens.Select.Leaderboards
UpdateScores(); UpdateScores();
}; };
Content.Add(topScoreContainer = new UserTopScoreContainer
{
ScoreSelected = s => ScoreSelected?.Invoke(s)
});
itemRemoved = scoreManager.ItemRemoved.GetBoundCopy(); itemRemoved = scoreManager.ItemRemoved.GetBoundCopy();
itemRemoved.BindValueChanged(onScoreRemoved); itemRemoved.BindValueChanged(onScoreRemoved);
} }
@ -183,7 +160,7 @@ namespace osu.Game.Screens.Select.Leaderboards
req.Success += r => req.Success += r =>
{ {
scoresCallback?.Invoke(r.Scores.Select(s => s.CreateScoreInfo(rulesets))); scoresCallback?.Invoke(r.Scores.Select(s => s.CreateScoreInfo(rulesets)));
TopScore = r.UserScore; TopScore = r.UserScore?.CreateScoreInfo(rulesets);
}; };
return req; return req;
@ -193,5 +170,10 @@ namespace osu.Game.Screens.Select.Leaderboards
{ {
Action = () => ScoreSelected?.Invoke(model) Action = () => ScoreSelected?.Invoke(model)
}; };
protected override LeaderboardScore CreateDrawableTopScore(ScoreInfo model) => new LeaderboardScore(model, model.Position, false)
{
Action = () => ScoreSelected?.Invoke(model)
};
} }
} }

View File

@ -25,7 +25,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.903.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.903.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.903.0" />
<PackageReference Include="Sentry" Version="2.1.6" /> <PackageReference Include="Sentry" Version="2.1.6" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.903.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.903.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.903.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">