From d4cf6e100fbd42d35c418263e45f231ae6d5914e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Sep 2023 18:40:00 +0900 Subject: [PATCH] Update other usages of `OsuIcon.ModBg` and remove --- osu.Game/Graphics/OsuIcon.cs | 4 +++- osu.Game/Rulesets/UI/ModSwitchSmall.cs | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/OsuIcon.cs b/osu.Game/Graphics/OsuIcon.cs index 1f4d6a62da..15af8f000b 100644 --- a/osu.Game/Graphics/OsuIcon.cs +++ b/osu.Game/Graphics/OsuIcon.cs @@ -89,6 +89,8 @@ namespace osu.Game.Graphics public static IconUsage ModSpunOut => Get(0xe046); public static IconUsage ModSuddenDeath => Get(0xe047); public static IconUsage ModTarget => Get(0xe048); - public static IconUsage ModBg => Get(0xe04a); + + // Use "Icons/BeatmapDetails/mod-icon" instead + // public static IconUsage ModBg => Get(0xe04a); } } diff --git a/osu.Game/Rulesets/UI/ModSwitchSmall.cs b/osu.Game/Rulesets/UI/ModSwitchSmall.cs index b6058c16ce..927379c684 100644 --- a/osu.Game/Rulesets/UI/ModSwitchSmall.cs +++ b/osu.Game/Rulesets/UI/ModSwitchSmall.cs @@ -6,6 +6,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Overlays; @@ -23,8 +24,8 @@ namespace osu.Game.Rulesets.UI private readonly IMod mod; - private readonly SpriteIcon background; - private readonly SpriteIcon? modIcon; + private Drawable background = null!; + private SpriteIcon? modIcon; private Color4 activeForegroundColour; private Color4 inactiveForegroundColour; @@ -36,19 +37,24 @@ namespace osu.Game.Rulesets.UI { this.mod = mod; - AutoSizeAxes = Axes.Both; + Size = new Vector2(DEFAULT_SIZE); + } + [BackgroundDependencyLoader] + private void load(TextureStore textures, OsuColour colours, OverlayColourProvider? colourProvider) + { FillFlowContainer contentFlow; ModSwitchTiny tinySwitch; - InternalChildren = new Drawable[] + InternalChildren = new[] { - background = new SpriteIcon + background = new Sprite { + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fit, + Texture = textures.Get("Icons/BeatmapDetails/mod-icon"), Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(DEFAULT_SIZE), - Icon = OsuIcon.ModBg }, contentFlow = new FillFlowContainer { @@ -78,11 +84,7 @@ namespace osu.Game.Rulesets.UI }); tinySwitch.Scale = new Vector2(0.3f); } - } - [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OverlayColourProvider? colourProvider) - { inactiveForegroundColour = colourProvider?.Background5 ?? colours.Gray3; activeForegroundColour = colours.ForModType(mod.Type);