1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 07:43:00 +08:00

Convert all static getter-only properties to static readonly fields

This commit is contained in:
Salman Ahmed 2020-04-08 14:23:29 +03:00
parent 7f3ad6d5be
commit d27d8671ab
4 changed files with 13 additions and 13 deletions

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Tests
}, false, false, false);
});
AddAssert("hyper-dash fruit has default colour", () => checkLegacyFruitHyperDashColour(drawableFruit, Catcher.DefaultHyperDashColour));
AddAssert("hyper-dash fruit has default colour", () => checkLegacyFruitHyperDashColour(drawableFruit, Catcher.DEFAULT_HYPER_DASH_COLOUR));
}
[TestCase(true)]
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests
}, customCatcherHyperDashColour, false, true);
});
AddAssert("hyper-dash fruit use fruit colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashFruitColour));
AddAssert("hyper-dash fruit use fruit colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CUSTOM_HYPER_DASH_FRUIT_COLOUR));
}
[Test]
@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Catch.Tests
}, true, false, false);
});
AddAssert("hyper-dash fruit colour falls back to catcher colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CustomHyperDashColour));
AddAssert("hyper-dash fruit colour falls back to catcher colour from skin", () => checkLegacyFruitHyperDashColour(drawableFruit, TestSkin.CUSTOM_HYPER_DASH_COLOUR));
}
private Drawable setupSkinHierarchy(Drawable child, bool customCatcherColour, bool customAfterColour, bool customFruitColour)
@ -108,21 +108,21 @@ namespace osu.Game.Rulesets.Catch.Tests
private class TestSkin : LegacySkin
{
public static Color4 CustomHyperDashColour { get; } = Color4.Goldenrod;
public static Color4 CustomHyperDashFruitColour { get; } = Color4.Cyan;
public static Color4 CustomHyperDashAfterColour { get; } = Color4.Lime;
public static readonly Color4 CUSTOM_HYPER_DASH_COLOUR = Color4.Goldenrod;
public static readonly Color4 CUSTOM_HYPER_DASH_AFTER_COLOUR = Color4.Lime;
public static readonly Color4 CUSTOM_HYPER_DASH_FRUIT_COLOUR = Color4.Cyan;
public TestSkin(bool customCatcherColour, bool customAfterColour, bool customFruitColour)
: base(new SkinInfo(), null, null, string.Empty)
{
if (customCatcherColour)
Configuration.CustomColours[CatchSkinColour.HyperDash.ToString()] = CustomHyperDashColour;
Configuration.CustomColours[CatchSkinColour.HyperDash.ToString()] = CUSTOM_HYPER_DASH_COLOUR;
if (customAfterColour)
Configuration.CustomColours[CatchSkinColour.HyperDashAfterImage.ToString()] = CustomHyperDashAfterColour;
Configuration.CustomColours[CatchSkinColour.HyperDashAfterImage.ToString()] = CUSTOM_HYPER_DASH_AFTER_COLOUR;
if (customFruitColour)
Configuration.CustomColours[CatchSkinColour.HyperDashFruit.ToString()] = CustomHyperDashFruitColour;
Configuration.CustomColours[CatchSkinColour.HyperDashFruit.ToString()] = CUSTOM_HYPER_DASH_FRUIT_COLOUR;
}
}
}

View File

@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
BorderColour = Catcher.DefaultHyperDashColour,
BorderColour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
BorderThickness = 12f * RADIUS_ADJUST,
Children = new Drawable[]
{
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
Alpha = 0.3f,
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
Colour = Catcher.DefaultHyperDashColour,
Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
}
}
});

View File

@ -15,6 +15,6 @@ namespace osu.Game.Rulesets.Catch.Skinning
public static IBindable<Color4> GetHyperDashFruitColour(this ISkin skin)
=> skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDashFruit) ??
skin.GetConfig<CatchSkinColour, Color4>(CatchSkinColour.HyperDash) ??
new Bindable<Color4>(Catcher.DefaultHyperDashColour);
new Bindable<Color4>(Catcher.DEFAULT_HYPER_DASH_COLOUR);
}
}

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Catch.UI
{
public class Catcher : Container, IKeyBindingHandler<CatchAction>
{
public static Color4 DefaultHyperDashColour { get; } = Color4.Red;
public static readonly Color4 DEFAULT_HYPER_DASH_COLOUR = Color4.Red;
/// <summary>
/// Whether we are hyper-dashing or not.