1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Use readonly fields.

This commit is contained in:
Huo Yaoyuan 2017-05-08 18:56:04 +08:00
parent 4f8549f220
commit dff05bec79
7 changed files with 54 additions and 54 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Desktop.Beatmaps.IO
{ {
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path)); public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
private string basePath { get; } private readonly string basePath;
public LegacyFilesystemReader(string path) public LegacyFilesystemReader(string path)
{ {

View File

@ -11,7 +11,7 @@ namespace osu.Game.Beatmaps.Formats
{ {
public abstract class BeatmapDecoder public abstract class BeatmapDecoder
{ {
private static Dictionary<string, Type> decoders { get; } = new Dictionary<string, Type>(); private static readonly Dictionary<string, Type> decoders = new Dictionary<string, Type>();
public static BeatmapDecoder GetDecoder(StreamReader stream) public static BeatmapDecoder GetDecoder(StreamReader stream)
{ {

View File

@ -13,11 +13,11 @@ namespace osu.Game.Beatmaps.IO
{ {
private class Reader private class Reader
{ {
public Func<Storage, string, bool> Test { get; set; } public Func<Storage, string, bool> Test;
public Type Type { get; set; } public Type Type;
} }
private static List<Reader> readers { get; } = new List<Reader>(); private static readonly List<Reader> readers = new List<Reader>();
public static ArchiveReader GetReader(Storage storage, string path) public static ArchiveReader GetReader(Storage storage, string path)
{ {

View File

@ -33,57 +33,57 @@ namespace osu.Game.Graphics
} }
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
public Color4 PurpleLighter = FromHex(@"eeeeff"); public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
public Color4 PurpleLight = FromHex(@"aa88ff"); public readonly Color4 PurpleLight = FromHex(@"aa88ff");
public Color4 Purple = FromHex(@"8866ee"); public readonly Color4 Purple = FromHex(@"8866ee");
public Color4 PurpleDark = FromHex(@"6644cc"); public readonly Color4 PurpleDark = FromHex(@"6644cc");
public Color4 PurpleDarker = FromHex(@"441188"); public readonly Color4 PurpleDarker = FromHex(@"441188");
public Color4 PinkLighter = FromHex(@"ffddee"); public readonly Color4 PinkLighter = FromHex(@"ffddee");
public Color4 PinkLight = FromHex(@"ff99cc"); public readonly Color4 PinkLight = FromHex(@"ff99cc");
public Color4 Pink = FromHex(@"ff66aa"); public readonly Color4 Pink = FromHex(@"ff66aa");
public Color4 PinkDark = FromHex(@"cc5288"); public readonly Color4 PinkDark = FromHex(@"cc5288");
public Color4 PinkDarker = FromHex(@"bb1177"); public readonly Color4 PinkDarker = FromHex(@"bb1177");
public Color4 BlueLighter = FromHex(@"ddffff"); public readonly Color4 BlueLighter = FromHex(@"ddffff");
public Color4 BlueLight = FromHex(@"99eeff"); public readonly Color4 BlueLight = FromHex(@"99eeff");
public Color4 Blue = FromHex(@"66ccff"); public readonly Color4 Blue = FromHex(@"66ccff");
public Color4 BlueDark = FromHex(@"44aadd"); public readonly Color4 BlueDark = FromHex(@"44aadd");
public Color4 BlueDarker = FromHex(@"2299bb"); public readonly Color4 BlueDarker = FromHex(@"2299bb");
public Color4 YellowLighter = FromHex(@"ffffdd"); public readonly Color4 YellowLighter = FromHex(@"ffffdd");
public Color4 YellowLight = FromHex(@"ffdd55"); public readonly Color4 YellowLight = FromHex(@"ffdd55");
public Color4 Yellow = FromHex(@"ffcc22"); public readonly Color4 Yellow = FromHex(@"ffcc22");
public Color4 YellowDark = FromHex(@"eeaa00"); public readonly Color4 YellowDark = FromHex(@"eeaa00");
public Color4 YellowDarker = FromHex(@"cc6600"); public readonly Color4 YellowDarker = FromHex(@"cc6600");
public Color4 GreenLighter = FromHex(@"eeffcc"); public readonly Color4 GreenLighter = FromHex(@"eeffcc");
public Color4 GreenLight = FromHex(@"b3d944"); public readonly Color4 GreenLight = FromHex(@"b3d944");
public Color4 Green = FromHex(@"88b300"); public readonly Color4 Green = FromHex(@"88b300");
public Color4 GreenDark = FromHex(@"668800"); public readonly Color4 GreenDark = FromHex(@"668800");
public Color4 GreenDarker = FromHex(@"445500"); public readonly Color4 GreenDarker = FromHex(@"445500");
public Color4 Gray0 = FromHex(@"000"); public readonly Color4 Gray0 = FromHex(@"000");
public Color4 Gray1 = FromHex(@"111"); public readonly Color4 Gray1 = FromHex(@"111");
public Color4 Gray2 = FromHex(@"222"); public readonly Color4 Gray2 = FromHex(@"222");
public Color4 Gray3 = FromHex(@"333"); public readonly Color4 Gray3 = FromHex(@"333");
public Color4 Gray4 = FromHex(@"444"); public readonly Color4 Gray4 = FromHex(@"444");
public Color4 Gray5 = FromHex(@"555"); public readonly Color4 Gray5 = FromHex(@"555");
public Color4 Gray6 = FromHex(@"666"); public readonly Color4 Gray6 = FromHex(@"666");
public Color4 Gray7 = FromHex(@"777"); public readonly Color4 Gray7 = FromHex(@"777");
public Color4 Gray8 = FromHex(@"888"); public readonly Color4 Gray8 = FromHex(@"888");
public Color4 Gray9 = FromHex(@"999"); public readonly Color4 Gray9 = FromHex(@"999");
public Color4 GrayA = FromHex(@"aaa"); public readonly Color4 GrayA = FromHex(@"aaa");
public Color4 GrayB = FromHex(@"bbb"); public readonly Color4 GrayB = FromHex(@"bbb");
public Color4 GrayC = FromHex(@"ccc"); public readonly Color4 GrayC = FromHex(@"ccc");
public Color4 GrayD = FromHex(@"ddd"); public readonly Color4 GrayD = FromHex(@"ddd");
public Color4 GrayE = FromHex(@"eee"); public readonly Color4 GrayE = FromHex(@"eee");
public Color4 GrayF = FromHex(@"fff"); public readonly Color4 GrayF = FromHex(@"fff");
public Color4 RedLighter = FromHex(@"ffeded"); public readonly Color4 RedLighter = FromHex(@"ffeded");
public Color4 RedLight = FromHex(@"ed7787"); public readonly Color4 RedLight = FromHex(@"ed7787");
public Color4 Red = FromHex(@"ed1121"); public readonly Color4 Red = FromHex(@"ed1121");
public Color4 RedDark = FromHex(@"ba0011"); public readonly Color4 RedDark = FromHex(@"ba0011");
public Color4 RedDarker = FromHex(@"870000"); public readonly Color4 RedDarker = FromHex(@"870000");
} }
} }

View File

@ -23,7 +23,7 @@ namespace osu.Game.Online.Chat
[JsonProperty(@"channel_id")] [JsonProperty(@"channel_id")]
public int Id; public int Id;
public SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id)); public readonly SortedList<Message> Messages = new SortedList<Message>((m1, m2) => m1.Id.CompareTo(m2.Id));
//internal bool Joined; //internal bool Joined;

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Mods
{ {
public class ModButton : FillFlowContainer public class ModButton : FillFlowContainer
{ {
private ModIcon foregroundIcon { get; set; } private ModIcon foregroundIcon;
private readonly SpriteText text; private readonly SpriteText text;
private readonly Container<ModIcon> iconsContainer; private readonly Container<ModIcon> iconsContainer;
private SampleChannel sampleOn, sampleOff; private SampleChannel sampleOn, sampleOff;

View File

@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public class OsuLogo : Container public class OsuLogo : Container
{ {
public Color4 OsuPink = OsuColour.FromHex(@"e967a1"); public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1");
private readonly Sprite logo; private readonly Sprite logo;
private readonly CircularContainer logoContainer; private readonly CircularContainer logoContainer;