Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -16,14 +16,14 @@ namespace Content.Client.Parallax.Data;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class GeneratedParallaxTextureSource : IParallaxTextureSource
|
||||
public sealed partial class GeneratedParallaxTextureSource : IParallaxTextureSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Parallax config path (the TOML file).
|
||||
/// In client resources.
|
||||
/// </summary>
|
||||
[DataField("configPath")]
|
||||
public ResPath ParallaxConfigPath { get; } = new("/parallax_config.toml");
|
||||
public ResPath ParallaxConfigPath { get; private set; } = new("/parallax_config.toml");
|
||||
|
||||
/// <summary>
|
||||
/// ID for debugging, caching, and so forth.
|
||||
@@ -31,7 +31,7 @@ public sealed class GeneratedParallaxTextureSource : IParallaxTextureSource
|
||||
/// It is advisible to provide a roughly unique ID for any unique config contents.
|
||||
/// </summary>
|
||||
[DataField("id")]
|
||||
public string Identifier { get; } = "other";
|
||||
public string Identifier { get; private set; } = "other";
|
||||
|
||||
/// <summary>
|
||||
/// Cached path.
|
||||
|
||||
@@ -5,7 +5,7 @@ using Robust.Client.Graphics;
|
||||
namespace Content.Client.Parallax.Data
|
||||
{
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public interface IParallaxTextureSource
|
||||
public partial interface IParallaxTextureSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates or loads the texture.
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace Content.Client.Parallax.Data;
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public sealed class ImageParallaxTextureSource : IParallaxTextureSource
|
||||
public sealed partial class ImageParallaxTextureSource : IParallaxTextureSource
|
||||
{
|
||||
/// <summary>
|
||||
/// Texture path.
|
||||
/// </summary>
|
||||
[DataField("path", required: true)]
|
||||
public ResPath Path { get; } = default!;
|
||||
public ResPath Path { get; private set; } = default!;
|
||||
|
||||
Task<Texture> IParallaxTextureSource.GenerateTexture(CancellationToken cancel)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Content.Client.Parallax.Data;
|
||||
/// The configuration for a parallax layer.
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
public sealed class ParallaxLayerConfig
|
||||
public sealed partial class ParallaxLayerConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// The texture source for this layer.
|
||||
|
||||
@@ -15,23 +15,23 @@ public sealed class ParallaxPrototype : IPrototype
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Parallax layers.
|
||||
/// </summary>
|
||||
[DataField("layers")]
|
||||
public List<ParallaxLayerConfig> Layers { get; } = new();
|
||||
public List<ParallaxLayerConfig> Layers { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Parallax layers, low-quality.
|
||||
/// </summary>
|
||||
[DataField("layersLQ")]
|
||||
public List<ParallaxLayerConfig> LayersLQ { get; } = new();
|
||||
public List<ParallaxLayerConfig> LayersLQ { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// If low-quality layers don't exist for this parallax and high-quality should be used instead.
|
||||
/// </summary>
|
||||
[DataField("layersLQUseHQ")]
|
||||
public bool LayersLQUseHQ { get; } = true;
|
||||
public bool LayersLQUseHQ { get; private set; } = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user