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