(GameRes): use ResourceInstance instead of Lazy.

This commit is contained in:
morkt 2023-10-11 18:53:12 +04:00
parent 196f0ea318
commit 4d26cdcff6
2 changed files with 10 additions and 10 deletions

View File

@ -197,8 +197,8 @@ namespace GameRes
return null;
}
public static AudioFormat Wav { get { return s_WavFormat.Value; } }
public static AudioFormat Wav => s_WavFormat.Value;
static readonly Lazy<AudioFormat> s_WavFormat = new Lazy<AudioFormat> (() => FormatCatalog.Instance.AudioFormats.FirstOrDefault (x => x.Tag == "WAV"));
static readonly ResourceInstance<AudioFormat> s_WavFormat = new ResourceInstance<AudioFormat> ("WAV");
}
}

View File

@ -189,15 +189,15 @@ namespace GameRes
return FormatCatalog.Instance.ImageFormats.FirstOrDefault (x => x.Tag == tag);
}
static readonly Lazy<ImageFormat> s_JpegFormat = new Lazy<ImageFormat> (() => FindByTag ("JPEG"));
static readonly Lazy<ImageFormat> s_PngFormat = new Lazy<ImageFormat> (() => FindByTag ("PNG"));
static readonly Lazy<ImageFormat> s_BmpFormat = new Lazy<ImageFormat> (() => FindByTag ("BMP"));
static readonly Lazy<ImageFormat> s_TgaFormat = new Lazy<ImageFormat> (() => FindByTag ("TGA"));
static readonly ResourceInstance<ImageFormat> s_JpegFormat = new ResourceInstance<ImageFormat> ("JPEG");
static readonly ResourceInstance<ImageFormat> s_PngFormat = new ResourceInstance<ImageFormat> ("PNG");
static readonly ResourceInstance<ImageFormat> s_BmpFormat = new ResourceInstance<ImageFormat> ("BMP");
static readonly ResourceInstance<ImageFormat> s_TgaFormat = new ResourceInstance<ImageFormat> ("TGA");
public static ImageFormat Jpeg { get { return s_JpegFormat.Value; } }
public static ImageFormat Png { get { return s_PngFormat.Value; } }
public static ImageFormat Bmp { get { return s_BmpFormat.Value; } }
public static ImageFormat Tga { get { return s_TgaFormat.Value; } }
public static ImageFormat Jpeg => s_JpegFormat.Value;
public static ImageFormat Png => s_PngFormat.Value;
public static ImageFormat Bmp => s_BmpFormat.Value;
public static ImageFormat Tga => s_TgaFormat.Value;
/// <summary>
/// Desereialize color map from <paramref name="input"/> stream, consisting of specified number of