mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 14:08:49 +00:00
refactor: use Optional nuget instead of custom Optional<> struct
This commit is contained in:
parent
c824467845
commit
67387f567d
@ -71,6 +71,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1"/>
|
||||
<PackageReference Include="Optional" Version="4.0.0"/>
|
||||
<PackageReference Include="System.Drawing.Common" Version="7.0.0"/>
|
||||
<PackageReference Include="System.Reactive" Version="5.0.0"/>
|
||||
<PackageReference Include="X10D" Version="3.2.0"/>
|
||||
|
@ -96,20 +96,9 @@ public class VirtualParadiseModelObject : VirtualParadiseObject
|
||||
|
||||
base.ExtractFromBuilder(builder);
|
||||
|
||||
if (modelObjectBuilder.Model.HasValue)
|
||||
{
|
||||
Model = modelObjectBuilder.Model.Value!;
|
||||
}
|
||||
|
||||
if (modelObjectBuilder.Description.HasValue)
|
||||
{
|
||||
Description = modelObjectBuilder.Description.Value!;
|
||||
}
|
||||
|
||||
if (modelObjectBuilder.Action.HasValue)
|
||||
{
|
||||
Action = modelObjectBuilder.Action.Value!;
|
||||
}
|
||||
Model = modelObjectBuilder.Model.ValueOr(Model);
|
||||
Description = modelObjectBuilder.Description.ValueOr(Description);
|
||||
Action = modelObjectBuilder.Action.ValueOr(Action);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -1,4 +1,5 @@
|
||||
using VpSharp.Internal;
|
||||
using Optional;
|
||||
using VpSharp.Internal;
|
||||
using static VpSharp.Internal.NativeAttributes.StringAttribute;
|
||||
using static VpSharp.Internal.NativeMethods;
|
||||
|
||||
@ -22,19 +23,19 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
|
||||
/// Gets or sets the value of this object's <c>Action</c> field.
|
||||
/// </summary>
|
||||
/// <value>The value of this object's <c>Action</c> field, or <see langword="default" /> to leave unchanged.</value>
|
||||
public Optional<string> Action { get; set; }
|
||||
public Option<string> Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of this object's <c>Description</c> field.
|
||||
/// </summary>
|
||||
/// <value>The value of this object's <c>Description</c> field, or <see langword="default" /> to leave unchanged.</value>
|
||||
public Optional<string> Description { get; set; }
|
||||
public Option<string> Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of this object's <c>Model</c> field.
|
||||
/// </summary>
|
||||
/// <value>The value of this object's <c>Model</c> field, or <see langword="default" /> to leave unchanged.</value>
|
||||
public Optional<string> Model { get; set; }
|
||||
public Option<string> Model { get; set; }
|
||||
|
||||
internal override void ApplyChanges()
|
||||
{
|
||||
@ -42,8 +43,8 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui
|
||||
|
||||
nint handle = Client.NativeInstanceHandle;
|
||||
var targetObject = (VirtualParadiseModelObject)TargetObject;
|
||||
vp_string_set(handle, ObjectModel, Model.HasValue ? Model.Value! : targetObject.Model);
|
||||
vp_string_set(handle, ObjectDescription, Description.HasValue ? Description.Value! : targetObject.Description);
|
||||
vp_string_set(handle, ObjectAction, Action.HasValue ? Action.Value! : targetObject.Action);
|
||||
vp_string_set(handle, ObjectModel, Model.ValueOr(targetObject.Model));
|
||||
vp_string_set(handle, ObjectDescription, Description.ValueOr(targetObject.Description));
|
||||
vp_string_set(handle, ObjectAction, Action.ValueOr(targetObject.Action));
|
||||
}
|
||||
}
|
||||
|
@ -240,35 +240,13 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
|
||||
ArgumentNullException.ThrowIfNull(builder);
|
||||
|
||||
Location location = Location;
|
||||
Vector3d position = location.Position;
|
||||
Rotation rotation = location.Rotation;
|
||||
|
||||
if (builder.Position.HasValue)
|
||||
{
|
||||
position = builder.Position.Value;
|
||||
}
|
||||
|
||||
if (builder.Rotation.HasValue)
|
||||
{
|
||||
rotation = builder.Rotation.Value;
|
||||
}
|
||||
Vector3d position = builder.Position.ValueOr(location.Position);
|
||||
Rotation rotation = builder.Rotation.ValueOr(location.Rotation);
|
||||
|
||||
Location = new Location(location.World, position, rotation);
|
||||
|
||||
if (builder.Data.HasValue)
|
||||
{
|
||||
Data = builder.Data.Value!.ToArray();
|
||||
}
|
||||
|
||||
if (builder.ModificationTimestamp.HasValue)
|
||||
{
|
||||
ModificationTimestamp = builder.ModificationTimestamp.Value;
|
||||
}
|
||||
|
||||
if (builder.Owner.HasValue)
|
||||
{
|
||||
Owner = builder.Owner.Value!;
|
||||
}
|
||||
Data = builder.Data.ValueOr(Data).ToArray();
|
||||
ModificationTimestamp = builder.ModificationTimestamp.ValueOr(ModificationTimestamp);
|
||||
Owner = builder.Owner.ValueOr(Owner);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,4 +1,5 @@
|
||||
using VpSharp.Internal;
|
||||
using Optional;
|
||||
using VpSharp.Internal;
|
||||
using static VpSharp.Internal.NativeAttributes.DataAttribute;
|
||||
using static VpSharp.Internal.NativeAttributes.FloatAttribute;
|
||||
using static VpSharp.Internal.NativeAttributes.IntegerAttribute;
|
||||
@ -32,7 +33,7 @@ public abstract class VirtualParadiseObjectBuilder
|
||||
/// This property may only be set during an object load, and will throw <see cref="InvalidOperationException" /> at
|
||||
/// any other point.
|
||||
/// </remarks>
|
||||
public Optional<DateTimeOffset> ModificationTimestamp { get; set; }
|
||||
public Option<DateTimeOffset> ModificationTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the owner of this object.
|
||||
@ -42,21 +43,21 @@ public abstract class VirtualParadiseObjectBuilder
|
||||
/// This property may only be set during an object load, and will throw <see cref="InvalidOperationException" /> at
|
||||
/// any other point.
|
||||
/// </remarks>
|
||||
public Optional<VirtualParadiseUser> Owner { get; set; }
|
||||
public Option<VirtualParadiseUser> Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position of the object.
|
||||
/// </summary>
|
||||
/// <value>The position of the object, or <see langword="default" /> to leave unchanged.</value>
|
||||
public Optional<Vector3d> Position { get; set; }
|
||||
public Option<Vector3d> Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the rotation of the object.
|
||||
/// </summary>
|
||||
/// <value>The rotation of the object, or <see langword="default" /> to leave unchanged.</value>
|
||||
public Optional<Rotation> Rotation { get; set; }
|
||||
public Option<Rotation> Rotation { get; set; }
|
||||
|
||||
internal Optional<IReadOnlyList<byte>> Data { get; set; }
|
||||
internal Option<IReadOnlyList<byte>> Data { get; set; }
|
||||
|
||||
private protected VirtualParadiseClient Client { get; }
|
||||
|
||||
@ -76,76 +77,49 @@ public abstract class VirtualParadiseObjectBuilder
|
||||
private void ApplyData()
|
||||
{
|
||||
nint handle = Client.NativeInstanceHandle;
|
||||
if (Data.HasValue)
|
||||
{
|
||||
IReadOnlyList<byte> data = Data.Value!;
|
||||
_ = vp_data_set(handle, ObjectData, data.Count, data.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = vp_data_set(handle, ObjectData, 0, Array.Empty<byte>());
|
||||
}
|
||||
byte[] data = Data.ValueOr(ArraySegment<byte>.Empty).ToArray();
|
||||
_ = vp_data_set(handle, ObjectData, data.Length, data);
|
||||
}
|
||||
|
||||
private void ApplyOwner()
|
||||
{
|
||||
nint handle = Client.NativeInstanceHandle;
|
||||
if (Owner.HasValue)
|
||||
{
|
||||
if (Mode != ObjectBuilderMode.Load)
|
||||
{
|
||||
throw new InvalidOperationException("Owner can only be assigned during an object load.");
|
||||
}
|
||||
|
||||
_ = vp_int_set(handle, ObjectUserId, Owner.Value!.Id);
|
||||
}
|
||||
else
|
||||
if (Owner.HasValue && Mode != ObjectBuilderMode.Load)
|
||||
{
|
||||
_ = vp_int_set(handle, ObjectUserId, TargetObject.Owner.Id);
|
||||
throw new InvalidOperationException("Owner can only be assigned during an object load.");
|
||||
}
|
||||
|
||||
VirtualParadiseUser oldOwner = TargetObject.Owner;
|
||||
_ = vp_int_set(handle, ObjectUserId, Owner.ValueOr(oldOwner).Id);
|
||||
}
|
||||
|
||||
private void ApplyModificationTimestamp()
|
||||
{
|
||||
nint handle = Client.NativeInstanceHandle;
|
||||
|
||||
if (ModificationTimestamp.HasValue)
|
||||
if (ModificationTimestamp.HasValue && Mode != ObjectBuilderMode.Load)
|
||||
{
|
||||
if (Mode != ObjectBuilderMode.Load)
|
||||
{
|
||||
throw new InvalidOperationException("Modification timestamp can only be assigned during an object load.");
|
||||
}
|
||||
throw new InvalidOperationException("Modification timestamp can only be assigned during an object load.");
|
||||
}
|
||||
|
||||
_ = vp_int_set(handle, ObjectTime, (int)ModificationTimestamp.Value.ToUnixTimeSeconds());
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = vp_int_set(handle, ObjectTime, (int)TargetObject.ModificationTimestamp.ToUnixTimeSeconds());
|
||||
}
|
||||
DateTimeOffset oldTimestamp = TargetObject.ModificationTimestamp;
|
||||
_ = vp_int_set(handle, ObjectTime, (int)ModificationTimestamp.ValueOr(oldTimestamp).ToUnixTimeSeconds());
|
||||
}
|
||||
|
||||
private void ApplyPosition()
|
||||
{
|
||||
nint handle = Client.NativeInstanceHandle;
|
||||
|
||||
if (Position.HasValue)
|
||||
{
|
||||
(double x, double y, double z) = Position.Value;
|
||||
_ = vp_double_set(handle, ObjectX, x);
|
||||
_ = vp_double_set(handle, ObjectY, y);
|
||||
_ = vp_double_set(handle, ObjectZ, z);
|
||||
}
|
||||
else if (Mode == ObjectBuilderMode.Create)
|
||||
if (!Position.HasValue && Mode == ObjectBuilderMode.Create)
|
||||
{
|
||||
throw new ArgumentException("Position must be assigned when creating a new object.");
|
||||
}
|
||||
else
|
||||
{
|
||||
(double x, double y, double z) = TargetObject.Location.Position;
|
||||
_ = vp_double_set(handle, ObjectX, x);
|
||||
_ = vp_double_set(handle, ObjectY, y);
|
||||
_ = vp_double_set(handle, ObjectZ, z);
|
||||
}
|
||||
|
||||
(double x, double y, double z) = Position.ValueOr(TargetObject.Location.Position);
|
||||
_ = vp_double_set(handle, ObjectX, x);
|
||||
_ = vp_double_set(handle, ObjectY, y);
|
||||
_ = vp_double_set(handle, ObjectZ, z);
|
||||
}
|
||||
|
||||
private void ApplyRotation()
|
||||
@ -154,24 +128,13 @@ public abstract class VirtualParadiseObjectBuilder
|
||||
|
||||
if (!Rotation.HasValue && Mode == ObjectBuilderMode.Create)
|
||||
{
|
||||
Rotation = VpSharp.Rotation.None;
|
||||
Rotation = Option.Some(VpSharp.Rotation.None);
|
||||
}
|
||||
|
||||
if (Rotation.HasValue)
|
||||
{
|
||||
(double x, double y, double z, double angle) = Rotation.Value;
|
||||
_ = vp_double_set(handle, ObjectRotationX, x);
|
||||
_ = vp_double_set(handle, ObjectRotationY, y);
|
||||
_ = vp_double_set(handle, ObjectRotationZ, z);
|
||||
_ = vp_double_set(handle, ObjectRotationAngle, angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
(double x, double y, double z, double angle) = TargetObject.Location.Rotation;
|
||||
_ = vp_double_set(handle, ObjectRotationX, x);
|
||||
_ = vp_double_set(handle, ObjectRotationY, y);
|
||||
_ = vp_double_set(handle, ObjectRotationZ, z);
|
||||
_ = vp_double_set(handle, ObjectRotationAngle, angle);
|
||||
}
|
||||
(double x, double y, double z, double angle) = Rotation.ValueOr(TargetObject.Location.Rotation);
|
||||
_ = vp_double_set(handle, ObjectRotationX, x);
|
||||
_ = vp_double_set(handle, ObjectRotationY, y);
|
||||
_ = vp_double_set(handle, ObjectRotationZ, z);
|
||||
_ = vp_double_set(handle, ObjectRotationAngle, angle);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Drawing;
|
||||
using Optional;
|
||||
using VpSharp.Internal;
|
||||
using VpSharp.Internal.Attributes;
|
||||
using VpSharp.Internal.ValueConverters;
|
||||
@ -29,7 +30,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum acceleration, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("acceleration_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> AccelerationMax { get; set; }
|
||||
public Option<Vector3d> AccelerationMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum acceleration.
|
||||
@ -37,7 +38,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum acceleration, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("acceleration_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> AccelerationMin { get; set; }
|
||||
public Option<Vector3d> AccelerationMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blend mode.
|
||||
@ -45,7 +46,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The blend mode, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("blend")]
|
||||
[ValueConverter(typeof(StringToEnumConverter<ParticleBlendMode>))]
|
||||
public Optional<ParticleBlendMode> BlendMode { get; set; }
|
||||
public Option<ParticleBlendMode> BlendMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum color.
|
||||
@ -53,7 +54,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum color, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("color_max")]
|
||||
[ValueConverter(typeof(HexToColorConverter))]
|
||||
public Optional<Color> ColorMax { get; set; }
|
||||
public Option<Color> ColorMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum color.
|
||||
@ -61,7 +62,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum color, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("color_min")]
|
||||
[ValueConverter(typeof(HexToColorConverter))]
|
||||
public Optional<Color> ColorMin { get; set; }
|
||||
public Option<Color> ColorMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the emitter lifespan.
|
||||
@ -69,7 +70,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The emitter lifespan, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("emitter_lifespan")]
|
||||
[ValueConverter(typeof(MillisecondToTimeSpanConverter))]
|
||||
public Optional<TimeSpan> EmitterLifespan { get; set; }
|
||||
public Option<TimeSpan> EmitterLifespan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this emitter interpolates its values.
|
||||
@ -80,14 +81,14 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </value>
|
||||
[SerializationKey("interpolate")]
|
||||
[ValueConverter(typeof(IntToBoolConverter))]
|
||||
public Optional<bool> Interpolate { get; set; }
|
||||
public Option<bool> Interpolate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the opacity.
|
||||
/// </summary>
|
||||
/// <value>The opacity, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("opacity")]
|
||||
public Optional<double> Opacity { get; set; }
|
||||
public Option<double> Opacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the particle lifespan.
|
||||
@ -95,7 +96,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The particle lifespan, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("particle_lifespan")]
|
||||
[ValueConverter(typeof(MillisecondToTimeSpanConverter))]
|
||||
public Optional<TimeSpan> ParticleLifespan { get; set; }
|
||||
public Option<TimeSpan> ParticleLifespan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the particle type.
|
||||
@ -103,14 +104,14 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The particle type, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("particle_type")]
|
||||
[ValueConverter(typeof(StringToEnumConverter<ParticleType>))]
|
||||
public Optional<ParticleType> ParticleType { get; set; }
|
||||
public Option<ParticleType> ParticleType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release count.
|
||||
/// </summary>
|
||||
/// <value>The release count, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("release_count")]
|
||||
public Optional<int> ReleaseCount { get; set; }
|
||||
public Option<int> ReleaseCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release time.
|
||||
@ -118,7 +119,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The release time, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("release_time")]
|
||||
[ValueConverter(typeof(MillisecondToTimeSpanConverter))]
|
||||
public Optional<TimeSpan> ReleaseTime { get; set; }
|
||||
public Option<TimeSpan> ReleaseTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum size.
|
||||
@ -126,7 +127,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum size, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("size_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SizeMax { get; set; }
|
||||
public Option<Vector3d> SizeMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum size.
|
||||
@ -134,7 +135,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum size, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("size_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SizeMin { get; set; }
|
||||
public Option<Vector3d> SizeMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum speed.
|
||||
@ -142,7 +143,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum speed, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("speed_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SpeedMax { get; set; }
|
||||
public Option<Vector3d> SpeedMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum speed.
|
||||
@ -150,7 +151,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum speed, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("speed_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SpeedMin { get; set; }
|
||||
public Option<Vector3d> SpeedMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum spin.
|
||||
@ -158,7 +159,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum spin, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("spin_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SpinMax { get; set; }
|
||||
public Option<Vector3d> SpinMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum spin.
|
||||
@ -166,7 +167,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum spin, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("spin_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> SpinMin { get; set; }
|
||||
public Option<Vector3d> SpinMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum start angle.
|
||||
@ -174,7 +175,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum start angle, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("start_angle_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> StartAngleMax { get; set; }
|
||||
public Option<Vector3d> StartAngleMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum start angle.
|
||||
@ -182,7 +183,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum start angle, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("start_angle_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> StartAngleMin { get; set; }
|
||||
public Option<Vector3d> StartAngleMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum volume.
|
||||
@ -190,7 +191,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The maximum volume, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("volume_max")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> VolumeMax { get; set; }
|
||||
public Option<Vector3d> VolumeMax { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum volume.
|
||||
@ -198,28 +199,28 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <value>The minimum volume, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("volume_min")]
|
||||
[ValueConverter(typeof(Vector3dConverter))]
|
||||
public Optional<Vector3d> VolumeMin { get; set; }
|
||||
public Option<Vector3d> VolumeMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tag.
|
||||
/// </summary>
|
||||
/// <value>The tag, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("tag")]
|
||||
public Optional<string> Tag { get; set; }
|
||||
public Option<string> Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the texture.
|
||||
/// </summary>
|
||||
/// <value>The texture, or <see langword="default" /> to leave unchanged.</value>
|
||||
[SerializationKey("texture")]
|
||||
public Optional<string> Texture { get; set; }
|
||||
public Option<string> Texture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the maximum volume.
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum volume, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMax(Option<Vector3d> value)
|
||||
{
|
||||
AccelerationMax = value;
|
||||
return this;
|
||||
@ -230,7 +231,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum acceleration, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMin(Option<Vector3d> value)
|
||||
{
|
||||
AccelerationMin = value;
|
||||
return this;
|
||||
@ -241,7 +242,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The blend mode, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithBlendMode(Optional<ParticleBlendMode> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithBlendMode(Option<ParticleBlendMode> value)
|
||||
{
|
||||
BlendMode = value;
|
||||
return this;
|
||||
@ -252,7 +253,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum color, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithColorMax(Optional<Color> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithColorMax(Option<Color> value)
|
||||
{
|
||||
ColorMax = value;
|
||||
return this;
|
||||
@ -263,7 +264,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum color, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithColorMin(Optional<Color> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithColorMin(Option<Color> value)
|
||||
{
|
||||
ColorMin = value;
|
||||
return this;
|
||||
@ -274,7 +275,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The emitter lifespan, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithEmitterLifespan(Optional<TimeSpan> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithEmitterLifespan(Option<TimeSpan> value)
|
||||
{
|
||||
EmitterLifespan = value;
|
||||
return this;
|
||||
@ -288,7 +289,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <see langword="default" /> to leave unchanged.
|
||||
/// </param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithInterpolation(Optional<bool> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithInterpolation(Option<bool> value)
|
||||
{
|
||||
Interpolate = value;
|
||||
return this;
|
||||
@ -299,7 +300,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The opacity, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithOpacity(Optional<double> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithOpacity(Option<double> value)
|
||||
{
|
||||
Opacity = value;
|
||||
return this;
|
||||
@ -310,7 +311,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The particle lifespan, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithParticleLifespan(Optional<TimeSpan> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithParticleLifespan(Option<TimeSpan> value)
|
||||
{
|
||||
ParticleLifespan = value;
|
||||
return this;
|
||||
@ -321,7 +322,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The particle type, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithParticleType(Optional<ParticleType> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithParticleType(Option<ParticleType> value)
|
||||
{
|
||||
ParticleType = value;
|
||||
return this;
|
||||
@ -332,7 +333,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The release count, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithReleaseCount(Optional<int> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithReleaseCount(Option<int> value)
|
||||
{
|
||||
ReleaseCount = value;
|
||||
return this;
|
||||
@ -343,7 +344,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The release time, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithReleaseTime(Optional<TimeSpan> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithReleaseTime(Option<TimeSpan> value)
|
||||
{
|
||||
ReleaseTime = value;
|
||||
return this;
|
||||
@ -354,7 +355,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum size, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSizeMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSizeMax(Option<Vector3d> value)
|
||||
{
|
||||
SizeMax = value;
|
||||
return this;
|
||||
@ -365,7 +366,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum size, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSizeMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSizeMin(Option<Vector3d> value)
|
||||
{
|
||||
SizeMin = value;
|
||||
return this;
|
||||
@ -376,7 +377,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum speed, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMax(Option<Vector3d> value)
|
||||
{
|
||||
SpeedMax = value;
|
||||
return this;
|
||||
@ -387,7 +388,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum speed, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMin(Option<Vector3d> value)
|
||||
{
|
||||
SpeedMin = value;
|
||||
return this;
|
||||
@ -398,7 +399,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum spin, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpinMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpinMax(Option<Vector3d> value)
|
||||
{
|
||||
SpinMax = value;
|
||||
return this;
|
||||
@ -409,7 +410,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum spin, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpinMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithSpinMin(Option<Vector3d> value)
|
||||
{
|
||||
SpinMin = value;
|
||||
return this;
|
||||
@ -420,7 +421,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum start angle, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMax(Option<Vector3d> value)
|
||||
{
|
||||
StartAngleMax = value;
|
||||
return this;
|
||||
@ -431,7 +432,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum start angle, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMin(Option<Vector3d> value)
|
||||
{
|
||||
StartAngleMin = value;
|
||||
return this;
|
||||
@ -442,7 +443,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum volume, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMax(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMax(Option<Vector3d> value)
|
||||
{
|
||||
VolumeMax = value;
|
||||
return this;
|
||||
@ -453,7 +454,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The minimum volume, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMin(Optional<Vector3d> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMin(Option<Vector3d> value)
|
||||
{
|
||||
VolumeMin = value;
|
||||
return this;
|
||||
@ -464,7 +465,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The tag, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithTag(Optional<string> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithTag(Option<string> value)
|
||||
{
|
||||
Tag = value;
|
||||
return this;
|
||||
@ -475,7 +476,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// </summary>
|
||||
/// <param name="value">The texture, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithTexture(Optional<string> value)
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithTexture(Option<string> value)
|
||||
{
|
||||
Texture = value;
|
||||
return this;
|
||||
|
@ -1,108 +0,0 @@
|
||||
namespace VpSharp;
|
||||
|
||||
#pragma warning disable CA1716
|
||||
#pragma warning disable CA2225
|
||||
|
||||
/// <summary>
|
||||
/// Represents an optional value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the value.</typeparam>
|
||||
public readonly struct Optional<T> : IEquatable<Optional<T>>
|
||||
{
|
||||
private readonly T? _value;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Optional{T}" /> struct.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
public Optional(T? value)
|
||||
{
|
||||
HasValue = true;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="Optional{T}" /> has a value.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if a value is defined; otherwise, <see langword="false" />.</value>
|
||||
public bool HasValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying value of this optional.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public T? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!HasValue)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot access the value of a valueless optional.");
|
||||
}
|
||||
|
||||
return _value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether two instances of <see cref="Optional{T}" /> are equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Optional{T}" />.</param>
|
||||
/// <param name="right">The second <see cref="Optional{T}" />.</param>
|
||||
/// <value><see langword="true" /> if the two instances are equal; otherwise, <see langword="false" />.</value>
|
||||
public static bool operator ==(Optional<T> left, Optional<T> right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether two instances of <see cref="Optional{T}" /> are not equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first <see cref="Optional{T}" />.</param>
|
||||
/// <param name="right">The second <see cref="Optional{T}" />.</param>
|
||||
/// <value><see langword="true" /> if the two instances are not equal; otherwise, <see langword="false" />.</value>
|
||||
public static bool operator !=(Optional<T> left, Optional<T> right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts a value to a new instance of <see cref="Optional{T}" />.
|
||||
/// </summary>
|
||||
/// <returns>A new instance of <see cref="Optional{T}" />, wrapping <paramref name="value" />.</returns>
|
||||
public static implicit operator Optional<T>(T? value)
|
||||
{
|
||||
return new Optional<T>(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implicitly converts a value to a new instance of <see cref="Optional{T}" />.
|
||||
/// </summary>
|
||||
/// <returns>A new instance of <see cref="Optional{T}" />, wrapping <paramref name="value" />.</returns>
|
||||
public static explicit operator T?(Optional<T?> value)
|
||||
{
|
||||
return value.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether this <see cref="Optional{T}" /> and another <see cref="Optional{T}" /> are equal.
|
||||
/// </summary>
|
||||
/// <param name="other">The other <see cref="Optional{T}" />.</param>
|
||||
/// <value><see langword="true" /> if the two instances are equal; otherwise, <see langword="false" />.</value>
|
||||
public bool Equals(Optional<T> other)
|
||||
{
|
||||
return HasValue == other.HasValue && EqualityComparer<T?>.Default.Equals(Value, other._value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Optional<T> other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(HasValue, Value);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
using Optional;
|
||||
using VpSharp.Internal;
|
||||
using VpSharp.Internal.Attributes;
|
||||
using VpSharp.Internal.ValueConverters;
|
||||
@ -25,28 +26,28 @@ public sealed class WorldSettingsBuilder
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if the debug menu is enabled; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("allow_debug_menu")]
|
||||
public bool? AllowDebugMenu { get; set; }
|
||||
public Option<bool> AllowDebugMenu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether flying is enabled.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if flying is enabled; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("allow_flight")]
|
||||
public bool? AllowFlight { get; set; }
|
||||
public Option<bool> AllowFlight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether pass-through is enabled.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if pass-through is enabled; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("allow_passthrough")]
|
||||
public bool? AllowPassThrough { get; set; }
|
||||
public Option<bool> AllowPassThrough { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the avatar list file in the object path.
|
||||
/// </summary>
|
||||
/// <value>The name of the avatar list file in the object path..</value>
|
||||
[SerializationKey("avatar")]
|
||||
public string? AvatarsFile { get; set; }
|
||||
public Option<string> AvatarsFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the entry position of the world, also known as "landing zone" (LZ) or "ground zero" (GZ).
|
||||
@ -54,7 +55,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The entry position of the world.</value>
|
||||
[SerializationKey("entry_point")]
|
||||
[ValueConverter(typeof(Vector4ToVector3Converter))]
|
||||
public Vector3? EntryPosition { get; set; }
|
||||
public Option<Vector3> EntryPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the entry yaw of the world.
|
||||
@ -62,28 +63,28 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The entry yaw of the world.</value>
|
||||
[SerializationKey("entry_point")]
|
||||
[ValueConverter(typeof(VectorToNthComponentConverter), 4)]
|
||||
public float? EntryYaw { get; set; }
|
||||
public Option<float> EntryYaw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the camera's far-plane distance in decameters.
|
||||
/// </summary>
|
||||
/// <value>The camera's far-plane distance, in decameters.</value>
|
||||
[SerializationKey("farplane")]
|
||||
public float? FarPlane { get; set; }
|
||||
public Option<float> FarPlane { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the camera's field of view.
|
||||
/// </summary>
|
||||
/// <value>The camera's field of view.</value>
|
||||
[SerializationKey("fov")]
|
||||
public float? FieldOfView { get; set; }
|
||||
public Option<float> FieldOfView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the distance at which fog begins.
|
||||
/// </summary>
|
||||
/// <value>The distance at which fog begins.</value>
|
||||
[SerializationKey("fog_begin")]
|
||||
public float? FogBegin { get; set; }
|
||||
public Option<float> FogBegin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fog color.
|
||||
@ -91,21 +92,21 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The fog color.</value>
|
||||
[SerializationKey("fog_color")]
|
||||
[ValueConverter(typeof(HexToColorConverter))]
|
||||
public Color? FogColor { get; set; }
|
||||
public Option<Color> FogColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the density of the fog.
|
||||
/// </summary>
|
||||
/// <value>The density of the fog.</value>
|
||||
[SerializationKey("fog_density")]
|
||||
public float? FogDensity { get; set; }
|
||||
public Option<float> FogDensity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the distance at which fog ends.
|
||||
/// </summary>
|
||||
/// <value>The distance at which fog ends.</value>
|
||||
[SerializationKey("fog_end")]
|
||||
public float? FogEnd { get; set; }
|
||||
public Option<float> FogEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fog mode.
|
||||
@ -113,63 +114,63 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The fog mode.</value>
|
||||
[SerializationKey("fog_mode")]
|
||||
[ValueConverter(typeof(StringToEnumConverter<FogMode>))]
|
||||
public FogMode? FogMode { get; set; }
|
||||
public Option<FogMode> FogMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ground object.
|
||||
/// </summary>
|
||||
/// <value>The ground object. This value will be empty if <see cref="Terrain" /> is <see langword="true" />.</value>
|
||||
[SerializationKey("ground")]
|
||||
public string? Ground { get; set; }
|
||||
public Option<string> Ground { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the ground object specified by <see cref="Ground" /> should repeat.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if the ground should repeat; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("groundrepeats")]
|
||||
public bool? GroundRepeats { get; set; }
|
||||
public Option<bool> GroundRepeats { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the camera's near-plane distance in decameters.
|
||||
/// </summary>
|
||||
/// <value>The camera's near-plane distance, in decameters.</value>
|
||||
[SerializationKey("nearplane")]
|
||||
public float? NearPlane { get; set; }
|
||||
public Option<float> NearPlane { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password for extracting password-protected ZIP files from the object path.
|
||||
/// </summary>
|
||||
/// <value>The password for extracting password-protected ZIP files from the object path.</value>
|
||||
[SerializationKey("objectpassword")]
|
||||
public string? ObjectPassword { get; set; }
|
||||
public Option<string> ObjectPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the object path.
|
||||
/// </summary>
|
||||
/// <value>The object path.</value>
|
||||
[SerializationKey("objectpath")]
|
||||
public string? ObjectPath { get; set; }
|
||||
public Option<string> ObjectPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether per-pixel lighting is recommended.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if per-pixel lighting is recommended; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("recommended_per_pixel_lighting")]
|
||||
public bool? PerPixelLightingRecommended { get; set; }
|
||||
public Option<bool> PerPixelLightingRecommended { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the speed at which users run.
|
||||
/// </summary>
|
||||
/// <value>The speed at which users run.</value>
|
||||
[SerializationKey("run_speed")]
|
||||
public float? RunSpeed { get; set; }
|
||||
public Option<float> RunSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether gradient sky is enabled.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if gradient sky is enabled; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("sky")]
|
||||
public bool? Sky { get; set; }
|
||||
public Option<bool> Sky { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color for the first sky cloud layer.
|
||||
@ -177,7 +178,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The color for the first sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds1_color")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyClouds1Color { get; set; }
|
||||
public Option<ColorF> SkyClouds1Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color for the second sky cloud layer.
|
||||
@ -185,7 +186,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The color for the second sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds2_color")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyClouds2Color { get; set; }
|
||||
public Option<ColorF> SkyClouds2Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scale for the first sky cloud layer.
|
||||
@ -193,7 +194,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The scale for the first sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds1_scale")]
|
||||
[ValueConverter(typeof(Vector2Converter))]
|
||||
public Vector2? SkyClouds1Scale { get; set; }
|
||||
public Option<Vector2> SkyClouds1Scale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scale for the second sky cloud layer.
|
||||
@ -201,21 +202,21 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The scale for the second sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds2_scale")]
|
||||
[ValueConverter(typeof(Vector2Converter))]
|
||||
public Vector2? SkyClouds2Scale { get; set; }
|
||||
public Option<Vector2> SkyClouds2Scale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the texture for the first sky cloud layer.
|
||||
/// </summary>
|
||||
/// <value>The texture for the first sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds1")]
|
||||
public string? SkyClouds1Texture { get; set; }
|
||||
public Option<string> SkyClouds1Texture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the texture for the second sky cloud layer.
|
||||
/// </summary>
|
||||
/// <value>The texture for the second sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds2")]
|
||||
public string? SkyClouds2Texture { get; set; }
|
||||
public Option<string> SkyClouds2Texture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the velocity for the first sky cloud layer.
|
||||
@ -223,7 +224,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The velocity for the first sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds1_velocity")]
|
||||
[ValueConverter(typeof(Vector2Converter))]
|
||||
public Vector2? SkyClouds1Velocity { get; set; }
|
||||
public Option<Vector2> SkyClouds1Velocity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the velocity for the second sky cloud layer.
|
||||
@ -231,7 +232,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The velocity for the second sky cloud layer.</value>
|
||||
[SerializationKey("sky_clouds2_velocity")]
|
||||
[ValueConverter(typeof(Vector2Converter))]
|
||||
public Vector2? SkyClouds2Velocity { get; set; }
|
||||
public Option<Vector2> SkyClouds2Velocity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the first sky gradient color.
|
||||
@ -239,7 +240,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The first sky gradient color.</value>
|
||||
[SerializationKey("sky_color1")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyColor1 { get; set; }
|
||||
public Option<ColorF> SkyColor1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the second sky gradient color.
|
||||
@ -247,7 +248,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The second sky gradient color.</value>
|
||||
[SerializationKey("sky_color2")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyColor2 { get; set; }
|
||||
public Option<ColorF> SkyColor2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the third sky gradient color.
|
||||
@ -255,7 +256,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The third sky gradient color.</value>
|
||||
[SerializationKey("sky_color3")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyColor3 { get; set; }
|
||||
public Option<ColorF> SkyColor3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fourth sky gradient color.
|
||||
@ -263,7 +264,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The fourth sky gradient color.</value>
|
||||
[SerializationKey("sky_color4")]
|
||||
[ValueConverter(typeof(Vector4ToColorConverter))]
|
||||
public ColorF? SkyColor4 { get; set; }
|
||||
public Option<ColorF> SkyColor4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sky color space.
|
||||
@ -271,21 +272,21 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The sky color space.</value>
|
||||
[SerializationKey("sky_srgb_colors")]
|
||||
[ValueConverter(typeof(IntToEnumConverter<ColorSpace>))]
|
||||
public ColorSpace? SkyColorSpace { get; set; }
|
||||
public Option<ColorSpace> SkyColorSpace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the skybox texture.
|
||||
/// </summary>
|
||||
/// <value>The skybox texture.</value>
|
||||
[SerializationKey("skybox")]
|
||||
public string? Skybox { get; set; }
|
||||
public Option<string> Skybox { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the file extension for skybox textures.
|
||||
/// </summary>
|
||||
/// <value>The file extension for skybox textures.</value>
|
||||
[SerializationKey("skybox_extension")]
|
||||
public string? SkyboxExtension { get; set; }
|
||||
public Option<string> SkyboxExtension { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the X axis of skybox textures should be swapped.
|
||||
@ -295,49 +296,49 @@ public sealed class WorldSettingsBuilder
|
||||
/// </value>
|
||||
/// <remarks>If <see langword="true" />, _lf and _rt faces are swapped.</remarks>
|
||||
[SerializationKey("skybox_extension")]
|
||||
public bool? SkyboxSwapX { get; set; }
|
||||
public Option<bool> SkyboxSwapX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether terrain is enabled.
|
||||
/// </summary>
|
||||
/// <value><see langword="true" /> if terrain is enabled; otherwise, <see langword="false" />.</value>
|
||||
[SerializationKey("terrain")]
|
||||
public bool? Terrain { get; set; }
|
||||
public Option<bool> Terrain { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the vertical offset for the terrain.
|
||||
/// </summary>
|
||||
/// <value>The vertical offset for the terrain.</value>
|
||||
[SerializationKey("terrainoffset")]
|
||||
public float? TerrainOffset { get; set; }
|
||||
public Option<float> TerrainOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scale factor for the terrain grid.
|
||||
/// </summary>
|
||||
/// <value>The scale factor for the terrain grid.</value>
|
||||
[SerializationKey("terrainscale")]
|
||||
public float? TerrainScale { get; set; }
|
||||
public Option<float> TerrainScale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the speed at which users walk.
|
||||
/// </summary>
|
||||
/// <value>The speed at which users walk.</value>
|
||||
[SerializationKey("walk_speed")]
|
||||
public float? WalkSpeed { get; set; }
|
||||
public Option<float> WalkSpeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the URL of the in-world web overlay.
|
||||
/// </summary>
|
||||
/// <value>The URL of the in-world web overlay.</value>
|
||||
[SerializationKey("web_overlay")]
|
||||
public string? WebOverlay { get; set; }
|
||||
public Option<string> WebOverlay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the welcome message.
|
||||
/// </summary>
|
||||
/// <value>The welcome message.</value>
|
||||
[SerializationKey("welcome")]
|
||||
public string? WelcomeMessage { get; set; }
|
||||
public Option<string> WelcomeMessage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ambient light color of the world.
|
||||
@ -345,7 +346,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The ambient light color.</value>
|
||||
[SerializationKey("worldlight_ambient")]
|
||||
[ValueConverter(typeof(Vector3ToColorConverter))]
|
||||
public ColorF? WorldLightAmbient { get; set; }
|
||||
public Option<ColorF> WorldLightAmbient { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the diffuse light color of the world.
|
||||
@ -353,7 +354,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The diffuse light color.</value>
|
||||
[SerializationKey("worldlight_diffuse")]
|
||||
[ValueConverter(typeof(Vector3ToColorConverter))]
|
||||
public ColorF? WorldLightDiffuse { get; set; }
|
||||
public Option<ColorF> WorldLightDiffuse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the world light position.
|
||||
@ -361,7 +362,7 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The world light position.</value>
|
||||
[SerializationKey("worldlight_position")]
|
||||
[ValueConverter(typeof(Vector3Converter))]
|
||||
public Vector3? WorldLightPosition { get; set; }
|
||||
public Option<Vector3> WorldLightPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the specular light color of the world.
|
||||
@ -369,14 +370,14 @@ public sealed class WorldSettingsBuilder
|
||||
/// <value>The specular light color.</value>
|
||||
[SerializationKey("worldlight_specular")]
|
||||
[ValueConverter(typeof(Vector3ToColorConverter))]
|
||||
public ColorF? WorldLightSpecular { get; set; }
|
||||
public Option<ColorF> WorldLightSpecular { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the world.
|
||||
/// </summary>
|
||||
/// <value>The name of the world.</value>
|
||||
[SerializationKey("worldname")]
|
||||
public string? WorldName { get; set; }
|
||||
public Option<string> WorldName { get; set; }
|
||||
|
||||
internal void SendChanges()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user