Skip to content

Commit

Permalink
Packable ItemProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
Neakita committed Sep 5, 2024
1 parent 9fb8d8f commit 8c21ca1
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MemoryPack;
using SightKeeper.Domain.Model.DataSets.Poser3D;

namespace SightKeeper.Data.Binary.Model.DataSets.Tags;

/// <summary>
/// MemoryPackable version of <see cref="BooleanItemProperty"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackableBooleanItemProperty : PackableItemProperty
{
public PackableBooleanItemProperty(string name) : base(name)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using SightKeeper.Domain.Model.DataSets.Poser;

namespace SightKeeper.Data.Binary.Model.DataSets.Tags;

/// <summary>
/// MemoryPackable version of <see cref="ItemProperty"/>
/// </summary>
internal abstract class PackableItemProperty
{
public string Name { get; }

public PackableItemProperty(string name)
{
Name = name;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using MemoryPack;
using SightKeeper.Domain.Model.DataSets.Poser;

namespace SightKeeper.Data.Binary.Model.DataSets.Tags;

/// <summary>
/// MemoryPackable version of <see cref="NumericItemProperty"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackableNumericItemProperty : PackableItemProperty
{
public double MinimumValue { get; }
public double MaximumValue { get; }

public PackableNumericItemProperty(string name, double minimumValue, double maximumValue) : base(name)
{
MinimumValue = minimumValue;
MaximumValue = maximumValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ namespace SightKeeper.Data.Binary.Model.DataSets.Tags;
[MemoryPackable]
internal sealed partial class PackablePoser2DTag : PackablePoserTag
{
public ImmutableArray<PackableNumericItemProperty> NumericProperties { get; }

public PackablePoser2DTag(
byte id,
string name,
uint color,
ImmutableArray<PackableTag> keyPointTags)
ImmutableArray<PackableTag> keyPointTags,
ImmutableArray<PackableNumericItemProperty> numericProperties)
: base(id, name, color, keyPointTags)
{
NumericProperties = numericProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ namespace SightKeeper.Data.Binary.Model.DataSets.Tags;
[MemoryPackable]
internal sealed partial class PackablePoser3DTag : PackablePoserTag
{
public ImmutableArray<PackableNumericItemProperty> NumericProperties { get; }
public ImmutableArray<PackableBooleanItemProperty> BooleanProperties { get; }

public PackablePoser3DTag(
byte id,
string name,
uint color,
ImmutableArray<PackableTag> keyPointTags)
ImmutableArray<PackableTag> keyPointTags,
ImmutableArray<PackableNumericItemProperty> numericProperties,
ImmutableArray<PackableBooleanItemProperty> booleanProperties)
: base(id, name, color, keyPointTags)
{
NumericProperties = numericProperties;
BooleanProperties = booleanProperties;
}
}
5 changes: 1 addition & 4 deletions SightKeeper.Domain/Model/DataSets/Poser/ItemProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ public string Name
{
get => _name;
[MemberNotNull(nameof(_name))]
set
{
_name = value;
}
set => _name = value;
}

protected ItemProperty(string name)
Expand Down

0 comments on commit 8c21ca1

Please sign in to comment.