diff --git a/Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj b/Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj index 1d3086f..d25277e 100644 --- a/Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj +++ b/Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj @@ -8,17 +8,17 @@ - - + + - - Always - - - Always - + + Always + + + Always + diff --git a/Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj b/Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj index 23db2fe..2467d8b 100644 --- a/Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj +++ b/Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj @@ -8,17 +8,17 @@ - - + + - - Always - - - Always - + + Always + + + Always + - + \ No newline at end of file diff --git a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs index f008b13..eccdf64 100644 --- a/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs +++ b/VpSharp.Commands/Attributes/ExecutionChecks/RequireUserNameAttribute.cs @@ -54,7 +54,7 @@ public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute throw new ArgumentNullException(nameof(context)); } - VirtualParadiseUser user = await context.Avatar.GetUserAsync().ConfigureAwait(false); + User user = await context.Avatar.GetUserAsync().ConfigureAwait(false); return Names.Contains(user.Name); } } diff --git a/VpSharp.Commands/CommandContext.cs b/VpSharp.Commands/CommandContext.cs index ce2f9d9..9120e97 100644 --- a/VpSharp.Commands/CommandContext.cs +++ b/VpSharp.Commands/CommandContext.cs @@ -9,7 +9,7 @@ namespace VpSharp.Commands; /// public sealed class CommandContext { - internal CommandContext(VirtualParadiseClient client, VirtualParadiseAvatar avatar, string commandName, string alias, + internal CommandContext(VirtualParadiseClient client, Avatar avatar, string commandName, string alias, string rawArguments) { Client = client; @@ -36,7 +36,7 @@ public sealed class CommandContext /// Gets the avatar who executed the command. /// /// The executing avatar. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the client which raised the event. @@ -65,7 +65,7 @@ public sealed class CommandContext /// regular chat message. /// /// The message which was sent. - public Task RespondAsync(string message, bool ephemeral = false) + public Task RespondAsync(string message, bool ephemeral = false) { return ephemeral ? Avatar.SendMessageAsync(Client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black) diff --git a/VpSharp.Commands/CommandsExtension.cs b/VpSharp.Commands/CommandsExtension.cs index 62d46e6..c952c2e 100644 --- a/VpSharp.Commands/CommandsExtension.cs +++ b/VpSharp.Commands/CommandsExtension.cs @@ -176,7 +176,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension } /// - protected internal override Task OnMessageReceived(VirtualParadiseMessage message) + protected internal override Task OnMessageReceived(Message message) { if (message is null) { diff --git a/VpSharp.IntegrationTests/src/Program.cs b/VpSharp.IntegrationTests/src/Program.cs index c28e85e..bcf6289 100644 --- a/VpSharp.IntegrationTests/src/Program.cs +++ b/VpSharp.IntegrationTests/src/Program.cs @@ -1,6 +1,8 @@ -using VpSharp; +using System.Reactive.Linq; +using VpSharp; using VpSharp.Commands; using VpSharp.Entities; +using VpSharp.Extensions; using VpSharp.IntegrationTests.CommandModules; string? username = Environment.GetEnvironmentVariable("username"); @@ -28,6 +30,8 @@ var configuration = new VirtualParadiseConfiguration }; using var client = new VirtualParadiseClient(configuration); +client.AvatarJoined.Where(a => !a.IsBot).SubscribeAsync(async avatar => await client.SendMessageAsync($"Hello, {avatar.Name}")); + CommandsExtension commands = client.UseCommands(new CommandsExtensionConfiguration {Prefixes = new[] {"!"}}); commands.RegisterCommands(); @@ -38,10 +42,10 @@ Console.WriteLine(@"Logging in"); await client.LoginAsync(); Console.WriteLine(@"Entering world"); -VirtualParadiseWorld world = await client.EnterAsync("Mutation"); +World world = await client.EnterAsync("Mutation"); Console.WriteLine(@"Entered world!"); -VirtualParadiseAvatar avatar = client.CurrentAvatar!; +Avatar avatar = client.CurrentAvatar!; Console.WriteLine($@"My name is {avatar.Name} and I am at {avatar.Location}"); Console.WriteLine($@"Entered {world.Name} with size {world.Size}"); diff --git a/VpSharp/src/ClientExtensions/VirtualParadiseClientExtension.cs b/VpSharp/src/ClientExtensions/VirtualParadiseClientExtension.cs index 54c4b66..98b6702 100644 --- a/VpSharp/src/ClientExtensions/VirtualParadiseClientExtension.cs +++ b/VpSharp/src/ClientExtensions/VirtualParadiseClientExtension.cs @@ -27,7 +27,7 @@ public abstract class VirtualParadiseClientExtension /// Called when a chat message is received. /// /// An object containing event data. - protected internal virtual Task OnMessageReceived(VirtualParadiseMessage message) + protected internal virtual Task OnMessageReceived(Message message) { return Task.CompletedTask; } diff --git a/VpSharp/src/Entities/VirtualParadiseAvatar.cs b/VpSharp/src/Entities/Avatar.cs similarity index 89% rename from VpSharp/src/Entities/VirtualParadiseAvatar.cs rename to VpSharp/src/Entities/Avatar.cs index bd9dd3f..54a005c 100644 --- a/VpSharp/src/Entities/VirtualParadiseAvatar.cs +++ b/VpSharp/src/Entities/Avatar.cs @@ -10,12 +10,12 @@ namespace VpSharp.Entities; /// /// Represents an avatar within a world. /// -public sealed class VirtualParadiseAvatar : IEquatable +public sealed class Avatar : IEquatable { private readonly VirtualParadiseClient _client; - private VirtualParadiseUser? _user; + private User? _user; - internal VirtualParadiseAvatar(VirtualParadiseClient client, int session) + internal Avatar(VirtualParadiseClient client, int session) { _client = client ?? throw new ArgumentNullException(nameof(client)); Session = session; @@ -33,7 +33,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// if this avatar is a bot; otherwise, . public bool IsBot { - get => Name is {Length: > 1} name && name[0] == '[' && name[^1] == ']'; + get => Name is { Length: > 1 } name && name[0] == '[' && name[^1] == ']'; } /// @@ -67,7 +67,7 @@ public sealed class VirtualParadiseAvatar : IEquatable public int UserId { get; internal set; } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The first instance. /// The second instance. @@ -75,13 +75,13 @@ public sealed class VirtualParadiseAvatar : IEquatable /// if is equal to ; otherwise, /// . /// - public static bool operator ==(VirtualParadiseAvatar? left, VirtualParadiseAvatar? right) + public static bool operator ==(Avatar? left, Avatar? right) { return Equals(left, right); } /// - /// Determines if two instances are not equal. + /// Determines if two instances are not equal. /// /// The first instance. /// The second instance. @@ -89,7 +89,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// if is not equal to ; otherwise, /// . /// - public static bool operator !=(VirtualParadiseAvatar? left, VirtualParadiseAvatar? right) + public static bool operator !=(Avatar? left, Avatar? right) { return !Equals(left, right); } @@ -133,13 +133,13 @@ public sealed class VirtualParadiseAvatar : IEquatable } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The other instance. /// /// if this instance is equal to ; otherwise, . /// - public bool Equals(VirtualParadiseAvatar? other) + public bool Equals(Avatar? other) { if (ReferenceEquals(null, other)) { @@ -157,7 +157,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// public override bool Equals(object? obj) { - return ReferenceEquals(this, obj) || (obj is VirtualParadiseAvatar other && Equals(other)); + return ReferenceEquals(this, obj) || (obj is Avatar other && Equals(other)); } /// @@ -172,7 +172,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// Gets the user associated with this avatar. /// /// The user. - public async Task GetUserAsync() + public async Task GetUserAsync() { _user ??= await _client.GetUserAsync(UserId).ConfigureAwait(false); return _user; @@ -196,9 +196,8 @@ public sealed class VirtualParadiseAvatar : IEquatable /// -or- /// is too long to send. /// - public Task SendMessageAsync(string message, FontStyle fontStyle, Color color) + public Task SendMessageAsync(string message, FontStyle fontStyle, Color color) { - // ReSharper disable once InconsistentlySynchronizedField return SendMessageAsync(null, message, fontStyle, color); } @@ -222,7 +221,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// is too long to send. /// /// Passing to will hide the name from the recipient. - public Task SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color) + public Task SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color) { if (message is null) { @@ -234,7 +233,7 @@ public sealed class VirtualParadiseAvatar : IEquatable throw new ArgumentException(ExceptionMessages.ValueCannotBeEmpty, nameof(message)); } - VirtualParadiseAvatar avatar; + Avatar avatar; lock (_client.Lock) { @@ -249,6 +248,7 @@ public sealed class VirtualParadiseAvatar : IEquatable color.B ); + // TODO remove if statement if (reason != ReasonCode.Success) { switch (reason) @@ -267,7 +267,7 @@ public sealed class VirtualParadiseAvatar : IEquatable avatar = _client.CurrentAvatar!; } - return Task.FromResult(new VirtualParadiseMessage( + return Task.FromResult(new Message( MessageType.ConsoleMessage, name, message, @@ -331,7 +331,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// The name of the world to which this avatar should be teleported. /// The position to which this avatar should be teleported. /// is . - public Task TeleportAsync(VirtualParadiseWorld world, Vector3d position) + public Task TeleportAsync(World world, Vector3d position) { if (world is null) { @@ -348,7 +348,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// The position to which this avatar should be teleported. /// The rotation to which this avatar should be teleported. /// is . - public Task TeleportAsync(VirtualParadiseWorld world, Vector3d position, Rotation rotation) + public Task TeleportAsync(World world, Vector3d position, Rotation rotation) { if (world is null) { @@ -443,8 +443,8 @@ public sealed class VirtualParadiseAvatar : IEquatable } } - VirtualParadiseWorld? updatedWorld = isNewWorld ? await _client.GetWorldAsync(world) : Location.World; - updatedWorld ??= new VirtualParadiseWorld(_client, world); + World? updatedWorld = isNewWorld ? await _client.GetWorldAsync(world) : Location.World; + updatedWorld ??= new World(_client, world); Location = new Location(updatedWorld, position, rotation); // ReSharper restore InconsistentlySynchronizedField } @@ -455,7 +455,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// The position to which this avatar should be teleported. public Task TeleportAsync(Vector3d position) { - return TeleportAsync(Location with {Position = position}); + return TeleportAsync(Location with { Position = position }); } /// @@ -465,7 +465,7 @@ public sealed class VirtualParadiseAvatar : IEquatable /// The rotation to which this avatar should be teleported public Task TeleportAsync(Vector3d position, Rotation rotation) { - return TeleportAsync(Location with {Position = position, Rotation = rotation}); + return TeleportAsync(Location with { Position = position, Rotation = rotation }); } /// diff --git a/VpSharp/src/Entities/VirtualParadiseMessage.cs b/VpSharp/src/Entities/Message.cs similarity index 91% rename from VpSharp/src/Entities/VirtualParadiseMessage.cs rename to VpSharp/src/Entities/Message.cs index 32dde98..cb77df8 100644 --- a/VpSharp/src/Entities/VirtualParadiseMessage.cs +++ b/VpSharp/src/Entities/Message.cs @@ -5,13 +5,13 @@ namespace VpSharp.Entities; /// /// Represents a message. /// -public sealed class VirtualParadiseMessage +public sealed class Message { - internal VirtualParadiseMessage( + internal Message( MessageType type, string? name, string content, - VirtualParadiseAvatar author, + Avatar author, FontStyle style, Color color) { @@ -27,7 +27,7 @@ public sealed class VirtualParadiseMessage /// Gets the message author. /// /// The message author. - public VirtualParadiseAvatar Author { get; } + public Avatar Author { get; } /// /// Gets the message content. diff --git a/VpSharp/src/Entities/VirtualParadiseModelObject.cs b/VpSharp/src/Entities/ModelObject.cs similarity index 81% rename from VpSharp/src/Entities/VirtualParadiseModelObject.cs rename to VpSharp/src/Entities/ModelObject.cs index 63bb547..9b6d521 100644 --- a/VpSharp/src/Entities/VirtualParadiseModelObject.cs +++ b/VpSharp/src/Entities/ModelObject.cs @@ -9,15 +9,15 @@ namespace VpSharp.Entities; /// Represents an object which renders as a 3D model. A "model" object will contain a Model, Description /// and Action field. /// -public class VirtualParadiseModelObject : VirtualParadiseObject +public class ModelObject : VirtualParadiseObject { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The owning client. /// The object ID. /// is . - internal VirtualParadiseModelObject(VirtualParadiseClient client, int id) + internal ModelObject(VirtualParadiseClient client, int id) : base(client, id) { } @@ -46,11 +46,11 @@ public class VirtualParadiseModelObject : VirtualParadiseObject /// The builder which defines parameters to change. /// is . /// - /// was assigned. + /// was assigned. /// -or- - /// was assigned. + /// was assigned. /// - public async Task ModifyAsync(Action action) + public async Task ModifyAsync(Action action) { if (action is null) { @@ -58,7 +58,7 @@ public class VirtualParadiseModelObject : VirtualParadiseObject } var taskCompletionSource = new TaskCompletionSource(); - var builder = new VirtualParadiseModelObjectBuilder(Client, this, ObjectBuilderMode.Modify); + var builder = new ModelObjectBuilder(Client, this, ObjectBuilderMode.Modify); await Task.Run(() => action(builder)).ConfigureAwait(false); lock (Client.Lock) @@ -90,9 +90,9 @@ public class VirtualParadiseModelObject : VirtualParadiseObject } /// - protected internal override void ExtractFromBuilder(VirtualParadiseObjectBuilder builder) + protected internal override void ExtractFromBuilder(ObjectBuilder builder) { - if (builder is not VirtualParadiseModelObjectBuilder modelObjectBuilder) + if (builder is not ModelObjectBuilder modelObjectBuilder) { return; } @@ -107,7 +107,7 @@ public class VirtualParadiseModelObject : VirtualParadiseObject /// protected internal override void ExtractFromOther(VirtualParadiseObject virtualParadiseObject) { - if (virtualParadiseObject is not VirtualParadiseModelObject model) + if (virtualParadiseObject is not ModelObject model) { return; } diff --git a/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs b/VpSharp/src/Entities/ModelObjectBuilder.cs similarity index 86% rename from VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs rename to VpSharp/src/Entities/ModelObjectBuilder.cs index e5087ec..e2f8784 100644 --- a/VpSharp/src/Entities/VirtualParadiseModelObjectBuilder.cs +++ b/VpSharp/src/Entities/ModelObjectBuilder.cs @@ -8,11 +8,11 @@ namespace VpSharp.Entities; /// /// Provides mutability for . /// -public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBuilder +public sealed class ModelObjectBuilder : ObjectBuilder { - internal VirtualParadiseModelObjectBuilder( + internal ModelObjectBuilder( VirtualParadiseClient client, - VirtualParadiseModelObject targetObject, + ModelObject targetObject, ObjectBuilderMode mode ) : base(client, targetObject, mode) @@ -42,7 +42,7 @@ public sealed class VirtualParadiseModelObjectBuilder : VirtualParadiseObjectBui base.ApplyChanges(); nint handle = Client.NativeInstanceHandle; - var targetObject = (VirtualParadiseModelObject)TargetObject; + var targetObject = (ModelObject)TargetObject; 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)); diff --git a/VpSharp/src/Entities/VirtualParadiseObjectBuilder.cs b/VpSharp/src/Entities/ObjectBuilder.cs similarity index 95% rename from VpSharp/src/Entities/VirtualParadiseObjectBuilder.cs rename to VpSharp/src/Entities/ObjectBuilder.cs index 538906d..e907ee8 100644 --- a/VpSharp/src/Entities/VirtualParadiseObjectBuilder.cs +++ b/VpSharp/src/Entities/ObjectBuilder.cs @@ -10,9 +10,9 @@ namespace VpSharp.Entities; /// /// Represents the base class for object builders. /// -public abstract class VirtualParadiseObjectBuilder +public abstract class ObjectBuilder { - private protected VirtualParadiseObjectBuilder( + private protected ObjectBuilder( VirtualParadiseClient client, VirtualParadiseObject targetObject, ObjectBuilderMode mode @@ -43,7 +43,7 @@ public abstract class VirtualParadiseObjectBuilder /// This property may only be set during an object load, and will throw at /// any other point. /// - public Option Owner { get; set; } + public Option Owner { get; set; } /// /// Gets or sets the position of the object. @@ -90,7 +90,7 @@ public abstract class VirtualParadiseObjectBuilder throw new InvalidOperationException("Owner can only be assigned during an object load."); } - VirtualParadiseUser oldOwner = TargetObject.Owner; + User oldOwner = TargetObject.Owner; _ = vp_int_set(handle, ObjectUserId, Owner.ValueOr(oldOwner).Id); } diff --git a/VpSharp/src/Entities/VirtualParadiseParticleEmitterObject.cs b/VpSharp/src/Entities/ParticleEmitterObject.cs similarity index 94% rename from VpSharp/src/Entities/VirtualParadiseParticleEmitterObject.cs rename to VpSharp/src/Entities/ParticleEmitterObject.cs index d2d2090..0f69353 100644 --- a/VpSharp/src/Entities/VirtualParadiseParticleEmitterObject.cs +++ b/VpSharp/src/Entities/ParticleEmitterObject.cs @@ -13,15 +13,15 @@ namespace VpSharp.Entities; /// /// Represents a particle emitter object. /// -public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject +public sealed class ParticleEmitterObject : VirtualParadiseObject { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The owning client. /// The object ID. /// is . - internal VirtualParadiseParticleEmitterObject(VirtualParadiseClient client, int id) + internal ParticleEmitterObject(VirtualParadiseClient client, int id) : base(client, id) { } @@ -217,13 +217,13 @@ public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject /// protected internal override void ExtractFromOther(VirtualParadiseObject virtualParadiseObject) { - if (virtualParadiseObject is not VirtualParadiseParticleEmitterObject emitter) + if (virtualParadiseObject is not ParticleEmitterObject emitter) { return; } const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; - PropertyInfo[] properties = typeof(VirtualParadiseParticleEmitterObject).GetProperties(bindingFlags); + PropertyInfo[] properties = typeof(ParticleEmitterObject).GetProperties(bindingFlags); foreach (PropertyInfo property in properties) { @@ -243,7 +243,7 @@ public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject #pragma warning disable 612 const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; - PropertyInfo[] properties = typeof(VirtualParadiseParticleEmitterObject).GetProperties(bindingFlags); + PropertyInfo[] properties = typeof(ParticleEmitterObject).GetProperties(bindingFlags); var keymap = new Dictionary(); var converterMap = new Dictionary(); diff --git a/VpSharp/src/Entities/VirtualParadiseParticleEmitterObjectBuilder.cs b/VpSharp/src/Entities/ParticleEmitterObjectBuilder.cs similarity index 85% rename from VpSharp/src/Entities/VirtualParadiseParticleEmitterObjectBuilder.cs rename to VpSharp/src/Entities/ParticleEmitterObjectBuilder.cs index 0b357eb..ad1b8e9 100644 --- a/VpSharp/src/Entities/VirtualParadiseParticleEmitterObjectBuilder.cs +++ b/VpSharp/src/Entities/ParticleEmitterObjectBuilder.cs @@ -11,13 +11,13 @@ using VpSharp.Internal.ValueConverters; namespace VpSharp.Entities; /// -/// Provides mutability for a . +/// Provides mutability for a . /// -public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadiseObjectBuilder +public sealed class ParticleEmitterObjectBuilder : ObjectBuilder { - internal VirtualParadiseParticleEmitterObjectBuilder( + internal ParticleEmitterObjectBuilder( VirtualParadiseClient client, - VirtualParadiseParticleEmitterObject targetObject, + ParticleEmitterObject targetObject, ObjectBuilderMode mode ) : base(client, targetObject, mode) @@ -220,7 +220,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum volume, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMax(Option value) + public ParticleEmitterObjectBuilder WithAccelerationMax(Option value) { AccelerationMax = value; return this; @@ -231,7 +231,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum acceleration, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMin(Option value) + public ParticleEmitterObjectBuilder WithAccelerationMin(Option value) { AccelerationMin = value; return this; @@ -242,7 +242,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The blend mode, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithBlendMode(Option value) + public ParticleEmitterObjectBuilder WithBlendMode(Option value) { BlendMode = value; return this; @@ -253,7 +253,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum color, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithColorMax(Option value) + public ParticleEmitterObjectBuilder WithColorMax(Option value) { ColorMax = value; return this; @@ -264,7 +264,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum color, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithColorMin(Option value) + public ParticleEmitterObjectBuilder WithColorMin(Option value) { ColorMin = value; return this; @@ -275,7 +275,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The emitter lifespan, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithEmitterLifespan(Option value) + public ParticleEmitterObjectBuilder WithEmitterLifespan(Option value) { EmitterLifespan = value; return this; @@ -289,7 +289,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// to leave unchanged. /// /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithInterpolation(Option value) + public ParticleEmitterObjectBuilder WithInterpolation(Option value) { Interpolate = value; return this; @@ -300,7 +300,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The opacity, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithOpacity(Option value) + public ParticleEmitterObjectBuilder WithOpacity(Option value) { Opacity = value; return this; @@ -311,7 +311,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The particle lifespan, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithParticleLifespan(Option value) + public ParticleEmitterObjectBuilder WithParticleLifespan(Option value) { ParticleLifespan = value; return this; @@ -322,7 +322,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The particle type, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithParticleType(Option value) + public ParticleEmitterObjectBuilder WithParticleType(Option value) { ParticleType = value; return this; @@ -333,7 +333,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The release count, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithReleaseCount(Option value) + public ParticleEmitterObjectBuilder WithReleaseCount(Option value) { ReleaseCount = value; return this; @@ -344,7 +344,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The release time, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithReleaseTime(Option value) + public ParticleEmitterObjectBuilder WithReleaseTime(Option value) { ReleaseTime = value; return this; @@ -355,7 +355,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum size, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSizeMax(Option value) + public ParticleEmitterObjectBuilder WithSizeMax(Option value) { SizeMax = value; return this; @@ -366,7 +366,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum size, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSizeMin(Option value) + public ParticleEmitterObjectBuilder WithSizeMin(Option value) { SizeMin = value; return this; @@ -377,7 +377,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum speed, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMax(Option value) + public ParticleEmitterObjectBuilder WithSpeedMax(Option value) { SpeedMax = value; return this; @@ -388,7 +388,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum speed, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSpeedMin(Option value) + public ParticleEmitterObjectBuilder WithSpeedMin(Option value) { SpeedMin = value; return this; @@ -399,7 +399,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum spin, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSpinMax(Option value) + public ParticleEmitterObjectBuilder WithSpinMax(Option value) { SpinMax = value; return this; @@ -410,7 +410,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum spin, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithSpinMin(Option value) + public ParticleEmitterObjectBuilder WithSpinMin(Option value) { SpinMin = value; return this; @@ -421,7 +421,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum start angle, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMax(Option value) + public ParticleEmitterObjectBuilder WithStartAngleMax(Option value) { StartAngleMax = value; return this; @@ -432,7 +432,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum start angle, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithStartAngleMin(Option value) + public ParticleEmitterObjectBuilder WithStartAngleMin(Option value) { StartAngleMin = value; return this; @@ -443,7 +443,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The maximum volume, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMax(Option value) + public ParticleEmitterObjectBuilder WithVolumeMax(Option value) { VolumeMax = value; return this; @@ -454,7 +454,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The minimum volume, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithVolumeMin(Option value) + public ParticleEmitterObjectBuilder WithVolumeMin(Option value) { VolumeMin = value; return this; @@ -465,7 +465,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The tag, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithTag(Option value) + public ParticleEmitterObjectBuilder WithTag(Option value) { Tag = value; return this; @@ -476,7 +476,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis /// /// The texture, or to leave unchanged. /// The current instance. - public VirtualParadiseParticleEmitterObjectBuilder WithTexture(Option value) + public ParticleEmitterObjectBuilder WithTexture(Option value) { Texture = value; return this; diff --git a/VpSharp/src/Entities/VirtualParadisePath.cs b/VpSharp/src/Entities/Path.cs similarity index 75% rename from VpSharp/src/Entities/VirtualParadisePath.cs rename to VpSharp/src/Entities/Path.cs index 26b7adb..5e8529c 100644 --- a/VpSharp/src/Entities/VirtualParadisePath.cs +++ b/VpSharp/src/Entities/Path.cs @@ -1,11 +1,11 @@ namespace VpSharp.Entities; /// -/// Represents a path contained by a . +/// Represents a path contained by a . /// -public sealed class VirtualParadisePath : ICloneable +public sealed class Path : ICloneable { - internal VirtualParadisePath(PathEasing easing, string name, IEnumerable points, bool isClosed) + internal Path(PathEasing easing, string name, IEnumerable points, bool isClosed) { Easing = easing; Name = name; @@ -40,6 +40,6 @@ public sealed class VirtualParadisePath : ICloneable /// public object Clone() { - return new VirtualParadisePath(Easing, Name, Points, IsClosed); + return new Path(Easing, Name, Points, IsClosed); } } diff --git a/VpSharp/src/Entities/VirtualParadisePathObject.cs b/VpSharp/src/Entities/PathObject.cs similarity index 91% rename from VpSharp/src/Entities/VirtualParadisePathObject.cs rename to VpSharp/src/Entities/PathObject.cs index 76298fb..795a370 100644 --- a/VpSharp/src/Entities/VirtualParadisePathObject.cs +++ b/VpSharp/src/Entities/PathObject.cs @@ -9,15 +9,15 @@ namespace VpSharp.Entities; /// /// Represents a path object. /// -public sealed class VirtualParadisePathObject : VirtualParadiseObject +public sealed class PathObject : VirtualParadiseObject { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The owning client. /// The object ID. /// is . - internal VirtualParadisePathObject(VirtualParadiseClient client, int id) + internal PathObject(VirtualParadiseClient client, int id) : base(client, id) { } @@ -26,17 +26,17 @@ public sealed class VirtualParadisePathObject : VirtualParadiseObject /// Gets the path in this object. /// /// The path in this object. - public VirtualParadisePath Path { get; set; } = null!; + public Path Path { get; set; } = null!; /// protected internal override void ExtractFromOther(VirtualParadiseObject virtualParadiseObject) { - if (virtualParadiseObject is not VirtualParadisePathObject path) + if (virtualParadiseObject is not PathObject path) { return; } - Path = (VirtualParadisePath)path.Path.Clone(); + Path = (Path)path.Path.Clone(); } /// @@ -92,7 +92,7 @@ public sealed class VirtualParadisePathObject : VirtualParadiseObject buffer.Append(current); } - Path = new VirtualParadisePath((PathEasing)pathType, name, points, closed == 1); + Path = new Path((PathEasing)pathType, name, points, closed == 1); buffer.Dispose(); } diff --git a/VpSharp/src/Entities/VirtualParadiseUser.cs b/VpSharp/src/Entities/User.cs similarity index 90% rename from VpSharp/src/Entities/VirtualParadiseUser.cs rename to VpSharp/src/Entities/User.cs index 3dd8723..3cae146 100644 --- a/VpSharp/src/Entities/VirtualParadiseUser.cs +++ b/VpSharp/src/Entities/User.cs @@ -8,11 +8,11 @@ namespace VpSharp.Entities; /// /// Represents a Virtual Paradise user. /// -public sealed class VirtualParadiseUser : IEquatable +public sealed class User : IEquatable { private readonly VirtualParadiseClient _client; - internal VirtualParadiseUser(VirtualParadiseClient client, int id) + internal User(VirtualParadiseClient client, int id) { _client = client; Id = id; @@ -55,7 +55,7 @@ public sealed class VirtualParadiseUser : IEquatable public DateTimeOffset RegistrationTime { get; internal set; } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The first instance. /// The second instance. @@ -63,13 +63,13 @@ public sealed class VirtualParadiseUser : IEquatable /// if is equal to ; otherwise, /// . /// - public static bool operator ==(VirtualParadiseUser? left, VirtualParadiseUser? right) + public static bool operator ==(User? left, User? right) { return Equals(left, right); } /// - /// Determines if two instances are not equal. + /// Determines if two instances are not equal. /// /// The first instance. /// The second instance. @@ -77,19 +77,19 @@ public sealed class VirtualParadiseUser : IEquatable /// if is not equal to ; otherwise, /// . /// - public static bool operator !=(VirtualParadiseUser? left, VirtualParadiseUser? right) + public static bool operator !=(User? left, User? right) { return !Equals(left, right); } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The other instance. /// /// if this instance is equal to ; otherwise, . /// - public bool Equals(VirtualParadiseUser? other) + public bool Equals(User? other) { if (ReferenceEquals(null, other)) { @@ -107,7 +107,7 @@ public sealed class VirtualParadiseUser : IEquatable /// public override bool Equals(object? obj) { - return ReferenceEquals(this, obj) || (obj is VirtualParadiseUser other && Equals(other)); + return ReferenceEquals(this, obj) || (obj is User other && Equals(other)); } /// @@ -214,7 +214,7 @@ public sealed class VirtualParadiseUser : IEquatable var position = new Vector3d(x, y, z); var rotation = Rotation.CreateFromTiltYawRoll(pitch, yaw, 0); - VirtualParadiseWorld world = (await _client.GetWorldAsync(worldName).ConfigureAwait(false))!; + World world = (await _client.GetWorldAsync(worldName).ConfigureAwait(false))!; location = new Location(world, position, rotation); diff --git a/VpSharp/src/Entities/VirtualParadiseObject.cs b/VpSharp/src/Entities/VirtualParadiseObject.cs index 2d159d7..69dcd49 100644 --- a/VpSharp/src/Entities/VirtualParadiseObject.cs +++ b/VpSharp/src/Entities/VirtualParadiseObject.cs @@ -51,7 +51,7 @@ public abstract class VirtualParadiseObject : IEquatable /// Gets the owner of this object. /// /// The owner of this object. - public VirtualParadiseUser Owner { get; internal set; } = null!; + public User Owner { get; internal set; } = null!; internal byte[] Data { get; set; } = Array.Empty(); @@ -90,7 +90,7 @@ public abstract class VirtualParadiseObject : IEquatable /// The target avatar to receive the event. If this value is , the bump will be broadcast to /// all avatars in the world. /// - public async Task BumpAsync(BumpPhase? phase = null, VirtualParadiseAvatar? target = null) + public async Task BumpAsync(BumpPhase? phase = null, Avatar? target = null) { int session = target?.Session ?? 0; @@ -139,7 +139,7 @@ public abstract class VirtualParadiseObject : IEquatable /// The target avatar which will receive the event, or to broadcast to every avatar. /// /// is the client's current avatar. - public Task ClickAsync(Vector3d? position = null, VirtualParadiseAvatar? target = null) + public Task ClickAsync(Vector3d? position = null, Avatar? target = null) { if (target == Client.CurrentAvatar) { @@ -236,10 +236,10 @@ public abstract class VirtualParadiseObject : IEquatable } /// - /// Updates the object by extracting the values provided by a specified . + /// Updates the object by extracting the values provided by a specified . /// /// The builder whose values to extract. - protected internal virtual void ExtractFromBuilder(VirtualParadiseObjectBuilder builder) + protected internal virtual void ExtractFromBuilder(ObjectBuilder builder) { if (builder is null) { diff --git a/VpSharp/src/Entities/VirtualParadiseWorld.cs b/VpSharp/src/Entities/World.cs similarity index 81% rename from VpSharp/src/Entities/VirtualParadiseWorld.cs rename to VpSharp/src/Entities/World.cs index 1b69508..eef5e3a 100644 --- a/VpSharp/src/Entities/VirtualParadiseWorld.cs +++ b/VpSharp/src/Entities/World.cs @@ -5,16 +5,16 @@ namespace VpSharp.Entities; /// /// Represents a world in the Virtual Paradise universe. /// -public sealed class VirtualParadiseWorld : IEquatable +public sealed class World : IEquatable { /// /// A world that represents no world in the universe. /// - public static readonly VirtualParadiseWorld Nowhere = new(null!, "") {IsNowhere = true}; + public static readonly World Nowhere = new(null!, "") {IsNowhere = true}; private readonly VirtualParadiseClient _client; - internal VirtualParadiseWorld(VirtualParadiseClient client, string name) + internal World(VirtualParadiseClient client, string name) { _client = client; Name = name ?? throw new ArgumentNullException(nameof(name)); @@ -53,7 +53,7 @@ public sealed class VirtualParadiseWorld : IEquatable internal bool IsNowhere { get; private init; } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The first instance. /// The second instance. @@ -61,13 +61,13 @@ public sealed class VirtualParadiseWorld : IEquatable /// if is equal to ; otherwise, /// . /// - public static bool operator ==(VirtualParadiseWorld? left, VirtualParadiseWorld? right) + public static bool operator ==(World? left, World? right) { return Equals(left, right); } /// - /// Determines if two instances are not equal. + /// Determines if two instances are not equal. /// /// The first instance. /// The second instance. @@ -75,19 +75,19 @@ public sealed class VirtualParadiseWorld : IEquatable /// if is not equal to ; otherwise, /// . /// - public static bool operator !=(VirtualParadiseWorld? left, VirtualParadiseWorld? right) + public static bool operator !=(World? left, World? right) { return !Equals(left, right); } /// - /// Determines if two instances are equal. + /// Determines if two instances are equal. /// /// The other instance. /// /// if this instance is equal to ; otherwise, . /// - public bool Equals(VirtualParadiseWorld? other) + public bool Equals(World? other) { if (ReferenceEquals(null, other)) { @@ -105,7 +105,7 @@ public sealed class VirtualParadiseWorld : IEquatable /// public override bool Equals(object? obj) { - return ReferenceEquals(this, obj) || (obj is VirtualParadiseWorld other && Equals(other)); + return ReferenceEquals(this, obj) || (obj is World other && Equals(other)); } /// diff --git a/VpSharp/src/EventData/AvatarClickedEventArgs.cs b/VpSharp/src/EventData/AvatarClickedEventArgs.cs index ebf9e02..d3dea44 100644 --- a/VpSharp/src/EventData/AvatarClickedEventArgs.cs +++ b/VpSharp/src/EventData/AvatarClickedEventArgs.cs @@ -13,7 +13,7 @@ public sealed class AvatarClickedEventArgs : EventArgs /// The avatar responsible for the click. /// The clicked avatar. /// The click point. - public AvatarClickedEventArgs(VirtualParadiseAvatar avatar, VirtualParadiseAvatar clickedAvatar, Vector3d clickPoint) + public AvatarClickedEventArgs(Avatar avatar, Avatar clickedAvatar, Vector3d clickPoint) { Avatar = avatar; ClickedAvatar = clickedAvatar; @@ -24,13 +24,13 @@ public sealed class AvatarClickedEventArgs : EventArgs /// Gets the avatar responsible for the click. /// /// The avatar responsible for the click. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the clicked avatar. /// /// The clicked avatar. - public VirtualParadiseAvatar ClickedAvatar { get; } + public Avatar ClickedAvatar { get; } /// /// Gets the point at which the avatar clicked the object. diff --git a/VpSharp/src/EventData/AvatarMovedEventArgs.cs b/VpSharp/src/EventData/AvatarMovedEventArgs.cs index 6c85cb8..4a35e8b 100644 --- a/VpSharp/src/EventData/AvatarMovedEventArgs.cs +++ b/VpSharp/src/EventData/AvatarMovedEventArgs.cs @@ -13,7 +13,7 @@ public sealed class AvatarMovedEventArgs : EventArgs /// The avatar whose type was changed. /// The avatar's new location. /// The avatar's old location. - public AvatarMovedEventArgs(VirtualParadiseAvatar avatar, Location locationAfter, Location? locationBefore) + public AvatarMovedEventArgs(Avatar avatar, Location locationAfter, Location? locationBefore) { Avatar = avatar; LocationAfter = locationAfter; @@ -24,7 +24,7 @@ public sealed class AvatarMovedEventArgs : EventArgs /// Gets the avatar whose location was changed. /// /// The avatar whose location was changed. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the avatar's location after the change. diff --git a/VpSharp/src/EventData/AvatarTypeChangedEventArgs.cs b/VpSharp/src/EventData/AvatarTypeChangedEventArgs.cs index ec58b3b..e669c70 100644 --- a/VpSharp/src/EventData/AvatarTypeChangedEventArgs.cs +++ b/VpSharp/src/EventData/AvatarTypeChangedEventArgs.cs @@ -13,7 +13,7 @@ public sealed class AvatarTypeChangedEventArgs : EventArgs /// The avatar whose type was changed. /// The avatar's new type. /// The avatar's old type. - public AvatarTypeChangedEventArgs(VirtualParadiseAvatar avatar, int typeAfter, int? typeBefore) + public AvatarTypeChangedEventArgs(Avatar avatar, int typeAfter, int? typeBefore) { Avatar = avatar; TypeAfter = typeAfter; @@ -24,7 +24,7 @@ public sealed class AvatarTypeChangedEventArgs : EventArgs /// Gets the avatar whose type was changed. /// /// The avatar whose type was changed. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the avatar's type after the change. diff --git a/VpSharp/src/EventData/ObjectBumpEventArgs.cs b/VpSharp/src/EventData/ObjectBumpEventArgs.cs index 30fbc9d..463d6cb 100644 --- a/VpSharp/src/EventData/ObjectBumpEventArgs.cs +++ b/VpSharp/src/EventData/ObjectBumpEventArgs.cs @@ -13,7 +13,7 @@ public sealed class ObjectBumpEventArgs : EventArgs /// The avatar. /// The bumped object. /// The bump phase. - public ObjectBumpEventArgs(VirtualParadiseAvatar avatar, VirtualParadiseObject bumpedObject, BumpPhase phase) + public ObjectBumpEventArgs(Avatar avatar, VirtualParadiseObject bumpedObject, BumpPhase phase) { Avatar = avatar; BumpedObject = bumpedObject; @@ -24,7 +24,7 @@ public sealed class ObjectBumpEventArgs : EventArgs /// Gets the avatar responsible for the bump. /// /// The avatar responsible for the bump. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the object to which this event pertains. diff --git a/VpSharp/src/EventData/ObjectChangedEventArgs.cs b/VpSharp/src/EventData/ObjectChangedEventArgs.cs index dc9ad31..913d16a 100644 --- a/VpSharp/src/EventData/ObjectChangedEventArgs.cs +++ b/VpSharp/src/EventData/ObjectChangedEventArgs.cs @@ -14,7 +14,7 @@ public sealed class ObjectChangedEventArgs : EventArgs /// The state of the object prior to the change. /// The object which was changed, containing updated values. public ObjectChangedEventArgs( - VirtualParadiseAvatar avatar, + Avatar avatar, VirtualParadiseObject? objectBefore, VirtualParadiseObject objectAfter) { @@ -27,7 +27,7 @@ public sealed class ObjectChangedEventArgs : EventArgs /// Gets the avatar which changed the object. /// /// The avatar which changed the object. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the object which was changed. diff --git a/VpSharp/src/EventData/ObjectClickedEventArgs.cs b/VpSharp/src/EventData/ObjectClickedEventArgs.cs index 031bc64..e8c9387 100644 --- a/VpSharp/src/EventData/ObjectClickedEventArgs.cs +++ b/VpSharp/src/EventData/ObjectClickedEventArgs.cs @@ -14,7 +14,7 @@ public sealed class ObjectClickedEventArgs : EventArgs /// The clicked object. /// The click point. public ObjectClickedEventArgs( - VirtualParadiseAvatar avatar, + Avatar avatar, VirtualParadiseObject clickedObject, Vector3d clickPoint) { @@ -27,7 +27,7 @@ public sealed class ObjectClickedEventArgs : EventArgs /// Gets the avatar responsible for the click. /// /// The avatar responsible for the click. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the clicked object. diff --git a/VpSharp/src/EventData/ObjectCreatedEventArgs.cs b/VpSharp/src/EventData/ObjectCreatedEventArgs.cs index ccdab38..609bbac 100644 --- a/VpSharp/src/EventData/ObjectCreatedEventArgs.cs +++ b/VpSharp/src/EventData/ObjectCreatedEventArgs.cs @@ -12,7 +12,7 @@ public sealed class ObjectCreatedEventArgs : EventArgs /// /// The avatar responsible for the object being created. /// The created object. - public ObjectCreatedEventArgs(VirtualParadiseAvatar avatar, VirtualParadiseObject createdObject) + public ObjectCreatedEventArgs(Avatar avatar, VirtualParadiseObject createdObject) { Avatar = avatar; CreatedObject = createdObject; @@ -22,7 +22,7 @@ public sealed class ObjectCreatedEventArgs : EventArgs /// Gets the avatar responsible for the object being created. /// /// The avatar responsible for the object being created. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the object which was created. diff --git a/VpSharp/src/EventData/ObjectDeletedEventArgs.cs b/VpSharp/src/EventData/ObjectDeletedEventArgs.cs index 7e18f20..e6ca861 100644 --- a/VpSharp/src/EventData/ObjectDeletedEventArgs.cs +++ b/VpSharp/src/EventData/ObjectDeletedEventArgs.cs @@ -13,7 +13,7 @@ public sealed class ObjectDeletedEventArgs : EventArgs /// The avatar responsible for the object being deleted. /// The ID of the deleted object. /// The deleted object. - public ObjectDeletedEventArgs(VirtualParadiseAvatar avatar, int objectId, VirtualParadiseObject deletedObject) + public ObjectDeletedEventArgs(Avatar avatar, int objectId, VirtualParadiseObject deletedObject) { Avatar = avatar; ObjectId = objectId; @@ -24,7 +24,7 @@ public sealed class ObjectDeletedEventArgs : EventArgs /// Gets the avatar responsible for the object being deleted. /// /// The avatar responsible for the object being deleted. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the object which was deleted. diff --git a/VpSharp/src/EventData/TeleportedEventArgs.cs b/VpSharp/src/EventData/TeleportedEventArgs.cs index e42be54..e054763 100644 --- a/VpSharp/src/EventData/TeleportedEventArgs.cs +++ b/VpSharp/src/EventData/TeleportedEventArgs.cs @@ -12,7 +12,7 @@ public sealed class TeleportedEventArgs : EventArgs /// /// The avatar which initiated the teleport. /// The target location of the teleport. - public TeleportedEventArgs(VirtualParadiseAvatar avatar, Location location) + public TeleportedEventArgs(Avatar avatar, Location location) { Avatar = avatar; Location = location; @@ -22,7 +22,7 @@ public sealed class TeleportedEventArgs : EventArgs /// Gets the avatar which initiated the teleport. /// /// The avatar which initiated the teleport. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the target location of the teleport. diff --git a/VpSharp/src/EventData/UriReceivedEventArgs.cs b/VpSharp/src/EventData/UriReceivedEventArgs.cs index 6d4995b..11cab0c 100644 --- a/VpSharp/src/EventData/UriReceivedEventArgs.cs +++ b/VpSharp/src/EventData/UriReceivedEventArgs.cs @@ -13,7 +13,7 @@ public sealed class UriReceivedEventArgs : EventArgs /// The received URI. /// The URI target. /// The avatar who sent the URI. - public UriReceivedEventArgs(Uri uri, UriTarget target, VirtualParadiseAvatar avatar) + public UriReceivedEventArgs(Uri uri, UriTarget target, Avatar avatar) { Uri = uri; Target = target; @@ -24,7 +24,7 @@ public sealed class UriReceivedEventArgs : EventArgs /// Gets the avatar who sent the URI. /// /// The avatar who sent the URI. - public VirtualParadiseAvatar Avatar { get; } + public Avatar Avatar { get; } /// /// Gets the URI target. diff --git a/VpSharp/src/InviteRequest.cs b/VpSharp/src/InviteRequest.cs index 7fceff6..e4b4160 100644 --- a/VpSharp/src/InviteRequest.cs +++ b/VpSharp/src/InviteRequest.cs @@ -16,7 +16,7 @@ public sealed class InviteRequest : IEquatable VirtualParadiseClient client, int requestId, string name, - VirtualParadiseUser user, + User user, Location location) { Name = name; @@ -42,7 +42,7 @@ public sealed class InviteRequest : IEquatable /// Gets the user which sent the request. /// /// The user which sent the request. - public VirtualParadiseUser User { get; } + public User User { get; } /// /// Returns a value indicating whether two instances are equal. diff --git a/VpSharp/src/JoinRequest.cs b/VpSharp/src/JoinRequest.cs index 7e78ebb..8a05324 100644 --- a/VpSharp/src/JoinRequest.cs +++ b/VpSharp/src/JoinRequest.cs @@ -12,7 +12,7 @@ public sealed class JoinRequest : IEquatable private readonly VirtualParadiseClient _client; private readonly int _requestId; - internal JoinRequest(VirtualParadiseClient client, int requestId, string name, VirtualParadiseUser user) + internal JoinRequest(VirtualParadiseClient client, int requestId, string name, User user) { Name = name; User = user; @@ -30,7 +30,7 @@ public sealed class JoinRequest : IEquatable /// Gets the user which sent the request. /// /// The user which sent the request. - public VirtualParadiseUser User { get; } + public User User { get; } /// /// Returns a value indicating whether two instances are equal. diff --git a/VpSharp/src/Location.cs b/VpSharp/src/Location.cs index 5598c18..bfdaae6 100644 --- a/VpSharp/src/Location.cs +++ b/VpSharp/src/Location.cs @@ -10,7 +10,7 @@ public readonly struct Location : IEquatable /// /// A location that represents nowhere in the universe. /// - public static readonly Location Nowhere = new(VirtualParadiseWorld.Nowhere); + public static readonly Location Nowhere = new(Entities.World.Nowhere); /// /// Initializes a new instance of the struct. @@ -22,7 +22,7 @@ public readonly struct Location : IEquatable /// parameter. /// /// is . - public Location(VirtualParadiseWorld world, in Coordinates coordinates) + public Location(World world, in Coordinates coordinates) { World = world ?? throw new ArgumentNullException(nameof(world)); Position = new Vector3d(coordinates.X, coordinates.Y, coordinates.Z); @@ -36,7 +36,7 @@ public readonly struct Location : IEquatable /// The position. /// The rotation. /// is . - public Location(VirtualParadiseWorld world, Vector3d position = default, Rotation rotation = default) + public Location(World world, Vector3d position = default, Rotation rotation = default) { World = world ?? throw new ArgumentNullException(nameof(world)); Position = position; @@ -67,7 +67,7 @@ public readonly struct Location : IEquatable /// Gets the world represented by this location. /// /// The world. - public VirtualParadiseWorld World { get; init; } + public World World { get; init; } /// /// Determines if two instances are equal. diff --git a/VpSharp/src/PathEasing.cs b/VpSharp/src/PathEasing.cs index 026994c..0d24c06 100644 --- a/VpSharp/src/PathEasing.cs +++ b/VpSharp/src/PathEasing.cs @@ -3,7 +3,7 @@ namespace VpSharp; /// -/// An enumeration of easings for use with . +/// An enumeration of easings for use with . /// public enum PathEasing { diff --git a/VpSharp/src/PathPoint.cs b/VpSharp/src/PathPoint.cs index 34d2e89..1f56f03 100644 --- a/VpSharp/src/PathPoint.cs +++ b/VpSharp/src/PathPoint.cs @@ -4,7 +4,7 @@ using VpSharp.Entities; namespace VpSharp; /// -/// Represents a point along a . +/// Represents a point along a . /// #pragma warning disable CA1815 public readonly struct PathPoint diff --git a/VpSharp/src/UriTarget.cs b/VpSharp/src/UriTarget.cs index 6c73215..9b464db 100644 --- a/VpSharp/src/UriTarget.cs +++ b/VpSharp/src/UriTarget.cs @@ -6,7 +6,7 @@ namespace VpSharp; /// An enumeration of URI targets. /// /// -/// When used with , indicates that that the URI +/// When used with , indicates that that the URI /// will be displayed as a 2D overlay over the 3D world view. This currently uses CEF (Chromium Embedded Framework). /// public enum UriTarget diff --git a/VpSharp/src/VirtualParadiseClient.Avatars.cs b/VpSharp/src/VirtualParadiseClient.Avatars.cs index 5c3f8f8..a018ca5 100644 --- a/VpSharp/src/VirtualParadiseClient.Avatars.cs +++ b/VpSharp/src/VirtualParadiseClient.Avatars.cs @@ -10,7 +10,7 @@ namespace VpSharp; public sealed partial class VirtualParadiseClient { - private readonly ConcurrentDictionary _avatars = new(); + private readonly ConcurrentDictionary _avatars = new(); /// /// Gets the avatar with the specified session. @@ -20,18 +20,18 @@ public sealed partial class VirtualParadiseClient /// The avatar whose session is equal to , or if no match was /// found. /// - public VirtualParadiseAvatar? GetAvatar(int session) + public Avatar? GetAvatar(int session) { - _avatars.TryGetValue(session, out VirtualParadiseAvatar? avatar); + _avatars.TryGetValue(session, out Avatar? avatar); return avatar; } - private VirtualParadiseAvatar AddOrUpdateAvatar(VirtualParadiseAvatar avatar) + private Avatar AddOrUpdateAvatar(Avatar avatar) { return _avatars.AddOrUpdate(avatar.Session, avatar, (_, existing) => { // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract - existing ??= new VirtualParadiseAvatar(this, avatar.Session); + existing ??= new Avatar(this, avatar.Session); existing.Name = avatar.Name; existing.Location = avatar.Location; existing.Application = avatar.Application; @@ -41,7 +41,7 @@ public sealed partial class VirtualParadiseClient }); } - private VirtualParadiseAvatar ExtractAvatar(nint sender) + private Avatar ExtractAvatar(nint sender) { lock (Lock) { @@ -58,7 +58,7 @@ public sealed partial class VirtualParadiseClient string applicationVersion = vp_string(sender, StringAttribute.AvatarApplicationVersion); int session = vp_int(sender, IntegerAttribute.AvatarSession); - return new VirtualParadiseAvatar(this, session) + return new Avatar(this, session) { Name = vp_string(sender, StringAttribute.AvatarName), Location = new Location(CurrentWorld!, position, rotation), diff --git a/VpSharp/src/VirtualParadiseClient.Events.cs b/VpSharp/src/VirtualParadiseClient.Events.cs index 6e3f2ea..d380d6d 100644 --- a/VpSharp/src/VirtualParadiseClient.Events.cs +++ b/VpSharp/src/VirtualParadiseClient.Events.cs @@ -7,13 +7,13 @@ namespace VpSharp; public sealed partial class VirtualParadiseClient { private readonly Subject _avatarClicked = new(); - private readonly Subject _avatarJoined = new(); - private readonly Subject _avatarLeft = new(); + private readonly Subject _avatarJoined = new(); + private readonly Subject _avatarLeft = new(); private readonly Subject _avatarMoved = new(); private readonly Subject _avatarTypeChanged = new(); private readonly Subject _inviteRequestReceived = new(); private readonly Subject _joinRequestReceived = new(); - private readonly Subject _messageReceived = new(); + private readonly Subject _messageReceived = new(); private readonly Subject _objectBump = new(); private readonly Subject _objectChanged = new(); private readonly Subject _objectClicked = new(); @@ -35,7 +35,7 @@ public sealed partial class VirtualParadiseClient /// /// Occurs when an avatar has entered the vicinity of the client. /// - public IObservable AvatarJoined + public IObservable AvatarJoined { get => _avatarJoined; } @@ -43,7 +43,7 @@ public sealed partial class VirtualParadiseClient /// /// Occurs when an avatar has left the vicinity of the client. /// - public IObservable AvatarLeft + public IObservable AvatarLeft { get => _avatarLeft; } @@ -83,7 +83,7 @@ public sealed partial class VirtualParadiseClient /// /// Occurs when a chat message or console message has been received. /// - public IObservable MessageReceived + public IObservable MessageReceived { get => _messageReceived; } diff --git a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs index e45ef4b..98f038c 100644 --- a/VpSharp/src/VirtualParadiseClient.NativeEvents.cs +++ b/VpSharp/src/VirtualParadiseClient.NativeEvents.cs @@ -52,7 +52,7 @@ public sealed partial class VirtualParadiseClient private void OnChatNativeEvent(nint sender) { - VirtualParadiseMessage message; + Message message; lock (Lock) { @@ -74,8 +74,8 @@ public sealed partial class VirtualParadiseClient style = (FontStyle)vp_int(sender, IntegerAttribute.ChatEffects); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; - message = new VirtualParadiseMessage((MessageType)type, name, content, avatar, style, color); + Avatar avatar = GetAvatar(session)!; + message = new Message((MessageType)type, name, content, avatar, style, color); } _messageReceived.OnNext(message); @@ -88,7 +88,7 @@ public sealed partial class VirtualParadiseClient private void OnAvatarAddNativeEvent(nint sender) { - VirtualParadiseAvatar avatar = ExtractAvatar(sender); + Avatar avatar = ExtractAvatar(sender); avatar = AddOrUpdateAvatar(avatar); _avatarJoined.OnNext(avatar); } @@ -115,7 +115,7 @@ public sealed partial class VirtualParadiseClient rotation = Rotation.CreateFromTiltYawRoll(pitch, yaw, 0); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; if (type != avatar.Type) { int oldType = avatar.Type; @@ -145,8 +145,8 @@ public sealed partial class VirtualParadiseClient session = vp_int(sender, IntegerAttribute.AvatarSession); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; - _avatars.TryRemove(session, out VirtualParadiseAvatar _); + Avatar avatar = GetAvatar(session)!; + _avatars.TryRemove(session, out Avatar _); _avatarLeft.OnNext(avatar); } @@ -173,7 +173,7 @@ public sealed partial class VirtualParadiseClient } else { - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; var args = new ObjectCreatedEventArgs(avatar, virtualParadiseObject); _objectCreated.OnNext(args); } @@ -190,7 +190,7 @@ public sealed partial class VirtualParadiseClient session = vp_int(sender, IntegerAttribute.AvatarSession); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; VirtualParadiseObject? cachedObject = null; if (_objects.TryGetValue(objectId, out VirtualParadiseObject? virtualParadiseObject)) @@ -226,7 +226,7 @@ public sealed partial class VirtualParadiseClient session = vp_int(sender, IntegerAttribute.AvatarSession); } - VirtualParadiseAvatar? avatar = GetAvatar(session); + Avatar? avatar = GetAvatar(session); VirtualParadiseObject? virtualParadiseObject; try @@ -261,7 +261,7 @@ public sealed partial class VirtualParadiseClient clickPoint = new Vector3d(x, y, z); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; try { VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); @@ -276,7 +276,7 @@ public sealed partial class VirtualParadiseClient private async void OnWorldListNativeEvent(nint sender) { - VirtualParadiseWorld world; + World world; string name; int avatarCount; WorldState state; @@ -287,7 +287,7 @@ public sealed partial class VirtualParadiseClient avatarCount = vp_int(sender, IntegerAttribute.WorldUsers); state = (WorldState)vp_int(sender, IntegerAttribute.WorldState); - world = new VirtualParadiseWorld(this, name) { AvatarCount = avatarCount, State = state }; + world = new World(this, name) { AvatarCount = avatarCount, State = state }; _worlds[name] = world; } @@ -332,7 +332,7 @@ public sealed partial class VirtualParadiseClient userId = vp_int(sender, IntegerAttribute.FriendUserId); } - VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); + User user = await GetUserAsync(userId).ConfigureAwait(false); _friends.AddOrUpdate(userId, user, (_, _) => user); } @@ -361,7 +361,7 @@ public sealed partial class VirtualParadiseClient private void OnUserAttributesNativeEvent(nint sender) { int userId; - VirtualParadiseUser user; + User user; lock (Lock) { @@ -373,7 +373,7 @@ public sealed partial class VirtualParadiseClient int onlineTime = vp_int(sender, IntegerAttribute.UserOnlineTime); int registered = vp_int(sender, IntegerAttribute.UserRegistrationTime); - user = new VirtualParadiseUser(this, userId) + user = new User(this, userId) { Name = name, EmailAddress = email, @@ -383,7 +383,7 @@ public sealed partial class VirtualParadiseClient }; } - if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource? taskCompletionSource)) + if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource? taskCompletionSource)) { taskCompletionSource.SetResult(user); } @@ -423,8 +423,8 @@ public sealed partial class VirtualParadiseClient clickPoint = new Vector3d(x, y, z); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; - VirtualParadiseAvatar clickedAvatar = GetAvatar(clickedSession)!; + Avatar avatar = GetAvatar(session)!; + Avatar clickedAvatar = GetAvatar(clickedSession)!; var args = new AvatarClickedEventArgs(avatar, clickedAvatar, clickPoint); _avatarClicked.OnNext(args); } @@ -452,13 +452,13 @@ public sealed partial class VirtualParadiseClient worldName = vp_string(sender, StringAttribute.TeleportWorld); } - VirtualParadiseWorld world = (string.IsNullOrWhiteSpace(worldName) + World world = (string.IsNullOrWhiteSpace(worldName) ? CurrentWorld : await GetWorldAsync(worldName).ConfigureAwait(false))!; var location = new Location(world, position, rotation); CurrentAvatar!.Location = location; - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; var args = new TeleportedEventArgs(avatar, location); _teleported.OnNext(args); } @@ -474,7 +474,7 @@ public sealed partial class VirtualParadiseClient objectId = vp_int(sender, IntegerAttribute.ObjectId); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; try { var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false); @@ -505,7 +505,7 @@ public sealed partial class VirtualParadiseClient return; } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; var uri = new Uri(url); var args = new UriReceivedEventArgs(uri, target, avatar); _uriReceived.OnNext(args); @@ -522,7 +522,7 @@ public sealed partial class VirtualParadiseClient objectId = vp_int(sender, IntegerAttribute.ObjectId); } - VirtualParadiseAvatar avatar = GetAvatar(session)!; + Avatar avatar = GetAvatar(session)!; try { var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false); @@ -548,7 +548,7 @@ public sealed partial class VirtualParadiseClient name = vp_string(NativeInstanceHandle, StringAttribute.JoinName); } - VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); + User user = await GetUserAsync(userId).ConfigureAwait(false); var joinRequest = new JoinRequest(this, requestId, name, user); _joinRequestReceived.OnNext(joinRequest); } @@ -581,8 +581,8 @@ public sealed partial class VirtualParadiseClient worldName = vp_string(sender, StringAttribute.InviteWorld); } - VirtualParadiseWorld world = (await GetWorldAsync(worldName).ConfigureAwait(false))!; - VirtualParadiseUser user = await GetUserAsync(userId).ConfigureAwait(false); + World world = (await GetWorldAsync(worldName).ConfigureAwait(false))!; + User user = await GetUserAsync(userId).ConfigureAwait(false); var location = new Location(world, position, rotation); var request = new InviteRequest(this, requestId, avatarName, user, location); diff --git a/VpSharp/src/VirtualParadiseClient.Objects.cs b/VpSharp/src/VirtualParadiseClient.Objects.cs index 61c1b02..d3d8dff 100644 --- a/VpSharp/src/VirtualParadiseClient.Objects.cs +++ b/VpSharp/src/VirtualParadiseClient.Objects.cs @@ -214,9 +214,9 @@ public sealed partial class VirtualParadiseClient VirtualParadiseObject virtualParadiseObject = type switch { - ObjectType.Model => new VirtualParadiseModelObject(this, id), - ObjectType.ParticleEmitter => new VirtualParadiseParticleEmitterObject(this, id), - ObjectType.Path => new VirtualParadisePathObject(this, id), + ObjectType.Model => new ModelObject(this, id), + ObjectType.ParticleEmitter => new ParticleEmitterObject(this, id), + ObjectType.Path => new PathObject(this, id), _ => throw new NotSupportedException(ExceptionMessages.UnsupportedObjectType) }; diff --git a/VpSharp/src/VirtualParadiseClient.Users.cs b/VpSharp/src/VirtualParadiseClient.Users.cs index 286d9af..1cf42eb 100644 --- a/VpSharp/src/VirtualParadiseClient.Users.cs +++ b/VpSharp/src/VirtualParadiseClient.Users.cs @@ -6,8 +6,8 @@ namespace VpSharp; public sealed partial class VirtualParadiseClient { - private readonly ConcurrentDictionary _users = new(); - private readonly ConcurrentDictionary> _usersCompletionSources = new(); + private readonly ConcurrentDictionary _users = new(); + private readonly ConcurrentDictionary> _usersCompletionSources = new(); /// /// Gets a user by their ID. @@ -16,19 +16,19 @@ public sealed partial class VirtualParadiseClient /// /// The user whose ID is equal to , or if no match was found. /// - public async Task GetUserAsync(int userId) + public async Task GetUserAsync(int userId) { - if (_users.TryGetValue(userId, out VirtualParadiseUser? user)) + if (_users.TryGetValue(userId, out User? user)) { return user; } - if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource? taskCompletionSource)) + if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource? taskCompletionSource)) { return await taskCompletionSource.Task.ConfigureAwait(false); } - taskCompletionSource = new TaskCompletionSource(); + taskCompletionSource = new TaskCompletionSource(); _usersCompletionSources.TryAdd(userId, taskCompletionSource); lock (Lock) @@ -39,16 +39,16 @@ public sealed partial class VirtualParadiseClient user = await taskCompletionSource.Task.ConfigureAwait(false); user = AddOrUpdateUser(user); - _usersCompletionSources.TryRemove(userId, out TaskCompletionSource _); + _usersCompletionSources.TryRemove(userId, out TaskCompletionSource _); return user; } - private VirtualParadiseUser AddOrUpdateUser(VirtualParadiseUser user) + private User AddOrUpdateUser(User user) { return _users.AddOrUpdate(user.Id, user, (_, existing) => { // ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract - existing ??= new VirtualParadiseUser(this, user.Id); + existing ??= new User(this, user.Id); existing.Name = user.Name; existing.EmailAddress = user.EmailAddress; existing.LastLogin = user.LastLogin; diff --git a/VpSharp/src/VirtualParadiseClient.Worlds.cs b/VpSharp/src/VirtualParadiseClient.Worlds.cs index 66bb6a3..14111b4 100644 --- a/VpSharp/src/VirtualParadiseClient.Worlds.cs +++ b/VpSharp/src/VirtualParadiseClient.Worlds.cs @@ -8,22 +8,22 @@ namespace VpSharp; public sealed partial class VirtualParadiseClient { private readonly ConcurrentDictionary _worldSettings = new(); - private readonly ConcurrentDictionary _worlds = new(); - private Channel? _worldListChannel = Channel.CreateUnbounded(); + private readonly ConcurrentDictionary _worlds = new(); + private Channel? _worldListChannel = Channel.CreateUnbounded(); private TaskCompletionSource _worldSettingsCompletionSource = new(); /// /// Gets an enumerable of the worlds returned by the universe server. /// - /// An containing values. + /// An containing values. /// /// This method will yield results back as they are received from the world server. To access a consumed collection, /// use . /// /// - public IAsyncEnumerable EnumerateWorldsAsync() + public IAsyncEnumerable EnumerateWorldsAsync() { - _worldListChannel = Channel.CreateUnbounded(); + _worldListChannel = Channel.CreateUnbounded(); lock (Lock) { _ = vp_world_list(NativeInstanceHandle, 0); @@ -37,20 +37,20 @@ public sealed partial class VirtualParadiseClient /// /// The name of the world. /// - /// A whose name is equal to , or + /// A whose name is equal to , or /// if no match was found. /// /// /// is , empty, or consists of only whitespace. /// - public async Task GetWorldAsync(string name) + public async Task GetWorldAsync(string name) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException(ExceptionMessages.WorldNameCannotBeEmpty, nameof(name)); } - await foreach (VirtualParadiseWorld world in EnumerateWorldsAsync()) + await foreach (World world in EnumerateWorldsAsync()) { if (string.Equals(world.Name, name, StringComparison.Ordinal)) { @@ -64,18 +64,18 @@ public sealed partial class VirtualParadiseClient /// /// Gets a read-only view of the worlds returned by the universe server. /// - /// An containing values. + /// An containing values. /// /// This method will consume the list in full before returning, and therefore can result in apparent "hang" while the /// list is being fetched. For an alternative, use /// . /// /// - public async Task> GetWorldsAsync() + public async Task> GetWorldsAsync() { - var worlds = new List(); + var worlds = new List(); - await foreach (VirtualParadiseWorld world in EnumerateWorldsAsync()) + await foreach (World world in EnumerateWorldsAsync()) { worlds.Add(world); } diff --git a/VpSharp/src/VirtualParadiseClient.cs b/VpSharp/src/VirtualParadiseClient.cs index d926787..2f69dae 100644 --- a/VpSharp/src/VirtualParadiseClient.cs +++ b/VpSharp/src/VirtualParadiseClient.cs @@ -24,7 +24,7 @@ public sealed partial class VirtualParadiseClient : IDisposable private readonly VirtualParadiseConfiguration _configuration; - private readonly ConcurrentDictionary _friends = new(); + private readonly ConcurrentDictionary _friends = new(); private readonly Dictionary> _inviteCompletionSources = new(); private readonly Dictionary> _joinCompletionSources = new(); @@ -66,7 +66,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Gets a read-only view of the cached avatars. /// /// The cached avatars. - public IReadOnlyList Avatars + public IReadOnlyList Avatars { get => _avatars.Values.ToArray(); } @@ -75,17 +75,17 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Gets the current avatar associated with this client. /// /// - /// An instance of , or if this client is not in a world. + /// An instance of , or if this client is not in a world. /// - public VirtualParadiseAvatar? CurrentAvatar { get; internal set; } + public Avatar? CurrentAvatar { get; internal set; } /// /// Gets the current user to which this client is logged in. /// /// - /// An instance of , or if this client is not logged in. + /// An instance of , or if this client is not logged in. /// - public VirtualParadiseUser? CurrentUser { get; internal set; } + public User? CurrentUser { get; internal set; } /// /// Gets the world to which this client is currently connected. @@ -94,7 +94,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// The world to which this client is currently connected, or if this client is not currently /// in a world. /// - public VirtualParadiseWorld? CurrentWorld + public World? CurrentWorld { get => CurrentAvatar?.Location.World; } @@ -109,7 +109,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Gets a read-only view of the cached worlds. /// /// The cached worlds. - public IReadOnlyList Worlds + public IReadOnlyList Worlds { get => _worlds.Values.ToArray(); } @@ -225,7 +225,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(string worldName, Vector3d position) + public async Task EnterAsync(string worldName, Vector3d position) { await EnterAsync(worldName).ConfigureAwait(false); await CurrentAvatar!.TeleportAsync(position, Rotation.None).ConfigureAwait(false); @@ -245,7 +245,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(string worldName, Vector3d position, Rotation rotation) + public async Task EnterAsync(string worldName, Vector3d position, Rotation rotation) { await EnterAsync(worldName).ConfigureAwait(false); await CurrentAvatar!.TeleportAsync(position, rotation).ConfigureAwait(false); @@ -264,7 +264,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(VirtualParadiseWorld world, Vector3d position) + public async Task EnterAsync(World world, Vector3d position) { await EnterAsync(world).ConfigureAwait(false); await CurrentAvatar!.TeleportAsync(position, Rotation.None).ConfigureAwait(false); @@ -283,7 +283,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(VirtualParadiseWorld world, Vector3d position, Rotation rotation) + public async Task EnterAsync(World world, Vector3d position, Rotation rotation) { await EnterAsync(world).ConfigureAwait(false); await CurrentAvatar!.TeleportAsync(position, rotation).ConfigureAwait(false); @@ -300,7 +300,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(VirtualParadiseWorld world) + public async Task EnterAsync(World world) { if (world is null) { @@ -314,7 +314,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Enters a specified world. /// /// The world to enter. - /// A representing the world. + /// A representing the world. /// is . /// /// A world enter was attempted before the client was connected to a universe. @@ -323,7 +323,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// Connection to the universe server was lost, or connecting to the world failed. /// The specified world was not found. /// Connection to the world server timed out. - public async Task EnterAsync(string worldName) + public async Task EnterAsync(string worldName) { if (worldName is null) { @@ -389,21 +389,22 @@ public sealed partial class VirtualParadiseClient : IDisposable await _worldSettingsCompletionSource.Task.ConfigureAwait(false); - VirtualParadiseWorld? world = await GetWorldAsync(worldName).ConfigureAwait(false); + World? world = await GetWorldAsync(worldName).ConfigureAwait(false); if (world is null) { // we entered the world but it wasn't listed. unlisted world. we'll try our best to create details for it - world = new VirtualParadiseWorld(this, worldName); + world = new World(this, worldName); } if (CurrentAvatar is not null) { + // TODO why is this here? we reassign CurrentAvatar right below! CurrentAvatar.Location = new Location(world); } world.Size = new Size(size, size); - CurrentAvatar = new VirtualParadiseAvatar(this, -1) + CurrentAvatar = new Avatar(this, -1) { Application = _configuration.Application!, Name = $"[{_configuration.BotName}]", @@ -564,7 +565,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// -or- /// is too long to send. /// - public Task SendMessageAsync(string message) + public Task SendMessageAsync(string message) { if (message is null) { @@ -592,8 +593,8 @@ public sealed partial class VirtualParadiseClient : IDisposable } } - VirtualParadiseAvatar? avatar = CurrentAvatar; - return Task.FromResult(new VirtualParadiseMessage( + Avatar? avatar = CurrentAvatar; + return Task.FromResult(new Message( MessageType.ChatMessage, avatar!.Name, message, @@ -619,7 +620,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// -or- /// is too long to send. /// - public Task SendMessageAsync(string message, FontStyle fontStyle, Color color) + public Task SendMessageAsync(string message, FontStyle fontStyle, Color color) { return SendMessageAsync(null, message, fontStyle, color); } @@ -641,7 +642,7 @@ public sealed partial class VirtualParadiseClient : IDisposable /// -or- /// is too long to send. /// - public Task SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color) + public Task SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color) { if (message is null) { @@ -679,8 +680,8 @@ public sealed partial class VirtualParadiseClient : IDisposable } } - VirtualParadiseAvatar avatar = CurrentAvatar!; - return Task.FromResult(new VirtualParadiseMessage( + Avatar avatar = CurrentAvatar!; + return Task.FromResult(new Message( MessageType.ConsoleMessage, name, message, @@ -738,7 +739,7 @@ public sealed partial class VirtualParadiseClient : IDisposable pair.Value.TrySetCanceled(); } - foreach (KeyValuePair> pair in _usersCompletionSources) + foreach (KeyValuePair> pair in _usersCompletionSources) { pair.Value.TrySetCanceled(); }