mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Centralise fetching of overlay component titles and textures
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public ToolbarBeatmapListingButton()
|
||||
{
|
||||
SetIcon(OsuIcon.ChevronDownCircle);
|
||||
TooltipMain = "Beatmap listing";
|
||||
TooltipSub = "Browse for new beatmaps";
|
||||
|
||||
Hotkey = GlobalAction.ToggleDirect;
|
||||
}
|
||||
|
||||
|
@ -35,17 +35,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
IconContainer.Show();
|
||||
}
|
||||
|
||||
public void SetIcon(IconUsage icon) => SetIcon(new SpriteIcon
|
||||
{
|
||||
Size = new Vector2(20),
|
||||
Icon = icon
|
||||
});
|
||||
|
||||
public IconUsage Icon
|
||||
{
|
||||
set => SetIcon(value);
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => DrawableText.Text;
|
||||
|
@ -2,19 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarChangelogButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
public ToolbarChangelogButton()
|
||||
{
|
||||
SetIcon(FontAwesome.Solid.Bullhorn);
|
||||
TooltipMain = "Changelog";
|
||||
TooltipSub = "Track recent dev updates in the osu! ecosystem";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(ChangelogOverlay changelog)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public ToolbarChatButton()
|
||||
{
|
||||
SetIcon(FontAwesome.Solid.Comments);
|
||||
TooltipMain = "Chat";
|
||||
TooltipSub = "Join the real-time discussion";
|
||||
|
||||
Hotkey = GlobalAction.ToggleChat;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -10,7 +9,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public ToolbarHomeButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Home;
|
||||
// todo: icon
|
||||
TooltipMain = "Home";
|
||||
TooltipSub = "Return to the main menu";
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -14,10 +13,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
public ToolbarMusicButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Music;
|
||||
TooltipMain = "Now playing";
|
||||
TooltipSub = "Manage the currently playing track";
|
||||
|
||||
Hotkey = GlobalAction.ToggleNowPlaying;
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarNewsButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
public ToolbarNewsButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Newspaper;
|
||||
TooltipMain = "News";
|
||||
TooltipSub = "Get up-to-date on community happenings";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(NewsOverlay news)
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
@ -25,10 +24,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
public ToolbarNotificationButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Bars;
|
||||
TooltipMain = "Notifications";
|
||||
TooltipSub = "Waiting for 'ya";
|
||||
|
||||
Hotkey = GlobalAction.ToggleNotifications;
|
||||
|
||||
Add(countDisplay = new CountCircle
|
||||
|
@ -1,11 +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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -18,6 +21,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private readonly Bindable<Visibility> overlayState = new Bindable<Visibility>();
|
||||
|
||||
[Resolved]
|
||||
private TextureStore textures { get; set; }
|
||||
|
||||
public OverlayContainer StateContainer
|
||||
{
|
||||
get => stateContainer;
|
||||
@ -32,6 +38,16 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
overlayState.BindTo(stateContainer.State);
|
||||
}
|
||||
|
||||
if (stateContainer is INamedOverlayComponent named)
|
||||
{
|
||||
TooltipMain = named.Title;
|
||||
TooltipSub = named.Description;
|
||||
SetIcon(new Sprite
|
||||
{
|
||||
Texture = textures.Get(named.IconTexture),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarRankingsButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
public ToolbarRankingsButton()
|
||||
{
|
||||
SetIcon(FontAwesome.Regular.ChartBar);
|
||||
TooltipMain = "Ranking";
|
||||
TooltipSub = "Find out who's the best right now";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(RankingsOverlay rankings)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public ToolbarSettingsButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Cog;
|
||||
TooltipMain = "Settings";
|
||||
TooltipSub = "Change your settings";
|
||||
|
||||
Hotkey = GlobalAction.ToggleSettings;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public ToolbarSocialButton()
|
||||
{
|
||||
Icon = FontAwesome.Solid.Users;
|
||||
TooltipMain = "Friends";
|
||||
TooltipSub = "Interact with those close to you";
|
||||
|
||||
Hotkey = GlobalAction.ToggleSocial;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user