mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Merge pull request #25560 from peppy/hexacons-sprite-icon
Replace all hexacon lookups with strongly typed properties
This commit is contained in:
commit
55df8e81b9
@ -10,7 +10,7 @@
|
|||||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1121.1" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.1124.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
@ -153,7 +154,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public TestTitle()
|
public TestTitle()
|
||||||
{
|
{
|
||||||
Title = "title";
|
Title = "title";
|
||||||
IconTexture = "Icons/changelog";
|
Icon = HexaconsIcons.Devtools;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
131
osu.Game/Graphics/HexaconsIcons.cs
Normal file
131
osu.Game/Graphics/HexaconsIcons.cs
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
// 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 System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Text;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics
|
||||||
|
{
|
||||||
|
public static class HexaconsIcons
|
||||||
|
{
|
||||||
|
public const string FONT_NAME = "Icons/Hexacons";
|
||||||
|
|
||||||
|
public static IconUsage BeatmapPacks => get(HexaconsMapping.beatmap_packs);
|
||||||
|
public static IconUsage Beatmap => get(HexaconsMapping.beatmap);
|
||||||
|
public static IconUsage Calendar => get(HexaconsMapping.calendar);
|
||||||
|
public static IconUsage Chart => get(HexaconsMapping.chart);
|
||||||
|
public static IconUsage Community => get(HexaconsMapping.community);
|
||||||
|
public static IconUsage Contests => get(HexaconsMapping.contests);
|
||||||
|
public static IconUsage Devtools => get(HexaconsMapping.devtools);
|
||||||
|
public static IconUsage Download => get(HexaconsMapping.download);
|
||||||
|
public static IconUsage Editor => get(HexaconsMapping.editor);
|
||||||
|
public static IconUsage FeaturedArtist => get(HexaconsMapping.featured_artist);
|
||||||
|
public static IconUsage Home => get(HexaconsMapping.home);
|
||||||
|
public static IconUsage Messaging => get(HexaconsMapping.messaging);
|
||||||
|
public static IconUsage Music => get(HexaconsMapping.music);
|
||||||
|
public static IconUsage News => get(HexaconsMapping.news);
|
||||||
|
public static IconUsage Notification => get(HexaconsMapping.notification);
|
||||||
|
public static IconUsage Profile => get(HexaconsMapping.profile);
|
||||||
|
public static IconUsage Rankings => get(HexaconsMapping.rankings);
|
||||||
|
public static IconUsage Search => get(HexaconsMapping.search);
|
||||||
|
public static IconUsage Settings => get(HexaconsMapping.settings);
|
||||||
|
public static IconUsage Social => get(HexaconsMapping.social);
|
||||||
|
public static IconUsage Store => get(HexaconsMapping.store);
|
||||||
|
public static IconUsage Tournament => get(HexaconsMapping.tournament);
|
||||||
|
public static IconUsage Wiki => get(HexaconsMapping.wiki);
|
||||||
|
|
||||||
|
private static IconUsage get(HexaconsMapping icon) => new IconUsage((char)icon, FONT_NAME);
|
||||||
|
|
||||||
|
// Basically just converting to something we can use in a `char` lookup for FontStore/GlyphStore compatibility.
|
||||||
|
// Names should match filenames in resources.
|
||||||
|
private enum HexaconsMapping
|
||||||
|
{
|
||||||
|
beatmap_packs,
|
||||||
|
beatmap,
|
||||||
|
calendar,
|
||||||
|
chart,
|
||||||
|
community,
|
||||||
|
contests,
|
||||||
|
devtools,
|
||||||
|
download,
|
||||||
|
editor,
|
||||||
|
featured_artist,
|
||||||
|
home,
|
||||||
|
messaging,
|
||||||
|
music,
|
||||||
|
news,
|
||||||
|
notification,
|
||||||
|
profile,
|
||||||
|
rankings,
|
||||||
|
search,
|
||||||
|
settings,
|
||||||
|
social,
|
||||||
|
store,
|
||||||
|
tournament,
|
||||||
|
wiki,
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HexaconsStore : ITextureStore, ITexturedGlyphLookupStore
|
||||||
|
{
|
||||||
|
private readonly TextureStore textures;
|
||||||
|
|
||||||
|
public HexaconsStore(TextureStore textures)
|
||||||
|
{
|
||||||
|
this.textures = textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
textures.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITexturedCharacterGlyph? Get(string? fontName, char character)
|
||||||
|
{
|
||||||
|
if (fontName == FONT_NAME)
|
||||||
|
return new Glyph(textures.Get($"{fontName}/{((HexaconsMapping)character).ToString().Replace("_", "-")}"));
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<ITexturedCharacterGlyph?> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character));
|
||||||
|
|
||||||
|
public Texture? Get(string name, WrapMode wrapModeS, WrapMode wrapModeT) => null;
|
||||||
|
|
||||||
|
public Texture Get(string name) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Task<Texture> GetAsync(string name, CancellationToken cancellationToken = default) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Stream GetStream(string name) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Task<Texture?> GetAsync(string name, WrapMode wrapModeS, WrapMode wrapModeT, CancellationToken cancellationToken = default) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public class Glyph : ITexturedCharacterGlyph
|
||||||
|
{
|
||||||
|
public float XOffset => default;
|
||||||
|
public float YOffset => default;
|
||||||
|
public float XAdvance => default;
|
||||||
|
public float Baseline => default;
|
||||||
|
public char Character => default;
|
||||||
|
|
||||||
|
public float GetKerning<T>(T lastGlyph) where T : ICharacterGlyph => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public Texture Texture { get; }
|
||||||
|
public float Width => Texture.Width;
|
||||||
|
public float Height => Texture.Height;
|
||||||
|
|
||||||
|
public Glyph(Texture texture)
|
||||||
|
{
|
||||||
|
Texture = texture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -477,6 +477,8 @@ namespace osu.Game
|
|||||||
AddFont(Resources, @"Fonts/Venera/Venera-Light");
|
AddFont(Resources, @"Fonts/Venera/Venera-Light");
|
||||||
AddFont(Resources, @"Fonts/Venera/Venera-Bold");
|
AddFont(Resources, @"Fonts/Venera/Venera-Bold");
|
||||||
AddFont(Resources, @"Fonts/Venera/Venera-Black");
|
AddFont(Resources, @"Fonts/Venera/Venera-Black");
|
||||||
|
|
||||||
|
Fonts.AddStore(new HexaconsIcons.HexaconsStore(Textures));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainBeatmapsetsControllerIndex;
|
Title = PageTitleStrings.MainBeatmapsetsControllerIndex;
|
||||||
Description = NamedOverlayComponentStrings.BeatmapListingDescription;
|
Description = NamedOverlayComponentStrings.BeatmapListingDescription;
|
||||||
IconTexture = "Icons/Hexacons/beatmap";
|
Icon = HexaconsIcons.Beatmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -59,7 +60,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
public BeatmapHeaderTitle()
|
public BeatmapHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainBeatmapsetsControllerShow;
|
Title = PageTitleStrings.MainBeatmapsetsControllerShow;
|
||||||
IconTexture = "Icons/Hexacons/beatmap";
|
Icon = HexaconsIcons.Beatmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ 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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -123,7 +124,7 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainChangelogControllerDefault;
|
Title = PageTitleStrings.MainChangelogControllerDefault;
|
||||||
Description = NamedOverlayComponentStrings.ChangelogDescription;
|
Description = NamedOverlayComponentStrings.ChangelogDescription;
|
||||||
IconTexture = "Icons/Hexacons/devtools";
|
Icon = HexaconsIcons.Devtools;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ namespace osu.Game.Overlays.Chat
|
|||||||
{
|
{
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Texture = textures.Get("Icons/Hexacons/messaging"),
|
Icon = HexaconsIcons.Social,
|
||||||
Size = new Vector2(18),
|
Size = new Vector2(18),
|
||||||
},
|
},
|
||||||
// Placeholder text
|
// Placeholder text
|
||||||
|
@ -11,11 +11,13 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
@ -29,7 +31,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public partial class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler<PlatformAction>
|
public partial class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, IKeyBindingHandler<PlatformAction>
|
||||||
{
|
{
|
||||||
public string IconTexture => "Icons/Hexacons/messaging";
|
public IconUsage Icon => HexaconsIcons.Messaging;
|
||||||
public LocalisableString Title => ChatStrings.HeaderTitle;
|
public LocalisableString Title => ChatStrings.HeaderTitle;
|
||||||
public LocalisableString Description => ChatStrings.HeaderDescription;
|
public LocalisableString Description => ChatStrings.HeaderDescription;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Dashboard
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainHomeControllerIndex;
|
Title = PageTitleStrings.MainHomeControllerIndex;
|
||||||
Description = NamedOverlayComponentStrings.DashboardDescription;
|
Description = NamedOverlayComponentStrings.DashboardDescription;
|
||||||
IconTexture = "Icons/Hexacons/social";
|
Icon = HexaconsIcons.Social;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -17,7 +18,7 @@ namespace osu.Game.Overlays
|
|||||||
public abstract partial class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent
|
public abstract partial class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent
|
||||||
where T : OverlayHeader
|
where T : OverlayHeader
|
||||||
{
|
{
|
||||||
public virtual string IconTexture => Header.Title.IconTexture;
|
public virtual IconUsage Icon => Header.Title.Icon;
|
||||||
public virtual LocalisableString Title => Header.Title.Title;
|
public virtual LocalisableString Title => Header.Title.Title;
|
||||||
public virtual LocalisableString Description => Header.Title.Description;
|
public virtual LocalisableString Description => Header.Title.Description;
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// 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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public interface INamedOverlayComponent
|
public interface INamedOverlayComponent
|
||||||
{
|
{
|
||||||
string IconTexture { get; }
|
IconUsage Icon { get; }
|
||||||
|
|
||||||
LocalisableString Title { get; }
|
LocalisableString Title { get; }
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using System;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ namespace osu.Game.Overlays.News
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainNewsControllerDefault;
|
Title = PageTitleStrings.MainNewsControllerDefault;
|
||||||
Description = NamedOverlayComponentStrings.NewsDescription;
|
Description = NamedOverlayComponentStrings.NewsDescription;
|
||||||
IconTexture = "Icons/Hexacons/news";
|
Icon = HexaconsIcons.News;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,11 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -27,7 +29,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public partial class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, INotificationOverlay
|
public partial class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent, INotificationOverlay
|
||||||
{
|
{
|
||||||
public string IconTexture => "Icons/Hexacons/notification";
|
public IconUsage Icon => HexaconsIcons.Notification;
|
||||||
public LocalisableString Title => NotificationsStrings.HeaderTitle;
|
public LocalisableString Title => NotificationsStrings.HeaderTitle;
|
||||||
public LocalisableString Description => NotificationsStrings.HeaderDescription;
|
public LocalisableString Description => NotificationsStrings.HeaderDescription;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public partial class NowPlayingOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
|
public partial class NowPlayingOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
public string IconTexture => "Icons/Hexacons/music";
|
public IconUsage Icon => HexaconsIcons.Music;
|
||||||
public LocalisableString Title => NowPlayingStrings.HeaderTitle;
|
public LocalisableString Title => NowPlayingStrings.HeaderTitle;
|
||||||
public LocalisableString Description => NowPlayingStrings.HeaderDescription;
|
public LocalisableString Description => NowPlayingStrings.HeaderDescription;
|
||||||
|
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -20,7 +16,7 @@ namespace osu.Game.Overlays
|
|||||||
public const float ICON_SIZE = 30;
|
public const float ICON_SIZE = 30;
|
||||||
|
|
||||||
private readonly OsuSpriteText titleText;
|
private readonly OsuSpriteText titleText;
|
||||||
private readonly Container icon;
|
private readonly Container iconContainer;
|
||||||
|
|
||||||
private LocalisableString title;
|
private LocalisableString title;
|
||||||
|
|
||||||
@ -32,12 +28,20 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public LocalisableString Description { get; protected set; }
|
public LocalisableString Description { get; protected set; }
|
||||||
|
|
||||||
private string iconTexture;
|
private IconUsage icon;
|
||||||
|
|
||||||
public string IconTexture
|
public IconUsage Icon
|
||||||
{
|
{
|
||||||
get => iconTexture;
|
get => icon;
|
||||||
protected set => icon.Child = new OverlayTitleIcon(iconTexture = value);
|
protected set => iconContainer.Child = new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
FillMode = FillMode.Fit,
|
||||||
|
|
||||||
|
Icon = icon = value,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OverlayTitle()
|
protected OverlayTitle()
|
||||||
@ -51,7 +55,7 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
icon = new Container
|
iconContainer = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -68,26 +72,5 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class OverlayTitleIcon : Sprite
|
|
||||||
{
|
|
||||||
private readonly string textureName;
|
|
||||||
|
|
||||||
public OverlayTitleIcon(string textureName)
|
|
||||||
{
|
|
||||||
this.textureName = textureName;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Anchor = Anchor.Centre;
|
|
||||||
Origin = Anchor.Centre;
|
|
||||||
FillMode = FillMode.Fit;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
Texture = textures.Get(textureName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ 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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Profile.Header;
|
using osu.Game.Overlays.Profile.Header;
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -86,7 +87,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
public ProfileHeaderTitle()
|
public ProfileHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainUsersControllerDefault;
|
Title = PageTitleStrings.MainUsersControllerDefault;
|
||||||
IconTexture = "Icons/Hexacons/profile";
|
Icon = HexaconsIcons.Profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ namespace osu.Game.Overlays.Rankings
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainRankingControllerDefault;
|
Title = PageTitleStrings.MainRankingControllerDefault;
|
||||||
Description = NamedOverlayComponentStrings.RankingsDescription;
|
Description = NamedOverlayComponentStrings.RankingsDescription;
|
||||||
IconTexture = "Icons/Hexacons/rankings";
|
Icon = HexaconsIcons.Rankings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,16 @@ using osu.Game.Overlays.Settings.Sections.Input;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public partial class SettingsOverlay : SettingsPanel, INamedOverlayComponent
|
public partial class SettingsOverlay : SettingsPanel, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
public string IconTexture => "Icons/Hexacons/settings";
|
public IconUsage Icon => HexaconsIcons.Settings;
|
||||||
public LocalisableString Title => SettingsStrings.HeaderTitle;
|
public LocalisableString Title => SettingsStrings.HeaderTitle;
|
||||||
public LocalisableString Description => SettingsStrings.HeaderDescription;
|
public LocalisableString Description => SettingsStrings.HeaderDescription;
|
||||||
|
|
||||||
|
@ -10,12 +10,11 @@ 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;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -36,16 +35,13 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
IconContainer.Show();
|
IconContainer.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private TextureStore textures { get; set; } = null!;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ReadableKeyCombinationProvider keyCombinationProvider { get; set; } = null!;
|
private ReadableKeyCombinationProvider keyCombinationProvider { get; set; } = null!;
|
||||||
|
|
||||||
public void SetIcon(string texture) =>
|
public void SetIcon(IconUsage icon) =>
|
||||||
SetIcon(new Sprite
|
SetIcon(new SpriteIcon
|
||||||
{
|
{
|
||||||
Texture = textures.Get(texture),
|
Icon = icon,
|
||||||
});
|
});
|
||||||
|
|
||||||
public LocalisableString Text
|
public LocalisableString Text
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// 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;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
TooltipMain = ToolbarStrings.HomeHeaderTitle;
|
TooltipMain = ToolbarStrings.HomeHeaderTitle;
|
||||||
TooltipSub = ToolbarStrings.HomeHeaderDescription;
|
TooltipSub = ToolbarStrings.HomeHeaderDescription;
|
||||||
SetIcon("Icons/Hexacons/home");
|
SetIcon(HexaconsIcons.Home);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
TooltipMain = named.Title;
|
TooltipMain = named.Title;
|
||||||
TooltipSub = named.Description;
|
TooltipSub = named.Description;
|
||||||
SetIcon(named.IconTexture);
|
SetIcon(named.Icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
@ -81,7 +82,7 @@ namespace osu.Game.Overlays.Wiki
|
|||||||
{
|
{
|
||||||
Title = PageTitleStrings.MainWikiControllerDefault;
|
Title = PageTitleStrings.MainWikiControllerDefault;
|
||||||
Description = NamedOverlayComponentStrings.WikiDescription;
|
Description = NamedOverlayComponentStrings.WikiDescription;
|
||||||
IconTexture = "Icons/Hexacons/wiki";
|
Icon = HexaconsIcons.Wiki;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ namespace osu.Game.Screens.Edit.Components.Menus
|
|||||||
Padding = new MarginPadding(8),
|
Padding = new MarginPadding(8),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Sprite
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
Size = new Vector2(26),
|
Size = new Vector2(26),
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Texture = textures.Get("Icons/Hexacons/editor"),
|
Icon = HexaconsIcons.Editor,
|
||||||
},
|
},
|
||||||
text = new TextFlowContainer
|
text = new TextFlowContainer
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ 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.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -79,7 +80,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
Title = EditorSetupStrings.BeatmapSetup.ToLower();
|
Title = EditorSetupStrings.BeatmapSetup.ToLower();
|
||||||
Description = EditorSetupStrings.BeatmapSetupDescription;
|
Description = EditorSetupStrings.BeatmapSetupDescription;
|
||||||
IconTexture = "Icons/Hexacons/social";
|
Icon = HexaconsIcons.Social;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
this.getLookup = getLookup;
|
this.getLookup = getLookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITexturedCharacterGlyph? Get(string fontName, char character)
|
public ITexturedCharacterGlyph? Get(string? fontName, char character)
|
||||||
{
|
{
|
||||||
string lookup = getLookup(character);
|
string lookup = getLookup(character);
|
||||||
var texture = textures.Get($"Gameplay/Fonts/{fontName}-{lookup}");
|
var texture = textures.Get($"Gameplay/Fonts/{fontName}-{lookup}");
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Skinning
|
|||||||
this.maxSize = maxSize;
|
this.maxSize = maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITexturedCharacterGlyph? Get(string fontName, char character)
|
public ITexturedCharacterGlyph? Get(string? fontName, char character)
|
||||||
{
|
{
|
||||||
string lookup = getLookupName(character);
|
string lookup = getLookupName(character);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1121.1" />
|
<PackageReference Include="ppy.osu.Framework" Version="2023.1124.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1114.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1114.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.40.0" />
|
<PackageReference Include="Sentry" Version="3.40.0" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1121.1" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2023.1124.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user