1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 08:42:56 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into beatmap-video

This commit is contained in:
Andrei Zavatski 2019-08-31 15:54:28 +03:00
commit d9beee926a
6 changed files with 43 additions and 18 deletions

View File

@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
return !hasFont(font)
? null
: new LegacySpriteText(this, font)
: new LegacySpriteText(source, font)
{
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
Scale = new Vector2(0.96f),
@ -110,13 +110,13 @@ namespace osu.Game.Rulesets.Osu.Skinning
return null;
}
public Texture GetTexture(string componentName) => null;
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
public SampleChannel GetSample(ISampleInfo sample) => null;
public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration
=> configuration.Value is TConfiguration conf ? query.Invoke(conf) : default;
=> configuration.Value is TConfiguration conf ? query.Invoke(conf) : source.GetValue(query);
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
private bool hasFont(string fontName) => source.GetTexture($"{fontName}-0") != null;
}
}

View File

@ -13,7 +13,7 @@ namespace osu.Game.Skinning
public DefaultSkin()
: base(SkinInfo.Default)
{
Configuration = new SkinConfiguration();
Configuration = new DefaultSkinConfiguration();
}
public override Drawable GetDrawableComponent(string componentName) => null;

View File

@ -0,0 +1,28 @@
// 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 osuTK.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// A skin configuration pre-populated with sane defaults.
/// </summary>
public class DefaultSkinConfiguration : SkinConfiguration
{
public DefaultSkinConfiguration()
{
HitCircleFont = "default";
ComboColours.AddRange(new[]
{
new Color4(17, 136, 170, 255),
new Color4(102, 136, 0, 255),
new Color4(204, 102, 0, 255),
new Color4(121, 9, 13, 255)
});
CursorExpand = true;
}
}
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Skinning
using (StreamReader reader = new StreamReader(stream))
Configuration = new LegacySkinDecoder().Decode(reader);
else
Configuration = new SkinConfiguration();
Configuration = new DefaultSkinConfiguration();
Samples = audioManager.GetSampleStore(storage);
Textures = new TextureStore(new TextureLoaderStore(storage));

View File

@ -5,14 +5,14 @@ using osu.Game.Beatmaps.Formats;
namespace osu.Game.Skinning
{
public class LegacySkinDecoder : LegacyDecoder<SkinConfiguration>
public class LegacySkinDecoder : LegacyDecoder<DefaultSkinConfiguration>
{
public LegacySkinDecoder()
: base(1)
{
}
protected override void ParseLine(SkinConfiguration skin, Section section, string line)
protected override void ParseLine(DefaultSkinConfiguration skin, Section section, string line)
{
line = StripComments(line);

View File

@ -7,21 +7,18 @@ using osuTK.Graphics;
namespace osu.Game.Skinning
{
/// <summary>
/// An empty skin configuration.
/// </summary>
public class SkinConfiguration : IHasComboColours, IHasCustomColours
{
public readonly SkinInfo SkinInfo = new SkinInfo();
public List<Color4> ComboColours { get; set; } = new List<Color4>
{
new Color4(17, 136, 170, 255),
new Color4(102, 136, 0, 255),
new Color4(204, 102, 0, 255),
new Color4(121, 9, 13, 255)
};
public List<Color4> ComboColours { get; set; } = new List<Color4>();
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
public string HitCircleFont { get; set; } = "default";
public string HitCircleFont { get; set; }
public int HitCircleOverlap { get; set; }
@ -29,6 +26,6 @@ namespace osu.Game.Skinning
public float? SliderPathRadius { get; set; }
public bool? CursorExpand { get; set; } = true;
public bool? CursorExpand { get; set; }
}
}