mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-09 23:15:41 +00:00
Compare commits
3 Commits
e91e703098
...
05b53da5a4
Author | SHA1 | Date | |
---|---|---|---|
05b53da5a4 | |||
338e338155 | |||
397ec2bcf9 |
@ -16,7 +16,7 @@
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Description>A modern Virtual Paradise SDK wrapper for .NET</Description>
|
||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<PackageIcon>branding_Icon.png</PackageIcon>
|
||||
<PackageIconUrl/>
|
||||
<PackageTags>bot wrapper sdk dotnet wrapper-api wrapper-library virtual-paradise</PackageTags>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
@ -47,7 +47,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\icon.png">
|
||||
<None Include="..\branding_Icon.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath/>
|
||||
</None>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<h1 align="center"><img src="banner.png"></h1>
|
||||
<h1 align="center"><img src="branding_Banner.png"></h1>
|
||||
<p align="center">
|
||||
<a href="https://github.com/oliverbooth/VpSharp/actions?query=workflow%3A%22.NET%22"><img src="https://img.shields.io/github/actions/workflow/status/oliverbooth/VpSharp/dotnet.yml?style=flat-square" alt="GitHub Workflow Status" title="GitHub Workflow Status"></a>
|
||||
<a href="https://github.com/oliverbooth/VpSharp/issues"><img src="https://img.shields.io/github/issues/oliverbooth/VpSharp?style=flat-square" alt="GitHub Issues" title="GitHub Issues"></a>
|
||||
|
@ -8,17 +8,17 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\VpSharp.Commands\VpSharp.Commands.csproj" />
|
||||
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj" />
|
||||
<ProjectReference Include="..\..\VpSharp.Commands\VpSharp.Commands.csproj"/>
|
||||
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="libvpsdk.so">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="VPSDK.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="libvpsdk.so">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="VPSDK.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -8,17 +8,17 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\VpSharp.Commands\VpSharp.Commands.csproj" />
|
||||
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj" />
|
||||
<ProjectReference Include="..\..\VpSharp.Commands\VpSharp.Commands.csproj" />
|
||||
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="VPSDK.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="libvpsdk.so">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="VPSDK.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="libvpsdk.so">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace VpSharp.Commands;
|
||||
/// </summary>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The executing avatar.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the client which raised the event.
|
||||
@ -65,7 +65,7 @@ public sealed class CommandContext
|
||||
/// regular chat message.
|
||||
/// </param>
|
||||
/// <returns>The message which was sent.</returns>
|
||||
public Task<VirtualParadiseMessage> RespondAsync(string message, bool ephemeral = false)
|
||||
public Task<Message> RespondAsync(string message, bool ephemeral = false)
|
||||
{
|
||||
return ephemeral
|
||||
? Avatar.SendMessageAsync(Client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black)
|
||||
|
@ -176,7 +176,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected internal override Task OnMessageReceived(VirtualParadiseMessage message)
|
||||
protected internal override Task OnMessageReceived(Message message)
|
||||
{
|
||||
if (message is null)
|
||||
{
|
||||
|
@ -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<TestCommands>();
|
||||
|
||||
@ -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}");
|
||||
|
@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
README.md = README.md
|
||||
.editorconfig = .editorconfig
|
||||
CHANGELOG.md = CHANGELOG.md
|
||||
Directory.Build.props = Directory.Build.props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VpSharp.Commands", "VpSharp.Commands\VpSharp.Commands.csproj", "{8EE96C20-57AA-48E1-95A2-04580C4F7E05}"
|
||||
|
@ -27,7 +27,7 @@ public abstract class VirtualParadiseClientExtension
|
||||
/// Called when a chat message is received.
|
||||
/// </summary>
|
||||
/// <param name="args">An object containing event data.</param>
|
||||
protected internal virtual Task OnMessageReceived(VirtualParadiseMessage message)
|
||||
protected internal virtual Task OnMessageReceived(Message message)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents an avatar within a world.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
public sealed class Avatar : IEquatable<Avatar>
|
||||
{
|
||||
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<VirtualParadiseAvatar>
|
||||
/// <value><see langword="true" /> if this avatar is a bot; otherwise, <see langword="false" />.</value>
|
||||
public bool IsBot
|
||||
{
|
||||
get => Name is {Length: > 1} name && name[0] == '[' && name[^1] == ']';
|
||||
get => Name is { Length: > 1 } name && name[0] == '[' && name[^1] == ']';
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -67,7 +67,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
public int UserId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseAvatar" /> instances are equal.
|
||||
/// Determines if two <see cref="Avatar" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -75,13 +75,13 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool operator ==(VirtualParadiseAvatar? left, VirtualParadiseAvatar? right)
|
||||
public static bool operator ==(Avatar? left, Avatar? right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseAvatar" /> instances are not equal.
|
||||
/// Determines if two <see cref="Avatar" /> instances are not equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -89,7 +89,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is not equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
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<VirtualParadiseAvatar>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseAvatar" /> instances are equal.
|
||||
/// Determines if two <see cref="Avatar" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="other">The other instance.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true" /> if this instance is equal to <paramref name="other" />; otherwise, <see langword="false" />.
|
||||
/// </returns>
|
||||
public bool Equals(VirtualParadiseAvatar? other)
|
||||
public bool Equals(Avatar? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
@ -157,7 +157,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// <inheritdoc />
|
||||
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));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -172,7 +172,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// Gets the user associated with this avatar.
|
||||
/// </summary>
|
||||
/// <returns>The user.</returns>
|
||||
public async Task<VirtualParadiseUser> GetUserAsync()
|
||||
public async Task<User> GetUserAsync()
|
||||
{
|
||||
_user ??= await _client.GetUserAsync(UserId).ConfigureAwait(false);
|
||||
return _user;
|
||||
@ -196,9 +196,8 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// -or-
|
||||
/// <para><paramref name="message" /> is too long to send.</para>
|
||||
/// </exception>
|
||||
public Task<VirtualParadiseMessage> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
||||
public Task<Message> 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<VirtualParadiseAvatar>
|
||||
/// <para><paramref name="message" /> is too long to send.</para>
|
||||
/// </exception>
|
||||
/// <remarks>Passing <see langword="null" /> to <paramref name="name" /> will hide the name from the recipient.</remarks>
|
||||
public Task<VirtualParadiseMessage> SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color)
|
||||
public Task<Message> SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color)
|
||||
{
|
||||
if (message is null)
|
||||
{
|
||||
@ -234,7 +233,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
throw new ArgumentException(ExceptionMessages.ValueCannotBeEmpty, nameof(message));
|
||||
}
|
||||
|
||||
VirtualParadiseAvatar avatar;
|
||||
Avatar avatar;
|
||||
|
||||
lock (_client.Lock)
|
||||
{
|
||||
@ -249,6 +248,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
color.B
|
||||
);
|
||||
|
||||
// TODO remove if statement
|
||||
if (reason != ReasonCode.Success)
|
||||
{
|
||||
switch (reason)
|
||||
@ -267,7 +267,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
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<VirtualParadiseAvatar>
|
||||
/// <param name="world">The name of the world to which this avatar should be teleported.</param>
|
||||
/// <param name="position">The position to which this avatar should be teleported.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="world" /> is <see langword="null" />.</exception>
|
||||
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<VirtualParadiseAvatar>
|
||||
/// <param name="position">The position to which this avatar should be teleported.</param>
|
||||
/// <param name="rotation">The rotation to which this avatar should be teleported.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="world" /> is <see langword="null" />.</exception>
|
||||
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<VirtualParadiseAvatar>
|
||||
}
|
||||
}
|
||||
|
||||
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<VirtualParadiseAvatar>
|
||||
/// <param name="position">The position to which this avatar should be teleported.</param>
|
||||
public Task TeleportAsync(Vector3d position)
|
||||
{
|
||||
return TeleportAsync(Location with {Position = position});
|
||||
return TeleportAsync(Location with { Position = position });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -465,7 +465,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
|
||||
/// <param name="rotation">The rotation to which this avatar should be teleported</param>
|
||||
public Task TeleportAsync(Vector3d position, Rotation rotation)
|
||||
{
|
||||
return TeleportAsync(Location with {Position = position, Rotation = rotation});
|
||||
return TeleportAsync(Location with { Position = position, Rotation = rotation });
|
||||
}
|
||||
|
||||
/// <summary>
|
@ -5,13 +5,13 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents a message.
|
||||
/// </summary>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The message author.</value>
|
||||
public VirtualParadiseAvatar Author { get; }
|
||||
public Avatar Author { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the message content.
|
@ -9,15 +9,15 @@ namespace VpSharp.Entities;
|
||||
/// Represents an object which renders as a 3D model. A "model" object will contain a <c>Model</c>, <c>Description</c>
|
||||
/// and <c>Action</c> field.
|
||||
/// </summary>
|
||||
public class VirtualParadiseModelObject : VirtualParadiseObject
|
||||
public class ModelObject : VirtualParadiseObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VirtualParadiseModelObject" /> class.
|
||||
/// Initializes a new instance of the <see cref="ModelObject" /> class.
|
||||
/// </summary>
|
||||
/// <param name="client">The owning client.</param>
|
||||
/// <param name="id">The object ID.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="client" /> is <see langword="null" />.</exception>
|
||||
internal VirtualParadiseModelObject(VirtualParadiseClient client, int id)
|
||||
internal ModelObject(VirtualParadiseClient client, int id)
|
||||
: base(client, id)
|
||||
{
|
||||
}
|
||||
@ -46,11 +46,11 @@ public class VirtualParadiseModelObject : VirtualParadiseObject
|
||||
/// <param name="action">The builder which defines parameters to change.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="action" /> is <see langword="null" />.</exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// <para><see cref="VirtualParadiseModelObjectBuilder.ModificationTimestamp" /> was assigned.</para>
|
||||
/// <para><see cref="ModelObjectBuilder.ModificationTimestamp" /> was assigned.</para>
|
||||
/// -or-
|
||||
/// <para><see cref="VirtualParadiseModelObjectBuilder.Owner" /> was assigned.</para>
|
||||
/// <para><see cref="ModelObjectBuilder.Owner" /> was assigned.</para>
|
||||
/// </exception>
|
||||
public async Task ModifyAsync(Action<VirtualParadiseModelObjectBuilder> action)
|
||||
public async Task ModifyAsync(Action<ModelObjectBuilder> action)
|
||||
{
|
||||
if (action is null)
|
||||
{
|
||||
@ -58,7 +58,7 @@ public class VirtualParadiseModelObject : VirtualParadiseObject
|
||||
}
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<ReasonCode>();
|
||||
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
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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
|
||||
/// <inheritdoc />
|
||||
protected internal override void ExtractFromOther(VirtualParadiseObject virtualParadiseObject)
|
||||
{
|
||||
if (virtualParadiseObject is not VirtualParadiseModelObject model)
|
||||
if (virtualParadiseObject is not ModelObject model)
|
||||
{
|
||||
return;
|
||||
}
|
@ -8,11 +8,11 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Provides mutability for <see cref="VirtualParadiseObject" />.
|
||||
/// </summary>
|
||||
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));
|
@ -10,9 +10,9 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents the base class for object builders.
|
||||
/// </summary>
|
||||
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 <see cref="InvalidOperationException" /> at
|
||||
/// any other point.
|
||||
/// </remarks>
|
||||
public Option<VirtualParadiseUser> Owner { get; set; }
|
||||
public Option<User> Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
@ -13,15 +13,15 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents a particle emitter object.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject
|
||||
public sealed class ParticleEmitterObject : VirtualParadiseObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VirtualParadiseParticleEmitterObject" /> class.
|
||||
/// Initializes a new instance of the <see cref="ParticleEmitterObject" /> class.
|
||||
/// </summary>
|
||||
/// <param name="client">The owning client.</param>
|
||||
/// <param name="id">The object ID.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="client" /> is <see langword="null" />.</exception>
|
||||
internal VirtualParadiseParticleEmitterObject(VirtualParadiseClient client, int id)
|
||||
internal ParticleEmitterObject(VirtualParadiseClient client, int id)
|
||||
: base(client, id)
|
||||
{
|
||||
}
|
||||
@ -217,13 +217,13 @@ public sealed class VirtualParadiseParticleEmitterObject : VirtualParadiseObject
|
||||
/// <inheritdoc />
|
||||
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<string, PropertyInfo>();
|
||||
var converterMap = new Dictionary<string, ValueConverter>();
|
||||
|
@ -11,13 +11,13 @@ using VpSharp.Internal.ValueConverters;
|
||||
namespace VpSharp.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Provides mutability for a <see cref="VirtualParadiseParticleEmitterObject" />.
|
||||
/// Provides mutability for a <see cref="ParticleEmitterObject" />.
|
||||
/// </summary>
|
||||
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
|
||||
/// </summary>
|
||||
/// <param name="value">The maximum volume, or <see langword="default" /> to leave unchanged.</param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithAccelerationMax(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithAccelerationMax(Option<Vector3d> value)
|
||||
{
|
||||
AccelerationMax = value;
|
||||
return this;
|
||||
@ -231,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithAccelerationMin(Option<Vector3d> value)
|
||||
{
|
||||
AccelerationMin = value;
|
||||
return this;
|
||||
@ -242,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(Option<ParticleBlendMode> value)
|
||||
public ParticleEmitterObjectBuilder WithBlendMode(Option<ParticleBlendMode> value)
|
||||
{
|
||||
BlendMode = value;
|
||||
return this;
|
||||
@ -253,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(Option<Color> value)
|
||||
public ParticleEmitterObjectBuilder WithColorMax(Option<Color> value)
|
||||
{
|
||||
ColorMax = value;
|
||||
return this;
|
||||
@ -264,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(Option<Color> value)
|
||||
public ParticleEmitterObjectBuilder WithColorMin(Option<Color> value)
|
||||
{
|
||||
ColorMin = value;
|
||||
return this;
|
||||
@ -275,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(Option<TimeSpan> value)
|
||||
public ParticleEmitterObjectBuilder WithEmitterLifespan(Option<TimeSpan> value)
|
||||
{
|
||||
EmitterLifespan = value;
|
||||
return this;
|
||||
@ -289,7 +289,7 @@ public sealed class VirtualParadiseParticleEmitterObjectBuilder : VirtualParadis
|
||||
/// <see langword="default" /> to leave unchanged.
|
||||
/// </param>
|
||||
/// <returns>The current instance.</returns>
|
||||
public VirtualParadiseParticleEmitterObjectBuilder WithInterpolation(Option<bool> value)
|
||||
public ParticleEmitterObjectBuilder WithInterpolation(Option<bool> value)
|
||||
{
|
||||
Interpolate = value;
|
||||
return this;
|
||||
@ -300,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(Option<double> value)
|
||||
public ParticleEmitterObjectBuilder WithOpacity(Option<double> value)
|
||||
{
|
||||
Opacity = value;
|
||||
return this;
|
||||
@ -311,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(Option<TimeSpan> value)
|
||||
public ParticleEmitterObjectBuilder WithParticleLifespan(Option<TimeSpan> value)
|
||||
{
|
||||
ParticleLifespan = value;
|
||||
return this;
|
||||
@ -322,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(Option<ParticleType> value)
|
||||
public ParticleEmitterObjectBuilder WithParticleType(Option<ParticleType> value)
|
||||
{
|
||||
ParticleType = value;
|
||||
return this;
|
||||
@ -333,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(Option<int> value)
|
||||
public ParticleEmitterObjectBuilder WithReleaseCount(Option<int> value)
|
||||
{
|
||||
ReleaseCount = value;
|
||||
return this;
|
||||
@ -344,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(Option<TimeSpan> value)
|
||||
public ParticleEmitterObjectBuilder WithReleaseTime(Option<TimeSpan> value)
|
||||
{
|
||||
ReleaseTime = value;
|
||||
return this;
|
||||
@ -355,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSizeMax(Option<Vector3d> value)
|
||||
{
|
||||
SizeMax = value;
|
||||
return this;
|
||||
@ -366,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSizeMin(Option<Vector3d> value)
|
||||
{
|
||||
SizeMin = value;
|
||||
return this;
|
||||
@ -377,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSpeedMax(Option<Vector3d> value)
|
||||
{
|
||||
SpeedMax = value;
|
||||
return this;
|
||||
@ -388,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSpeedMin(Option<Vector3d> value)
|
||||
{
|
||||
SpeedMin = value;
|
||||
return this;
|
||||
@ -399,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSpinMax(Option<Vector3d> value)
|
||||
{
|
||||
SpinMax = value;
|
||||
return this;
|
||||
@ -410,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithSpinMin(Option<Vector3d> value)
|
||||
{
|
||||
SpinMin = value;
|
||||
return this;
|
||||
@ -421,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithStartAngleMax(Option<Vector3d> value)
|
||||
{
|
||||
StartAngleMax = value;
|
||||
return this;
|
||||
@ -432,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithStartAngleMin(Option<Vector3d> value)
|
||||
{
|
||||
StartAngleMin = value;
|
||||
return this;
|
||||
@ -443,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithVolumeMax(Option<Vector3d> value)
|
||||
{
|
||||
VolumeMax = value;
|
||||
return this;
|
||||
@ -454,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(Option<Vector3d> value)
|
||||
public ParticleEmitterObjectBuilder WithVolumeMin(Option<Vector3d> value)
|
||||
{
|
||||
VolumeMin = value;
|
||||
return this;
|
||||
@ -465,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(Option<string> value)
|
||||
public ParticleEmitterObjectBuilder WithTag(Option<string> value)
|
||||
{
|
||||
Tag = value;
|
||||
return this;
|
||||
@ -476,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(Option<string> value)
|
||||
public ParticleEmitterObjectBuilder WithTexture(Option<string> value)
|
||||
{
|
||||
Texture = value;
|
||||
return this;
|
@ -1,11 +1,11 @@
|
||||
namespace VpSharp.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a path contained by a <see cref="VirtualParadisePathObject" />.
|
||||
/// Represents a path contained by a <see cref="PathObject" />.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadisePath : ICloneable
|
||||
public sealed class Path : ICloneable
|
||||
{
|
||||
internal VirtualParadisePath(PathEasing easing, string name, IEnumerable<PathPoint> points, bool isClosed)
|
||||
internal Path(PathEasing easing, string name, IEnumerable<PathPoint> points, bool isClosed)
|
||||
{
|
||||
Easing = easing;
|
||||
Name = name;
|
||||
@ -40,6 +40,6 @@ public sealed class VirtualParadisePath : ICloneable
|
||||
/// <inheritdoc />
|
||||
public object Clone()
|
||||
{
|
||||
return new VirtualParadisePath(Easing, Name, Points, IsClosed);
|
||||
return new Path(Easing, Name, Points, IsClosed);
|
||||
}
|
||||
}
|
@ -9,15 +9,15 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents a path object.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadisePathObject : VirtualParadiseObject
|
||||
public sealed class PathObject : VirtualParadiseObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VirtualParadisePathObject" /> class.
|
||||
/// Initializes a new instance of the <see cref="PathObject" /> class.
|
||||
/// </summary>
|
||||
/// <param name="client">The owning client.</param>
|
||||
/// <param name="id">The object ID.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="client" /> is <see langword="null" />.</exception>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The path in this object.</value>
|
||||
public VirtualParadisePath Path { get; set; } = null!;
|
||||
public Path Path { get; set; } = null!;
|
||||
|
||||
/// <inheritdoc />
|
||||
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();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -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();
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents a Virtual Paradise user.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
|
||||
public sealed class User : IEquatable<User>
|
||||
{
|
||||
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<VirtualParadiseUser>
|
||||
public DateTimeOffset RegistrationTime { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseUser" /> instances are equal.
|
||||
/// Determines if two <see cref="User" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -63,13 +63,13 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool operator ==(VirtualParadiseUser? left, VirtualParadiseUser? right)
|
||||
public static bool operator ==(User? left, User? right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseUser" /> instances are not equal.
|
||||
/// Determines if two <see cref="User" /> instances are not equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -77,19 +77,19 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is not equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool operator !=(VirtualParadiseUser? left, VirtualParadiseUser? right)
|
||||
public static bool operator !=(User? left, User? right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseUser" /> instances are equal.
|
||||
/// Determines if two <see cref="User" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="other">The other instance.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true" /> if this instance is equal to <paramref name="other" />; otherwise, <see langword="false" />.
|
||||
/// </returns>
|
||||
public bool Equals(VirtualParadiseUser? other)
|
||||
public bool Equals(User? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
@ -107,7 +107,7 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
|
||||
/// <inheritdoc />
|
||||
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));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -214,7 +214,7 @@ public sealed class VirtualParadiseUser : IEquatable<VirtualParadiseUser>
|
||||
|
||||
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);
|
||||
|
@ -51,7 +51,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
|
||||
/// Gets the owner of this object.
|
||||
/// </summary>
|
||||
/// <value>The owner of this object.</value>
|
||||
public VirtualParadiseUser Owner { get; internal set; } = null!;
|
||||
public User Owner { get; internal set; } = null!;
|
||||
|
||||
internal byte[] Data { get; set; } = Array.Empty<byte>();
|
||||
|
||||
@ -90,7 +90,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
|
||||
/// The target avatar to receive the event. If this value is <see langword="null" />, the bump will be broadcast to
|
||||
/// all avatars in the world.
|
||||
/// </param>
|
||||
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<VirtualParadiseObject>
|
||||
/// The target avatar which will receive the event, or <see langword="null" /> to broadcast to every avatar.
|
||||
/// </param>
|
||||
/// <exception cref="InvalidOperationException"><paramref name="target" /> is the client's current avatar.</exception>
|
||||
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<VirtualParadiseObject>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the object by extracting the values provided by a specified <see cref="VirtualParadiseObjectBuilder" />.
|
||||
/// Updates the object by extracting the values provided by a specified <see cref="ObjectBuilder" />.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder whose values to extract.</param>
|
||||
protected internal virtual void ExtractFromBuilder(VirtualParadiseObjectBuilder builder)
|
||||
protected internal virtual void ExtractFromBuilder(ObjectBuilder builder)
|
||||
{
|
||||
if (builder is null)
|
||||
{
|
||||
|
@ -5,16 +5,16 @@ namespace VpSharp.Entities;
|
||||
/// <summary>
|
||||
/// Represents a world in the Virtual Paradise universe.
|
||||
/// </summary>
|
||||
public sealed class VirtualParadiseWorld : IEquatable<VirtualParadiseWorld>
|
||||
public sealed class World : IEquatable<World>
|
||||
{
|
||||
/// <summary>
|
||||
/// A world that represents no world in the universe.
|
||||
/// </summary>
|
||||
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<VirtualParadiseWorld>
|
||||
internal bool IsNowhere { get; private init; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseWorld" /> instances are equal.
|
||||
/// Determines if two <see cref="World" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -61,13 +61,13 @@ public sealed class VirtualParadiseWorld : IEquatable<VirtualParadiseWorld>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool operator ==(VirtualParadiseWorld? left, VirtualParadiseWorld? right)
|
||||
public static bool operator ==(World? left, World? right)
|
||||
{
|
||||
return Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseWorld" /> instances are not equal.
|
||||
/// Determines if two <see cref="World" /> instances are not equal.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
@ -75,19 +75,19 @@ public sealed class VirtualParadiseWorld : IEquatable<VirtualParadiseWorld>
|
||||
/// <see langword="true" /> if <paramref name="left" /> is not equal to <paramref name="right" />; otherwise,
|
||||
/// <see langword="false" />.
|
||||
/// </returns>
|
||||
public static bool operator !=(VirtualParadiseWorld? left, VirtualParadiseWorld? right)
|
||||
public static bool operator !=(World? left, World? right)
|
||||
{
|
||||
return !Equals(left, right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="VirtualParadiseWorld" /> instances are equal.
|
||||
/// Determines if two <see cref="World" /> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="other">The other instance.</param>
|
||||
/// <returns>
|
||||
/// <see langword="true" /> if this instance is equal to <paramref name="other" />; otherwise, <see langword="false" />.
|
||||
/// </returns>
|
||||
public bool Equals(VirtualParadiseWorld? other)
|
||||
public bool Equals(World? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
{
|
||||
@ -105,7 +105,7 @@ public sealed class VirtualParadiseWorld : IEquatable<VirtualParadiseWorld>
|
||||
/// <inheritdoc />
|
||||
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));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
@ -13,7 +13,7 @@ public sealed class AvatarClickedEventArgs : EventArgs
|
||||
/// <param name="avatar">The avatar responsible for the click.</param>
|
||||
/// <param name="clickedAvatar">The clicked avatar.</param>
|
||||
/// <param name="clickPoint">The click point.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar responsible for the click.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the clicked avatar.
|
||||
/// </summary>
|
||||
/// <value>The clicked avatar.</value>
|
||||
public VirtualParadiseAvatar ClickedAvatar { get; }
|
||||
public Avatar ClickedAvatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the point at which the avatar clicked the object.
|
||||
|
@ -13,7 +13,7 @@ public sealed class AvatarMovedEventArgs : EventArgs
|
||||
/// <param name="avatar">The avatar whose type was changed.</param>
|
||||
/// <param name="locationAfter">The avatar's new location.</param>
|
||||
/// <param name="locationBefore">The avatar's old location.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar whose location was changed.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the avatar's location after the change.
|
||||
|
@ -13,7 +13,7 @@ public sealed class AvatarTypeChangedEventArgs : EventArgs
|
||||
/// <param name="avatar">The avatar whose type was changed.</param>
|
||||
/// <param name="typeAfter">The avatar's new type.</param>
|
||||
/// <param name="typeBefore">The avatar's old type.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar whose type was changed.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the avatar's type after the change.
|
||||
|
@ -13,7 +13,7 @@ public sealed class ObjectBumpEventArgs : EventArgs
|
||||
/// <param name="avatar">The avatar.</param>
|
||||
/// <param name="bumpedObject">The bumped object.</param>
|
||||
/// <param name="phase">The bump phase.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar responsible for the bump.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object to which this event pertains.
|
||||
|
@ -14,7 +14,7 @@ public sealed class ObjectChangedEventArgs : EventArgs
|
||||
/// <param name="objectBefore">The state of the object prior to the change.</param>
|
||||
/// <param name="objectAfter">The object which was changed, containing updated values.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar which changed the object.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object which was changed.
|
||||
|
@ -14,7 +14,7 @@ public sealed class ObjectClickedEventArgs : EventArgs
|
||||
/// <param name="clickedObject">The clicked object.</param>
|
||||
/// <param name="clickPoint">The click point.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar responsible for the click.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the clicked object.
|
||||
|
@ -12,7 +12,7 @@ public sealed class ObjectCreatedEventArgs : EventArgs
|
||||
/// </summary>
|
||||
/// <param name="avatar">The avatar responsible for the object being created.</param>
|
||||
/// <param name="createdObject">The created object.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar responsible for the object being created.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object which was created.
|
||||
|
@ -13,7 +13,7 @@ public sealed class ObjectDeletedEventArgs : EventArgs
|
||||
/// <param name="avatar">The avatar responsible for the object being deleted.</param>
|
||||
/// <param name="objectId">The ID of the deleted object.</param>
|
||||
/// <param name="deletedObject">The deleted object.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar responsible for the object being deleted.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object which was deleted.
|
||||
|
@ -12,7 +12,7 @@ public sealed class TeleportedEventArgs : EventArgs
|
||||
/// </summary>
|
||||
/// <param name="avatar">The avatar which initiated the teleport.</param>
|
||||
/// <param name="location">The target location of the teleport.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar which initiated the teleport.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the target location of the teleport.
|
||||
|
@ -13,7 +13,7 @@ public sealed class UriReceivedEventArgs : EventArgs
|
||||
/// <param name="uri">The received URI.</param>
|
||||
/// <param name="target">The URI target.</param>
|
||||
/// <param name="avatar">The avatar who sent the URI.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The avatar who sent the URI.</value>
|
||||
public VirtualParadiseAvatar Avatar { get; }
|
||||
public Avatar Avatar { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the URI target.
|
||||
|
@ -16,7 +16,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
|
||||
VirtualParadiseClient client,
|
||||
int requestId,
|
||||
string name,
|
||||
VirtualParadiseUser user,
|
||||
User user,
|
||||
Location location)
|
||||
{
|
||||
Name = name;
|
||||
@ -42,7 +42,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
|
||||
/// Gets the user which sent the request.
|
||||
/// </summary>
|
||||
/// <value>The user which sent the request.</value>
|
||||
public VirtualParadiseUser User { get; }
|
||||
public User User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether two <see cref="InviteRequest" /> instances are equal.
|
||||
|
@ -12,7 +12,7 @@ public sealed class JoinRequest : IEquatable<JoinRequest>
|
||||
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<JoinRequest>
|
||||
/// Gets the user which sent the request.
|
||||
/// </summary>
|
||||
/// <value>The user which sent the request.</value>
|
||||
public VirtualParadiseUser User { get; }
|
||||
public User User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether two <see cref="JoinRequest" /> instances are equal.
|
||||
|
@ -10,7 +10,7 @@ public readonly struct Location : IEquatable<Location>
|
||||
/// <summary>
|
||||
/// A location that represents nowhere in the universe.
|
||||
/// </summary>
|
||||
public static readonly Location Nowhere = new(VirtualParadiseWorld.Nowhere);
|
||||
public static readonly Location Nowhere = new(Entities.World.Nowhere);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Location" /> struct.
|
||||
@ -22,7 +22,7 @@ public readonly struct Location : IEquatable<Location>
|
||||
/// <paramref name="world" /> parameter.
|
||||
/// </param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="world" /> is <see langword="null" />.</exception>
|
||||
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<Location>
|
||||
/// <param name="position">The position.</param>
|
||||
/// <param name="rotation">The rotation.</param>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="world" /> is <see langword="null" />.</exception>
|
||||
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<Location>
|
||||
/// Gets the world represented by this location.
|
||||
/// </summary>
|
||||
/// <value>The world.</value>
|
||||
public VirtualParadiseWorld World { get; init; }
|
||||
public World World { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if two <see cref="Location" /> instances are equal.
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace VpSharp;
|
||||
|
||||
/// <summary>
|
||||
/// An enumeration of easings for use with <see cref="VirtualParadisePath" />.
|
||||
/// An enumeration of easings for use with <see cref="Entities.Path" />.
|
||||
/// </summary>
|
||||
public enum PathEasing
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using VpSharp.Entities;
|
||||
namespace VpSharp;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a point along a <see cref="VirtualParadisePath" />.
|
||||
/// Represents a point along a <see cref="Entities.Path" />.
|
||||
/// </summary>
|
||||
#pragma warning disable CA1815
|
||||
public readonly struct PathPoint
|
||||
|
@ -6,7 +6,7 @@ namespace VpSharp;
|
||||
/// An enumeration of URI targets.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When used with <see cref="VirtualParadiseAvatar.SendUriAsync" />, <see cref="Overlay" /> indicates that that the URI
|
||||
/// When used with <see cref="Avatar.SendUriAsync" />, <see cref="Overlay" /> indicates that that the URI
|
||||
/// will be displayed as a 2D overlay over the 3D world view. This currently uses CEF (Chromium Embedded Framework).
|
||||
/// </remarks>
|
||||
public enum UriTarget
|
||||
|
@ -10,7 +10,7 @@ namespace VpSharp;
|
||||
|
||||
public sealed partial class VirtualParadiseClient
|
||||
{
|
||||
private readonly ConcurrentDictionary<int, VirtualParadiseAvatar> _avatars = new();
|
||||
private readonly ConcurrentDictionary<int, Avatar> _avatars = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the avatar with the specified session.
|
||||
@ -20,18 +20,18 @@ public sealed partial class VirtualParadiseClient
|
||||
/// The avatar whose session is equal to <paramref name="session" />, or <see langword="null" /> if no match was
|
||||
/// found.
|
||||
/// </returns>
|
||||
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),
|
||||
|
@ -7,13 +7,13 @@ namespace VpSharp;
|
||||
public sealed partial class VirtualParadiseClient
|
||||
{
|
||||
private readonly Subject<AvatarClickedEventArgs> _avatarClicked = new();
|
||||
private readonly Subject<VirtualParadiseAvatar> _avatarJoined = new();
|
||||
private readonly Subject<VirtualParadiseAvatar> _avatarLeft = new();
|
||||
private readonly Subject<Avatar> _avatarJoined = new();
|
||||
private readonly Subject<Avatar> _avatarLeft = new();
|
||||
private readonly Subject<AvatarMovedEventArgs> _avatarMoved = new();
|
||||
private readonly Subject<AvatarTypeChangedEventArgs> _avatarTypeChanged = new();
|
||||
private readonly Subject<InviteRequest> _inviteRequestReceived = new();
|
||||
private readonly Subject<JoinRequest> _joinRequestReceived = new();
|
||||
private readonly Subject<VirtualParadiseMessage> _messageReceived = new();
|
||||
private readonly Subject<Message> _messageReceived = new();
|
||||
private readonly Subject<ObjectBumpEventArgs> _objectBump = new();
|
||||
private readonly Subject<ObjectChangedEventArgs> _objectChanged = new();
|
||||
private readonly Subject<ObjectClickedEventArgs> _objectClicked = new();
|
||||
@ -35,7 +35,7 @@ public sealed partial class VirtualParadiseClient
|
||||
/// <summary>
|
||||
/// Occurs when an avatar has entered the vicinity of the client.
|
||||
/// </summary>
|
||||
public IObservable<VirtualParadiseAvatar> AvatarJoined
|
||||
public IObservable<Avatar> AvatarJoined
|
||||
{
|
||||
get => _avatarJoined;
|
||||
}
|
||||
@ -43,7 +43,7 @@ public sealed partial class VirtualParadiseClient
|
||||
/// <summary>
|
||||
/// Occurs when an avatar has left the vicinity of the client.
|
||||
/// </summary>
|
||||
public IObservable<VirtualParadiseAvatar> AvatarLeft
|
||||
public IObservable<Avatar> AvatarLeft
|
||||
{
|
||||
get => _avatarLeft;
|
||||
}
|
||||
@ -83,7 +83,7 @@ public sealed partial class VirtualParadiseClient
|
||||
/// <summary>
|
||||
/// Occurs when a chat message or console message has been received.
|
||||
/// </summary>
|
||||
public IObservable<VirtualParadiseMessage> MessageReceived
|
||||
public IObservable<Message> MessageReceived
|
||||
{
|
||||
get => _messageReceived;
|
||||
}
|
||||
|
@ -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<VirtualParadiseUser>? taskCompletionSource))
|
||||
if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource<User>? 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);
|
||||
|
@ -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)
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,8 @@ namespace VpSharp;
|
||||
|
||||
public sealed partial class VirtualParadiseClient
|
||||
{
|
||||
private readonly ConcurrentDictionary<int, VirtualParadiseUser> _users = new();
|
||||
private readonly ConcurrentDictionary<int, TaskCompletionSource<VirtualParadiseUser>> _usersCompletionSources = new();
|
||||
private readonly ConcurrentDictionary<int, User> _users = new();
|
||||
private readonly ConcurrentDictionary<int, TaskCompletionSource<User>> _usersCompletionSources = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a user by their ID.
|
||||
@ -16,19 +16,19 @@ public sealed partial class VirtualParadiseClient
|
||||
/// <returns>
|
||||
/// The user whose ID is equal to <paramref name="userId" />, or <see langword="null" /> if no match was found.
|
||||
/// </returns>
|
||||
public async Task<VirtualParadiseUser> GetUserAsync(int userId)
|
||||
public async Task<User> 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<VirtualParadiseUser>? taskCompletionSource))
|
||||
if (_usersCompletionSources.TryGetValue(userId, out TaskCompletionSource<User>? taskCompletionSource))
|
||||
{
|
||||
return await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
taskCompletionSource = new TaskCompletionSource<VirtualParadiseUser>();
|
||||
taskCompletionSource = new TaskCompletionSource<User>();
|
||||
_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<VirtualParadiseUser> _);
|
||||
_usersCompletionSources.TryRemove(userId, out TaskCompletionSource<User> _);
|
||||
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;
|
||||
|
@ -8,22 +8,22 @@ namespace VpSharp;
|
||||
public sealed partial class VirtualParadiseClient
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, string> _worldSettings = new();
|
||||
private readonly ConcurrentDictionary<string, VirtualParadiseWorld> _worlds = new();
|
||||
private Channel<VirtualParadiseWorld>? _worldListChannel = Channel.CreateUnbounded<VirtualParadiseWorld>();
|
||||
private readonly ConcurrentDictionary<string, World> _worlds = new();
|
||||
private Channel<World>? _worldListChannel = Channel.CreateUnbounded<World>();
|
||||
private TaskCompletionSource _worldSettingsCompletionSource = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an enumerable of the worlds returned by the universe server.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="IAsyncEnumerable{T}" /> containing <see cref="VirtualParadiseWorld" /> values.</returns>
|
||||
/// <returns>An <see cref="IAsyncEnumerable{T}" /> containing <see cref="World" /> values.</returns>
|
||||
/// <remarks>
|
||||
/// This method will yield results back as they are received from the world server. To access a consumed collection,
|
||||
/// use <see cref="GetWorldsAsync" />.
|
||||
/// </remarks>
|
||||
/// <seealso cref="GetWorldsAsync" />
|
||||
public IAsyncEnumerable<VirtualParadiseWorld> EnumerateWorldsAsync()
|
||||
public IAsyncEnumerable<World> EnumerateWorldsAsync()
|
||||
{
|
||||
_worldListChannel = Channel.CreateUnbounded<VirtualParadiseWorld>();
|
||||
_worldListChannel = Channel.CreateUnbounded<World>();
|
||||
lock (Lock)
|
||||
{
|
||||
_ = vp_world_list(NativeInstanceHandle, 0);
|
||||
@ -37,20 +37,20 @@ public sealed partial class VirtualParadiseClient
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the world.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="VirtualParadiseWorld" /> whose name is equal to <paramref name="name" />, or <see langword="null" />
|
||||
/// A <see cref="World" /> whose name is equal to <paramref name="name" />, or <see langword="null" />
|
||||
/// if no match was found.
|
||||
/// </returns>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// <paramref name="name" /> is <see langword="null" />, empty, or consists of only whitespace.
|
||||
/// </exception>
|
||||
public async Task<VirtualParadiseWorld?> GetWorldAsync(string name)
|
||||
public async Task<World?> 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
|
||||
/// <summary>
|
||||
/// Gets a read-only view of the worlds returned by the universe server.
|
||||
/// </summary>
|
||||
/// <returns>An <see cref="IReadOnlyCollection{T}" /> containing <see cref="VirtualParadiseWorld" /> values.</returns>
|
||||
/// <returns>An <see cref="IReadOnlyCollection{T}" /> containing <see cref="World" /> values.</returns>
|
||||
/// <remarks>
|
||||
/// 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 <see cref="IAsyncEnumerable{T}" /> alternative, use
|
||||
/// <see cref="EnumerateWorldsAsync" />.
|
||||
/// </remarks>
|
||||
/// <seealso cref="EnumerateWorldsAsync" />
|
||||
public async Task<IReadOnlyCollection<VirtualParadiseWorld>> GetWorldsAsync()
|
||||
public async Task<IReadOnlyCollection<World>> GetWorldsAsync()
|
||||
{
|
||||
var worlds = new List<VirtualParadiseWorld>();
|
||||
var worlds = new List<World>();
|
||||
|
||||
await foreach (VirtualParadiseWorld world in EnumerateWorldsAsync())
|
||||
await foreach (World world in EnumerateWorldsAsync())
|
||||
{
|
||||
worlds.Add(world);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
|
||||
private readonly VirtualParadiseConfiguration _configuration;
|
||||
|
||||
private readonly ConcurrentDictionary<int, VirtualParadiseUser> _friends = new();
|
||||
private readonly ConcurrentDictionary<int, User> _friends = new();
|
||||
private readonly Dictionary<int, TaskCompletionSource<ReasonCode>> _inviteCompletionSources = new();
|
||||
private readonly Dictionary<int, TaskCompletionSource<ReasonCode>> _joinCompletionSources = new();
|
||||
|
||||
@ -66,7 +66,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
/// Gets a read-only view of the cached avatars.
|
||||
/// </summary>
|
||||
/// <value>The cached avatars.</value>
|
||||
public IReadOnlyList<VirtualParadiseAvatar> Avatars
|
||||
public IReadOnlyList<Avatar> Avatars
|
||||
{
|
||||
get => _avatars.Values.ToArray();
|
||||
}
|
||||
@ -75,17 +75,17 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
/// Gets the current avatar associated with this client.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// An instance of <see cref="VirtualParadiseAvatar" />, or <see langword="null" /> if this client is not in a world.
|
||||
/// An instance of <see cref="Avatar" />, or <see langword="null" /> if this client is not in a world.
|
||||
/// </value>
|
||||
public VirtualParadiseAvatar? CurrentAvatar { get; internal set; }
|
||||
public Avatar? CurrentAvatar { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current user to which this client is logged in.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// An instance of <see cref="VirtualParadiseUser" />, or <see langword="null" /> if this client is not logged in.
|
||||
/// An instance of <see cref="User" />, or <see langword="null" /> if this client is not logged in.
|
||||
/// </value>
|
||||
public VirtualParadiseUser? CurrentUser { get; internal set; }
|
||||
public User? CurrentUser { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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 <see langword="null" /> if this client is not currently
|
||||
/// in a world.
|
||||
/// </value>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <value>The cached worlds.</value>
|
||||
public IReadOnlyList<VirtualParadiseWorld> Worlds
|
||||
public IReadOnlyList<World> Worlds
|
||||
{
|
||||
get => _worlds.Values.ToArray();
|
||||
}
|
||||
@ -225,7 +225,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
public async Task<VirtualParadiseWorld> EnterAsync(string worldName, Vector3d position)
|
||||
public async Task<World> 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
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
public async Task<VirtualParadiseWorld> EnterAsync(string worldName, Vector3d position, Rotation rotation)
|
||||
public async Task<World> 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
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
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
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
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
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
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.
|
||||
/// </summary>
|
||||
/// <param name="worldName">The world to enter.</param>
|
||||
/// <returns>A <see cref="VirtualParadiseWorld" /> representing the world.</returns>
|
||||
/// <returns>A <see cref="World" /> representing the world.</returns>
|
||||
/// <exception cref="ArgumentNullException"><paramref name="worldName" /> is <see langword="null" />.</exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// A world enter was attempted before the client was connected to a universe.
|
||||
@ -323,7 +323,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
/// <exception cref="Exception">Connection to the universe server was lost, or connecting to the world failed.</exception>
|
||||
/// <exception cref="WorldNotFoundException">The specified world was not found.</exception>
|
||||
/// <exception cref="TimeoutException">Connection to the world server timed out.</exception>
|
||||
public async Task<VirtualParadiseWorld> EnterAsync(string worldName)
|
||||
public async Task<World> 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-
|
||||
/// <para><paramref name="message" /> is too long to send.</para>
|
||||
/// </exception>
|
||||
public Task<VirtualParadiseMessage> SendMessageAsync(string message)
|
||||
public Task<Message> 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-
|
||||
/// <para><paramref name="message" /> is too long to send.</para>
|
||||
/// </exception>
|
||||
public Task<VirtualParadiseMessage> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
||||
public Task<Message> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
||||
{
|
||||
return SendMessageAsync(null, message, fontStyle, color);
|
||||
}
|
||||
@ -641,7 +642,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
||||
/// -or-
|
||||
/// <para><paramref name="message" /> is too long to send.</para>
|
||||
/// </exception>
|
||||
public Task<VirtualParadiseMessage> SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color)
|
||||
public Task<Message> 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<int, TaskCompletionSource<VirtualParadiseUser>> pair in _usersCompletionSources)
|
||||
foreach (KeyValuePair<int, TaskCompletionSource<User>> pair in _usersCompletionSources)
|
||||
{
|
||||
pair.Value.TrySetCanceled();
|
||||
}
|
||||
|
BIN
banner.png
BIN
banner.png
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
BIN
branding_Banner.png
Normal file
BIN
branding_Banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
branding_Icon.png
Normal file
BIN
branding_Icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Loading…
Reference in New Issue
Block a user