mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 11:33:22 +08:00
Fix code quality
This commit is contained in:
parent
56143de2c6
commit
b24be96d04
@ -110,6 +110,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
|
||||
}
|
||||
|
||||
return colour;
|
||||
}
|
||||
|
||||
@ -134,11 +135,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
tHasCustomColours.CustomColours[pair.Key] = colour;
|
||||
}
|
||||
bool isInputOverlayText = pair.Key.StartsWith(@"InputOverlayText");
|
||||
|
||||
bool isInputOverlayText = pair.Key == @"InputOverlayText";
|
||||
|
||||
if (isInputOverlayText)
|
||||
{
|
||||
if (!(output is SkinConfiguration tSkinConfiguration)) return;
|
||||
|
||||
tSkinConfiguration.InputOverlayText = colour;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
private Colour4 keyTextColour = Colour4.White;
|
||||
|
||||
private float keyTextRotation = 0f;
|
||||
private float keyTextRotation;
|
||||
|
||||
public float KeyTextRotation
|
||||
{
|
||||
@ -42,11 +42,11 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
private Container keyContainer = null!;
|
||||
private readonly Container keyContainer;
|
||||
|
||||
private OsuSpriteText overlayKeyText = null!;
|
||||
private readonly OsuSpriteText overlayKeyText;
|
||||
|
||||
private Sprite keySprite = null!;
|
||||
private readonly Sprite keySprite;
|
||||
|
||||
public LegacyKeyCounter(InputTrigger trigger)
|
||||
: base(trigger)
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Skinning
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource source)
|
||||
{
|
||||
Texture? keyTexture = source.GetTexture($"inputoverlay-key");
|
||||
Texture? keyTexture = source.GetTexture(@"inputoverlay-key");
|
||||
|
||||
if (keyTexture != null)
|
||||
keySprite.Texture = keyTexture;
|
||||
|
@ -8,7 +8,6 @@ using osu.Game.Screens.Play.HUD;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -16,9 +15,9 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
private const float key_transition_time = 100;
|
||||
|
||||
protected override FillFlowContainer<KeyCounter> KeyFlow { get; } = null!;
|
||||
protected override FillFlowContainer<KeyCounter> KeyFlow { get; }
|
||||
|
||||
private Sprite backgroundSprite = null!;
|
||||
private readonly Sprite backgroundSprite;
|
||||
|
||||
public LegacyKeyCounterDisplay()
|
||||
{
|
||||
@ -26,22 +25,22 @@ namespace osu.Game.Skinning
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
backgroundSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
},
|
||||
KeyFlow = new FillFlowContainer<KeyCounter>
|
||||
{
|
||||
// https://osu.ppy.sh/wiki/en/Skinning/Interface#input-overlay
|
||||
// 24px away from the container, there're 4 counter in legacy, so divide by 4
|
||||
// "inputoverlay-background.png" are 1.05x in-game. so *1.05f to the X coordinate
|
||||
X = (24 / 4) * 1f,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
backgroundSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
},
|
||||
KeyFlow = new FillFlowContainer<KeyCounter>
|
||||
{
|
||||
// https://osu.ppy.sh/wiki/en/Skinning/Interface#input-overlay
|
||||
// 24px away from the container, there're 4 counter in legacy, so divide by 4
|
||||
// "inputoverlay-background.png" are 1.05x in-game. so *1.05f to the X coordinate
|
||||
X = 24f / 4f,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -56,7 +55,7 @@ namespace osu.Game.Skinning
|
||||
KeyTextColor = v.NewValue;
|
||||
}, true);
|
||||
|
||||
Texture? backgroundTexture = source.GetTexture($"inputoverlay-background");
|
||||
Texture? backgroundTexture = source.GetTexture(@"inputoverlay-background");
|
||||
|
||||
if (backgroundTexture != null)
|
||||
backgroundSprite.Texture = backgroundTexture;
|
||||
|
@ -309,8 +309,10 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
case SkinConfiguration.LegacySetting.Version:
|
||||
return SkinUtils.As<TValue>(new Bindable<decimal>(Configuration.LegacyVersion ?? SkinConfiguration.LATEST_VERSION));
|
||||
|
||||
case SkinConfiguration.LegacySetting.InputOverlayText:
|
||||
return SkinUtils.As<TValue>(new Bindable<Colour4>(Configuration.InputOverlayText ?? Colour4.White));
|
||||
|
||||
default:
|
||||
return genericLookup<SkinConfiguration.LegacySetting, TValue>(legacySetting);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user