mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-14 04:05:41 +00:00
Compare commits
No commits in common. "ff298a8af509e22274a16da0b2fba7efc40e0005" and "05b53da5a4b32638daa77adde08f6405c7555baa" have entirely different histories.
ff298a8af5
...
05b53da5a4
@ -54,7 +54,7 @@ public sealed class RequireUserNameAttribute : PreExecutionCheckAttribute
|
|||||||
throw new ArgumentNullException(nameof(context));
|
throw new ArgumentNullException(nameof(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
IUser user = await context.Avatar.GetUserAsync().ConfigureAwait(false);
|
User user = await context.Avatar.GetUserAsync().ConfigureAwait(false);
|
||||||
return Names.Contains(user.Name);
|
return Names.Contains(user.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace VpSharp.Commands;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class CommandContext
|
public sealed class CommandContext
|
||||||
{
|
{
|
||||||
internal CommandContext(VirtualParadiseClient client, IAvatar avatar, string commandName, string alias,
|
internal CommandContext(VirtualParadiseClient client, Avatar avatar, string commandName, string alias,
|
||||||
string rawArguments)
|
string rawArguments)
|
||||||
{
|
{
|
||||||
Client = client;
|
Client = client;
|
||||||
@ -36,7 +36,7 @@ public sealed class CommandContext
|
|||||||
/// Gets the avatar who executed the command.
|
/// Gets the avatar who executed the command.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The executing avatar.</value>
|
/// <value>The executing avatar.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the client which raised the event.
|
/// Gets the client which raised the event.
|
||||||
@ -65,11 +65,10 @@ public sealed class CommandContext
|
|||||||
/// regular chat message.
|
/// regular chat message.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>The message which was sent.</returns>
|
/// <returns>The message which was sent.</returns>
|
||||||
public async Task<IMessage> RespondAsync(string message, bool ephemeral = false)
|
public Task<Message> RespondAsync(string message, bool ephemeral = false)
|
||||||
{
|
{
|
||||||
return ephemeral
|
return ephemeral
|
||||||
? await Avatar.SendMessageAsync(Client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black)
|
? Avatar.SendMessageAsync(Client.CurrentAvatar?.Name, message, FontStyle.Regular, Color.Black)
|
||||||
.ConfigureAwait(false)
|
: Client.SendMessageAsync(message);
|
||||||
: await Client.SendMessageAsync(message).ConfigureAwait(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,14 +176,14 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected internal override Task OnMessageReceived(IMessage message)
|
protected internal override Task OnMessageReceived(Message message)
|
||||||
{
|
{
|
||||||
if (message is null)
|
if (message is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(message));
|
throw new ArgumentNullException(nameof(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message is IUserMessage)
|
if (message.Type != MessageType.ChatMessage)
|
||||||
{
|
{
|
||||||
return base.OnMessageReceived(message);
|
return base.OnMessageReceived(message);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ Console.WriteLine(@"Entering world");
|
|||||||
World world = await client.EnterAsync("Mutation");
|
World world = await client.EnterAsync("Mutation");
|
||||||
Console.WriteLine(@"Entered world!");
|
Console.WriteLine(@"Entered world!");
|
||||||
|
|
||||||
IAvatar avatar = client.CurrentAvatar!;
|
Avatar avatar = client.CurrentAvatar!;
|
||||||
|
|
||||||
Console.WriteLine($@"My name is {avatar.Name} and I am at {avatar.Location}");
|
Console.WriteLine($@"My name is {avatar.Name} and I am at {avatar.Location}");
|
||||||
Console.WriteLine($@"Entered {world.Name} with size {world.Size}");
|
Console.WriteLine($@"Entered {world.Name} with size {world.Size}");
|
||||||
|
@ -26,8 +26,8 @@ public abstract class VirtualParadiseClientExtension
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a chat message is received.
|
/// Called when a chat message is received.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">The message which was received.</param>
|
/// <param name="args">An object containing event data.</param>
|
||||||
protected internal virtual Task OnMessageReceived(IMessage message)
|
protected internal virtual Task OnMessageReceived(Message message)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@ namespace VpSharp.Entities;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an avatar within a world.
|
/// Represents an avatar within a world.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
public sealed class Avatar : IEquatable<Avatar>
|
||||||
{
|
{
|
||||||
private readonly VirtualParadiseClient _client;
|
private readonly VirtualParadiseClient _client;
|
||||||
private IUser? _user;
|
private User? _user;
|
||||||
|
|
||||||
internal Avatar(VirtualParadiseClient client, int session)
|
internal Avatar(VirtualParadiseClient client, int session)
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
|||||||
/// Gets the user associated with this avatar.
|
/// Gets the user associated with this avatar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The user.</returns>
|
/// <returns>The user.</returns>
|
||||||
public async Task<IUser> GetUserAsync()
|
public async Task<User> GetUserAsync()
|
||||||
{
|
{
|
||||||
_user ??= await _client.GetUserAsync(UserId).ConfigureAwait(false);
|
_user ??= await _client.GetUserAsync(UserId).ConfigureAwait(false);
|
||||||
return _user;
|
return _user;
|
||||||
@ -196,7 +196,7 @@ public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
/// <para><paramref name="message" /> is too long to send.</para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public Task<IConsoleMessage> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
public Task<Message> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
||||||
{
|
{
|
||||||
return SendMessageAsync(null, message, fontStyle, color);
|
return SendMessageAsync(null, message, fontStyle, color);
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
|||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
/// <para><paramref name="message" /> is too long to send.</para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
/// <remarks>Passing <see langword="null" /> to <paramref name="name" /> will hide the name from the recipient.</remarks>
|
/// <remarks>Passing <see langword="null" /> to <paramref name="name" /> will hide the name from the recipient.</remarks>
|
||||||
public Task<IConsoleMessage> 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)
|
if (message is null)
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
|||||||
throw new ArgumentException(ExceptionMessages.ValueCannotBeEmpty, nameof(message));
|
throw new ArgumentException(ExceptionMessages.ValueCannotBeEmpty, nameof(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar;
|
Avatar avatar;
|
||||||
|
|
||||||
lock (_client.Lock)
|
lock (_client.Lock)
|
||||||
{
|
{
|
||||||
@ -267,12 +267,13 @@ public sealed class Avatar : IEquatable<Avatar>, IAvatar
|
|||||||
avatar = _client.CurrentAvatar!;
|
avatar = _client.CurrentAvatar!;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult((IConsoleMessage)new ConsoleMessage(
|
return Task.FromResult(new Message(
|
||||||
avatar,
|
MessageType.ConsoleMessage,
|
||||||
avatar.Name,
|
name,
|
||||||
message,
|
message,
|
||||||
color,
|
avatar,
|
||||||
fontStyle
|
fontStyle,
|
||||||
|
color
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a chat message that was sent by a user.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class ConsoleMessage : Message, IConsoleMessage
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="UserMessage" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="author">The author of the message.</param>
|
|
||||||
/// <param name="name">The apparent sender's name of the message.</param>
|
|
||||||
/// <param name="content">The content of the message.</param>
|
|
||||||
/// <param name="color">A <see cref="System.Drawing.Color" /> value representing the color of the message.</param>
|
|
||||||
/// <param name="fontStyle">A <see cref="FontStyle" /> value representing the font style of the message.</param>
|
|
||||||
public ConsoleMessage(IAvatar author, string name, string content, Color color, FontStyle fontStyle)
|
|
||||||
: base(author, name, content)
|
|
||||||
{
|
|
||||||
Color = color;
|
|
||||||
Style = fontStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public Color Color { get; }
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public FontStyle Style { get; }
|
|
||||||
}
|
|
@ -1,184 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
public interface IAvatar
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the details of the application this avatar is using.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The avatar's application details.</value>
|
|
||||||
Application Application { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether this avatar is a bot.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><see langword="true" /> if this avatar is a bot; otherwise, <see langword="false" />.</value>
|
|
||||||
bool IsBot { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the location of this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The location of this avatar.</value>
|
|
||||||
Location Location { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the name of this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The name of this avatar.</value>
|
|
||||||
string Name { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the session ID of this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The session ID.</value>
|
|
||||||
int Session { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the type of this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The type of this avatar.</value>
|
|
||||||
int Type { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user ID associated with this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The user ID.</value>
|
|
||||||
int UserId { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clicks this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="clickPoint">The position at which the avatar should be clicked.</param>
|
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// <para>The action cannot be performed on the client's current avatar.</para>
|
|
||||||
/// -or-
|
|
||||||
/// <para>An attempt was made to click an avatar outside of a world.</para>
|
|
||||||
/// </exception>
|
|
||||||
Task ClickAsync(Vector3d? clickPoint = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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>
|
|
||||||
bool Equals(Avatar? other);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the user associated with this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The user.</returns>
|
|
||||||
Task<IUser> GetUserAsync();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a console message to the avatar with no name.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">The message to send.</param>
|
|
||||||
/// <param name="fontStyle">The font style of the message.</param>
|
|
||||||
/// <param name="color">The text color of the message.</param>
|
|
||||||
/// <returns>The message which was sent.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="message" /> is <see langword="null" />.</exception>
|
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// <para>An attempt was made to send a message while not connected to a world.</para>
|
|
||||||
/// -or-
|
|
||||||
/// <para>An attempt was made to send a message to an avatar that is not in the world.</para>
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <para><paramref name="message" /> is empty, or consists of only whitespace.</para>
|
|
||||||
/// -or-
|
|
||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
|
||||||
/// </exception>
|
|
||||||
Task<IConsoleMessage> SendMessageAsync(string message, FontStyle fontStyle, Color color);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a console message to the avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">The apparent author of the message.</param>
|
|
||||||
/// <param name="message">The message to send.</param>
|
|
||||||
/// <param name="fontStyle">The font style of the message.</param>
|
|
||||||
/// <param name="color">The text color of the message.</param>
|
|
||||||
/// <returns>The message which was sent.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="message" /> is <see langword="null" />.</exception>
|
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// <para>An attempt was made to send a message while not connected to a world.</para>
|
|
||||||
/// -or-
|
|
||||||
/// <para>An attempt was made to send a message to an avatar that is not in the world.</para>
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <para><paramref name="message" /> is empty, or consists of only whitespace.</para>
|
|
||||||
/// -or-
|
|
||||||
/// <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>
|
|
||||||
Task<IConsoleMessage> SendMessageAsync(string? name, string message, FontStyle fontStyle, Color color);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a URI to this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uri">The URI to send.</param>
|
|
||||||
/// <param name="target">The URL target. See <see cref="UriTarget" /> for more information.</param>
|
|
||||||
/// <exception cref="InvalidOperationException">The action cannot be performed on the client's current avatar.</exception>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="uri" /> is <see langword="null" />.</exception>
|
|
||||||
Task SendUriAsync(Uri uri, UriTarget target = UriTarget.Browser);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Modifies the world settings for this avatar.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="action">The builder which defines parameters to change.</param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="action" /> is <see langword="null" />.</exception>
|
|
||||||
/// <exception cref="UnauthorizedAccessException">The client does not have permission to modify world settings.</exception>
|
|
||||||
Task SendWorldSettings(Action<WorldSettingsBuilder> action);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to another world.
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
Task TeleportAsync(World world, Vector3d position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to another world.
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
/// <param name="rotation">The rotation to which this avatar should be teleported.</param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="world" /> is <see langword="null" />.</exception>
|
|
||||||
Task TeleportAsync(World world, Vector3d position, Rotation rotation);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to another world.
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
Task TeleportAsync(string world, Vector3d position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to another world.
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
/// <param name="rotation">The rotation to which this avatar should be teleported.</param>
|
|
||||||
Task TeleportAsync(string world, Vector3d position, Rotation rotation);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to a new position within the current world.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position">The position to which this avatar should be teleported.</param>
|
|
||||||
Task TeleportAsync(Vector3d position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports the avatar to a new position and rotation within the current world.
|
|
||||||
/// </summary>
|
|
||||||
/// <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>
|
|
||||||
Task TeleportAsync(Vector3d position, Rotation rotation);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Teleports this avatar to a new location, which may or may not be a new world.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="location">The location to which this avatar should be teleported.</param>
|
|
||||||
Task TeleportAsync(Location location);
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a console message.
|
|
||||||
/// </summary>
|
|
||||||
public interface IConsoleMessage : IMessage
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the color of the message.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>A <see cref="System.Drawing.Color" /> value representing the color.</value>
|
|
||||||
Color Color { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the font style of the message.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>A <see cref="FontStyle" /> value representing the font style.</value>
|
|
||||||
FontStyle Style { get; }
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a message.
|
|
||||||
/// </summary>
|
|
||||||
public interface IMessage
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the author of the message.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The avatar which authored the message.</value>
|
|
||||||
IAvatar Author { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the content of the message.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The content.</value>
|
|
||||||
string Content { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the apparent sender's name of the message.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The sender's name.</value>
|
|
||||||
string Name { get; }
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
using VpSharp.Exceptions;
|
|
||||||
|
|
||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
public interface IUser
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the email address of this user.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The email address of this user.</value>
|
|
||||||
string EmailAddress { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the ID of this user.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The user's ID.</value>
|
|
||||||
int Id { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the date and time at which this user was last online.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>A <see cref="DateTimeOffset" /> representing the date and time this user was last online.</value>
|
|
||||||
DateTimeOffset LastLogin { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the name of this user.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The user's name.</value>
|
|
||||||
string Name { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the duration for which this user has been online.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>A <see cref="TimeSpan" /> representing the duration for which this user has been online.</value>
|
|
||||||
TimeSpan OnlineTime { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the date and time at which this user was registered.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>A <see cref="DateTimeOffset" /> representing the date and time this user was registered.</value>
|
|
||||||
DateTimeOffset RegistrationTime { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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>
|
|
||||||
bool Equals(User? other);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invites this user to a specified location.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="location">
|
|
||||||
/// The invitation location. If <see langword="null" />, the client's current location is used.
|
|
||||||
/// </param>
|
|
||||||
Task<InviteResponse> InviteAsync(Location? location = null);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sends a to join request to the user.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="suppressTeleport">
|
|
||||||
/// If <see langword="true" />, the client's avatar will not teleport to the requested location automatically.
|
|
||||||
/// Be careful, there is no way to retrieve
|
|
||||||
/// </param>
|
|
||||||
/// <returns>The result of the request.</returns>
|
|
||||||
/// <exception cref="UserNotFoundException">This user is invalid and cannot be joined.</exception>
|
|
||||||
/// <exception cref="InvalidOperationException">An unexpected error occurred trying to join the user.</exception>
|
|
||||||
Task<JoinResult> JoinAsync(bool suppressTeleport = false);
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a chat message that was sent by a user.
|
|
||||||
/// </summary>
|
|
||||||
public interface IUserMessage : IMessage;
|
|
@ -1,29 +1,67 @@
|
|||||||
namespace VpSharp.Entities;
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace VpSharp.Entities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a message.
|
/// Represents a message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class Message : IMessage
|
public sealed class Message
|
||||||
{
|
{
|
||||||
/// <summary>
|
internal Message(
|
||||||
/// Initializes a new instance of the <see cref="Message" /> class.
|
MessageType type,
|
||||||
/// </summary>
|
string? name,
|
||||||
/// <param name="author">The author of the message.</param>
|
string content,
|
||||||
/// <param name="name">The apparent sender's name of the message.</param>
|
Avatar author,
|
||||||
/// <param name="content">The content of the message.</param>
|
FontStyle style,
|
||||||
protected Message(IAvatar author, string name, string content)
|
Color color)
|
||||||
{
|
{
|
||||||
Author = author;
|
Type = type;
|
||||||
|
Name = string.IsNullOrWhiteSpace(name) ? null : name;
|
||||||
Content = content;
|
Content = content;
|
||||||
Name = name;
|
Author = author;
|
||||||
|
Style = style;
|
||||||
|
Color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
public IAvatar Author { get; }
|
/// Gets the message author.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The message author.</value>
|
||||||
|
public Avatar Author { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <summary>
|
||||||
|
/// Gets the message content.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The message content.</value>
|
||||||
public string Content { get; }
|
public string Content { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The message name. This will always be equal to the name of the <see cref="Author" /> for chat messages.</value>
|
||||||
|
public string? Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message color.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The message color. This will always be <see cref="System.Drawing.Color.Black" /> for chat messages.</value>
|
||||||
|
public Color Color { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the message font style.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The message font style. This will always be <see cref="FontStyle.Regular" /> for chat messages.</value>
|
||||||
|
public FontStyle Style { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the type of this message.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The type of this message.</value>
|
||||||
|
public MessageType Type { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; }
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Message {Author}; Type {Type}; Content {Content}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public abstract class ObjectBuilder
|
|||||||
/// This property may only be set during an object load, and will throw <see cref="InvalidOperationException" /> at
|
/// This property may only be set during an object load, and will throw <see cref="InvalidOperationException" /> at
|
||||||
/// any other point.
|
/// any other point.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Option<IUser> Owner { get; set; }
|
public Option<User> Owner { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the position of the object.
|
/// Gets or sets the position of the object.
|
||||||
@ -90,7 +90,7 @@ public abstract class ObjectBuilder
|
|||||||
throw new InvalidOperationException("Owner can only be assigned during an object load.");
|
throw new InvalidOperationException("Owner can only be assigned during an object load.");
|
||||||
}
|
}
|
||||||
|
|
||||||
IUser oldOwner = TargetObject.Owner;
|
User oldOwner = TargetObject.Owner;
|
||||||
_ = vp_int_set(handle, ObjectUserId, Owner.ValueOr(oldOwner).Id);
|
_ = vp_int_set(handle, ObjectUserId, Owner.ValueOr(oldOwner).Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace VpSharp.Entities;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a Virtual Paradise user.
|
/// Represents a Virtual Paradise user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class User : IEquatable<User>, IUser
|
public sealed class User : IEquatable<User>
|
||||||
{
|
{
|
||||||
private readonly VirtualParadiseClient _client;
|
private readonly VirtualParadiseClient _client;
|
||||||
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
namespace VpSharp.Entities;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a chat message that was sent by a user.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class UserMessage : Message, IUserMessage
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="UserMessage" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="author">The author of the message.</param>
|
|
||||||
/// <param name="content">The content of the message.</param>
|
|
||||||
public UserMessage(IAvatar author, string content)
|
|
||||||
: base(author, author.Name, content)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -51,7 +51,7 @@ public abstract class VirtualParadiseObject : IEquatable<VirtualParadiseObject>
|
|||||||
/// Gets the owner of this object.
|
/// Gets the owner of this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The owner of this object.</value>
|
/// <value>The owner of this object.</value>
|
||||||
public IUser Owner { get; internal set; } = null!;
|
public User Owner { get; internal set; } = null!;
|
||||||
|
|
||||||
internal byte[] Data { get; set; } = Array.Empty<byte>();
|
internal byte[] Data { get; set; } = Array.Empty<byte>();
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public sealed class AvatarClickedEventArgs : EventArgs
|
|||||||
/// <param name="avatar">The avatar responsible for the click.</param>
|
/// <param name="avatar">The avatar responsible for the click.</param>
|
||||||
/// <param name="clickedAvatar">The clicked avatar.</param>
|
/// <param name="clickedAvatar">The clicked avatar.</param>
|
||||||
/// <param name="clickPoint">The click point.</param>
|
/// <param name="clickPoint">The click point.</param>
|
||||||
public AvatarClickedEventArgs(IAvatar avatar, IAvatar clickedAvatar, Vector3d clickPoint)
|
public AvatarClickedEventArgs(Avatar avatar, Avatar clickedAvatar, Vector3d clickPoint)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
ClickedAvatar = clickedAvatar;
|
ClickedAvatar = clickedAvatar;
|
||||||
@ -24,13 +24,13 @@ public sealed class AvatarClickedEventArgs : EventArgs
|
|||||||
/// Gets the avatar responsible for the click.
|
/// Gets the avatar responsible for the click.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar responsible for the click.</value>
|
/// <value>The avatar responsible for the click.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the clicked avatar.
|
/// Gets the clicked avatar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The clicked avatar.</value>
|
/// <value>The clicked avatar.</value>
|
||||||
public IAvatar ClickedAvatar { get; }
|
public Avatar ClickedAvatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the point at which the avatar clicked the object.
|
/// 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="avatar">The avatar whose type was changed.</param>
|
||||||
/// <param name="locationAfter">The avatar's new location.</param>
|
/// <param name="locationAfter">The avatar's new location.</param>
|
||||||
/// <param name="locationBefore">The avatar's old location.</param>
|
/// <param name="locationBefore">The avatar's old location.</param>
|
||||||
public AvatarMovedEventArgs(IAvatar avatar, Location locationAfter, Location? locationBefore)
|
public AvatarMovedEventArgs(Avatar avatar, Location locationAfter, Location? locationBefore)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
LocationAfter = locationAfter;
|
LocationAfter = locationAfter;
|
||||||
@ -24,7 +24,7 @@ public sealed class AvatarMovedEventArgs : EventArgs
|
|||||||
/// Gets the avatar whose location was changed.
|
/// Gets the avatar whose location was changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar whose location was changed.</value>
|
/// <value>The avatar whose location was changed.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the avatar's location after the change.
|
/// 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="avatar">The avatar whose type was changed.</param>
|
||||||
/// <param name="typeAfter">The avatar's new type.</param>
|
/// <param name="typeAfter">The avatar's new type.</param>
|
||||||
/// <param name="typeBefore">The avatar's old type.</param>
|
/// <param name="typeBefore">The avatar's old type.</param>
|
||||||
public AvatarTypeChangedEventArgs(IAvatar avatar, int typeAfter, int? typeBefore)
|
public AvatarTypeChangedEventArgs(Avatar avatar, int typeAfter, int? typeBefore)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
TypeAfter = typeAfter;
|
TypeAfter = typeAfter;
|
||||||
@ -24,7 +24,7 @@ public sealed class AvatarTypeChangedEventArgs : EventArgs
|
|||||||
/// Gets the avatar whose type was changed.
|
/// Gets the avatar whose type was changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar whose type was changed.</value>
|
/// <value>The avatar whose type was changed.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the avatar's type after the change.
|
/// 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="avatar">The avatar.</param>
|
||||||
/// <param name="bumpedObject">The bumped object.</param>
|
/// <param name="bumpedObject">The bumped object.</param>
|
||||||
/// <param name="phase">The bump phase.</param>
|
/// <param name="phase">The bump phase.</param>
|
||||||
public ObjectBumpEventArgs(IAvatar avatar, VirtualParadiseObject bumpedObject, BumpPhase phase)
|
public ObjectBumpEventArgs(Avatar avatar, VirtualParadiseObject bumpedObject, BumpPhase phase)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
BumpedObject = bumpedObject;
|
BumpedObject = bumpedObject;
|
||||||
@ -24,7 +24,7 @@ public sealed class ObjectBumpEventArgs : EventArgs
|
|||||||
/// Gets the avatar responsible for the bump.
|
/// Gets the avatar responsible for the bump.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar responsible for the bump.</value>
|
/// <value>The avatar responsible for the bump.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object to which this event pertains.
|
/// 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="objectBefore">The state of the object prior to the change.</param>
|
||||||
/// <param name="objectAfter">The object which was changed, containing updated values.</param>
|
/// <param name="objectAfter">The object which was changed, containing updated values.</param>
|
||||||
public ObjectChangedEventArgs(
|
public ObjectChangedEventArgs(
|
||||||
IAvatar avatar,
|
Avatar avatar,
|
||||||
VirtualParadiseObject? objectBefore,
|
VirtualParadiseObject? objectBefore,
|
||||||
VirtualParadiseObject objectAfter)
|
VirtualParadiseObject objectAfter)
|
||||||
{
|
{
|
||||||
@ -27,7 +27,7 @@ public sealed class ObjectChangedEventArgs : EventArgs
|
|||||||
/// Gets the avatar which changed the object.
|
/// Gets the avatar which changed the object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar which changed the object.</value>
|
/// <value>The avatar which changed the object.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object which was changed.
|
/// Gets the object which was changed.
|
||||||
|
@ -14,7 +14,7 @@ public sealed class ObjectClickedEventArgs : EventArgs
|
|||||||
/// <param name="clickedObject">The clicked object.</param>
|
/// <param name="clickedObject">The clicked object.</param>
|
||||||
/// <param name="clickPoint">The click point.</param>
|
/// <param name="clickPoint">The click point.</param>
|
||||||
public ObjectClickedEventArgs(
|
public ObjectClickedEventArgs(
|
||||||
IAvatar avatar,
|
Avatar avatar,
|
||||||
VirtualParadiseObject clickedObject,
|
VirtualParadiseObject clickedObject,
|
||||||
Vector3d clickPoint)
|
Vector3d clickPoint)
|
||||||
{
|
{
|
||||||
@ -27,7 +27,7 @@ public sealed class ObjectClickedEventArgs : EventArgs
|
|||||||
/// Gets the avatar responsible for the click.
|
/// Gets the avatar responsible for the click.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar responsible for the click.</value>
|
/// <value>The avatar responsible for the click.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the clicked object.
|
/// Gets the clicked object.
|
||||||
|
@ -12,7 +12,7 @@ public sealed class ObjectCreatedEventArgs : EventArgs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="avatar">The avatar responsible for the object being created.</param>
|
/// <param name="avatar">The avatar responsible for the object being created.</param>
|
||||||
/// <param name="createdObject">The created object.</param>
|
/// <param name="createdObject">The created object.</param>
|
||||||
public ObjectCreatedEventArgs(IAvatar avatar, VirtualParadiseObject createdObject)
|
public ObjectCreatedEventArgs(Avatar avatar, VirtualParadiseObject createdObject)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
CreatedObject = createdObject;
|
CreatedObject = createdObject;
|
||||||
@ -22,7 +22,7 @@ public sealed class ObjectCreatedEventArgs : EventArgs
|
|||||||
/// Gets the avatar responsible for the object being created.
|
/// Gets the avatar responsible for the object being created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar responsible for the object being created.</value>
|
/// <value>The avatar responsible for the object being created.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object which was created.
|
/// 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="avatar">The avatar responsible for the object being deleted.</param>
|
||||||
/// <param name="objectId">The ID of the deleted object.</param>
|
/// <param name="objectId">The ID of the deleted object.</param>
|
||||||
/// <param name="deletedObject">The deleted object.</param>
|
/// <param name="deletedObject">The deleted object.</param>
|
||||||
public ObjectDeletedEventArgs(IAvatar avatar, int objectId, VirtualParadiseObject deletedObject)
|
public ObjectDeletedEventArgs(Avatar avatar, int objectId, VirtualParadiseObject deletedObject)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
ObjectId = objectId;
|
ObjectId = objectId;
|
||||||
@ -24,7 +24,7 @@ public sealed class ObjectDeletedEventArgs : EventArgs
|
|||||||
/// Gets the avatar responsible for the object being deleted.
|
/// Gets the avatar responsible for the object being deleted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar responsible for the object being deleted.</value>
|
/// <value>The avatar responsible for the object being deleted.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the object which was deleted.
|
/// Gets the object which was deleted.
|
||||||
|
@ -12,7 +12,7 @@ public sealed class TeleportedEventArgs : EventArgs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="avatar">The avatar which initiated the teleport.</param>
|
/// <param name="avatar">The avatar which initiated the teleport.</param>
|
||||||
/// <param name="location">The target location of the teleport.</param>
|
/// <param name="location">The target location of the teleport.</param>
|
||||||
public TeleportedEventArgs(IAvatar avatar, Location location)
|
public TeleportedEventArgs(Avatar avatar, Location location)
|
||||||
{
|
{
|
||||||
Avatar = avatar;
|
Avatar = avatar;
|
||||||
Location = location;
|
Location = location;
|
||||||
@ -22,7 +22,7 @@ public sealed class TeleportedEventArgs : EventArgs
|
|||||||
/// Gets the avatar which initiated the teleport.
|
/// Gets the avatar which initiated the teleport.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar which initiated the teleport.</value>
|
/// <value>The avatar which initiated the teleport.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the target location of the teleport.
|
/// 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="uri">The received URI.</param>
|
||||||
/// <param name="target">The URI target.</param>
|
/// <param name="target">The URI target.</param>
|
||||||
/// <param name="avatar">The avatar who sent the URI.</param>
|
/// <param name="avatar">The avatar who sent the URI.</param>
|
||||||
public UriReceivedEventArgs(Uri uri, UriTarget target, IAvatar avatar)
|
public UriReceivedEventArgs(Uri uri, UriTarget target, Avatar avatar)
|
||||||
{
|
{
|
||||||
Uri = uri;
|
Uri = uri;
|
||||||
Target = target;
|
Target = target;
|
||||||
@ -24,7 +24,7 @@ public sealed class UriReceivedEventArgs : EventArgs
|
|||||||
/// Gets the avatar who sent the URI.
|
/// Gets the avatar who sent the URI.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The avatar who sent the URI.</value>
|
/// <value>The avatar who sent the URI.</value>
|
||||||
public IAvatar Avatar { get; }
|
public Avatar Avatar { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the URI target.
|
/// Gets the URI target.
|
||||||
|
@ -16,7 +16,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
|
|||||||
VirtualParadiseClient client,
|
VirtualParadiseClient client,
|
||||||
int requestId,
|
int requestId,
|
||||||
string name,
|
string name,
|
||||||
IUser user,
|
User user,
|
||||||
Location location)
|
Location location)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
@ -42,7 +42,7 @@ public sealed class InviteRequest : IEquatable<InviteRequest>
|
|||||||
/// Gets the user which sent the request.
|
/// Gets the user which sent the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user which sent the request.</value>
|
/// <value>The user which sent the request.</value>
|
||||||
public IUser User { get; }
|
public User User { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a value indicating whether two <see cref="InviteRequest" /> instances are equal.
|
/// 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 VirtualParadiseClient _client;
|
||||||
private readonly int _requestId;
|
private readonly int _requestId;
|
||||||
|
|
||||||
internal JoinRequest(VirtualParadiseClient client, int requestId, string name, IUser user)
|
internal JoinRequest(VirtualParadiseClient client, int requestId, string name, User user)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
User = user;
|
User = user;
|
||||||
@ -30,7 +30,7 @@ public sealed class JoinRequest : IEquatable<JoinRequest>
|
|||||||
/// Gets the user which sent the request.
|
/// Gets the user which sent the request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The user which sent the request.</value>
|
/// <value>The user which sent the request.</value>
|
||||||
public IUser User { get; }
|
public User User { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a value indicating whether two <see cref="JoinRequest" /> instances are equal.
|
/// Returns a value indicating whether two <see cref="JoinRequest" /> instances are equal.
|
||||||
|
17
VpSharp/src/MessageType.cs
Normal file
17
VpSharp/src/MessageType.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace VpSharp;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An enumeration of message types.
|
||||||
|
/// </summary>
|
||||||
|
public enum MessageType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A chat message sent by an avatar.
|
||||||
|
/// </summary>
|
||||||
|
ChatMessage,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A console message sent by a bot.
|
||||||
|
/// </summary>
|
||||||
|
ConsoleMessage
|
||||||
|
}
|
@ -20,7 +20,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
/// The avatar whose session is equal to <paramref name="session" />, or <see langword="null" /> if no match was
|
/// The avatar whose session is equal to <paramref name="session" />, or <see langword="null" /> if no match was
|
||||||
/// found.
|
/// found.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public IAvatar? GetAvatar(int session)
|
public Avatar? GetAvatar(int session)
|
||||||
{
|
{
|
||||||
_avatars.TryGetValue(session, out Avatar? avatar);
|
_avatars.TryGetValue(session, out Avatar? avatar);
|
||||||
return avatar;
|
return avatar;
|
||||||
|
@ -7,13 +7,13 @@ namespace VpSharp;
|
|||||||
public sealed partial class VirtualParadiseClient
|
public sealed partial class VirtualParadiseClient
|
||||||
{
|
{
|
||||||
private readonly Subject<AvatarClickedEventArgs> _avatarClicked = new();
|
private readonly Subject<AvatarClickedEventArgs> _avatarClicked = new();
|
||||||
private readonly Subject<IAvatar> _avatarJoined = new();
|
private readonly Subject<Avatar> _avatarJoined = new();
|
||||||
private readonly Subject<IAvatar> _avatarLeft = new();
|
private readonly Subject<Avatar> _avatarLeft = new();
|
||||||
private readonly Subject<AvatarMovedEventArgs> _avatarMoved = new();
|
private readonly Subject<AvatarMovedEventArgs> _avatarMoved = new();
|
||||||
private readonly Subject<AvatarTypeChangedEventArgs> _avatarTypeChanged = new();
|
private readonly Subject<AvatarTypeChangedEventArgs> _avatarTypeChanged = new();
|
||||||
private readonly Subject<InviteRequest> _inviteRequestReceived = new();
|
private readonly Subject<InviteRequest> _inviteRequestReceived = new();
|
||||||
private readonly Subject<JoinRequest> _joinRequestReceived = new();
|
private readonly Subject<JoinRequest> _joinRequestReceived = new();
|
||||||
private readonly Subject<IMessage> _messageReceived = new();
|
private readonly Subject<Message> _messageReceived = new();
|
||||||
private readonly Subject<ObjectBumpEventArgs> _objectBump = new();
|
private readonly Subject<ObjectBumpEventArgs> _objectBump = new();
|
||||||
private readonly Subject<ObjectChangedEventArgs> _objectChanged = new();
|
private readonly Subject<ObjectChangedEventArgs> _objectChanged = new();
|
||||||
private readonly Subject<ObjectClickedEventArgs> _objectClicked = new();
|
private readonly Subject<ObjectClickedEventArgs> _objectClicked = new();
|
||||||
@ -35,7 +35,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when an avatar has entered the vicinity of the client.
|
/// Occurs when an avatar has entered the vicinity of the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IObservable<IAvatar> AvatarJoined
|
public IObservable<Avatar> AvatarJoined
|
||||||
{
|
{
|
||||||
get => _avatarJoined;
|
get => _avatarJoined;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when an avatar has left the vicinity of the client.
|
/// Occurs when an avatar has left the vicinity of the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IObservable<IAvatar> AvatarLeft
|
public IObservable<Avatar> AvatarLeft
|
||||||
{
|
{
|
||||||
get => _avatarLeft;
|
get => _avatarLeft;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs when a chat message or console message has been received.
|
/// Occurs when a chat message or console message has been received.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IObservable<IMessage> MessageReceived
|
public IObservable<Message> MessageReceived
|
||||||
{
|
{
|
||||||
get => _messageReceived;
|
get => _messageReceived;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
|
|
||||||
private void OnChatNativeEvent(nint sender)
|
private void OnChatNativeEvent(nint sender)
|
||||||
{
|
{
|
||||||
IMessage message;
|
Message message;
|
||||||
|
|
||||||
lock (Lock)
|
lock (Lock)
|
||||||
{
|
{
|
||||||
@ -61,7 +61,6 @@ public sealed partial class VirtualParadiseClient
|
|||||||
string content = vp_string(sender, StringAttribute.ChatMessage);
|
string content = vp_string(sender, StringAttribute.ChatMessage);
|
||||||
|
|
||||||
int type = vp_int(sender, IntegerAttribute.ChatType);
|
int type = vp_int(sender, IntegerAttribute.ChatType);
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
|
||||||
|
|
||||||
Color color = Color.Black;
|
Color color = Color.Black;
|
||||||
var style = FontStyle.Regular;
|
var style = FontStyle.Regular;
|
||||||
@ -73,12 +72,10 @@ public sealed partial class VirtualParadiseClient
|
|||||||
int b = vp_int(sender, IntegerAttribute.ChatColorBlue);
|
int b = vp_int(sender, IntegerAttribute.ChatColorBlue);
|
||||||
color = Color.FromArgb(r, g, b);
|
color = Color.FromArgb(r, g, b);
|
||||||
style = (FontStyle)vp_int(sender, IntegerAttribute.ChatEffects);
|
style = (FontStyle)vp_int(sender, IntegerAttribute.ChatEffects);
|
||||||
message = new ConsoleMessage(avatar, name, content, color, style);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message = new UserMessage(avatar, content);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Avatar avatar = GetAvatar(session)!;
|
||||||
|
message = new Message((MessageType)type, name, content, avatar, style, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
_messageReceived.OnNext(message);
|
_messageReceived.OnNext(message);
|
||||||
@ -118,7 +115,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
rotation = Rotation.CreateFromTiltYawRoll(pitch, yaw, 0);
|
rotation = Rotation.CreateFromTiltYawRoll(pitch, yaw, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var avatar = (Avatar)GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
if (type != avatar.Type)
|
if (type != avatar.Type)
|
||||||
{
|
{
|
||||||
int oldType = avatar.Type;
|
int oldType = avatar.Type;
|
||||||
@ -148,7 +145,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
_avatars.TryRemove(session, out Avatar _);
|
_avatars.TryRemove(session, out Avatar _);
|
||||||
_avatarLeft.OnNext(avatar);
|
_avatarLeft.OnNext(avatar);
|
||||||
}
|
}
|
||||||
@ -176,7 +173,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
var args = new ObjectCreatedEventArgs(avatar, virtualParadiseObject);
|
var args = new ObjectCreatedEventArgs(avatar, virtualParadiseObject);
|
||||||
_objectCreated.OnNext(args);
|
_objectCreated.OnNext(args);
|
||||||
}
|
}
|
||||||
@ -193,7 +190,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
VirtualParadiseObject? cachedObject = null;
|
VirtualParadiseObject? cachedObject = null;
|
||||||
|
|
||||||
if (_objects.TryGetValue(objectId, out VirtualParadiseObject? virtualParadiseObject))
|
if (_objects.TryGetValue(objectId, out VirtualParadiseObject? virtualParadiseObject))
|
||||||
@ -229,7 +226,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
session = vp_int(sender, IntegerAttribute.AvatarSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar? avatar = GetAvatar(session);
|
||||||
VirtualParadiseObject? virtualParadiseObject;
|
VirtualParadiseObject? virtualParadiseObject;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -243,7 +240,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
|
|
||||||
_objects.TryRemove(objectId, out VirtualParadiseObject _);
|
_objects.TryRemove(objectId, out VirtualParadiseObject _);
|
||||||
|
|
||||||
var args = new ObjectDeletedEventArgs(avatar, objectId, virtualParadiseObject!);
|
var args = new ObjectDeletedEventArgs(avatar!, objectId, virtualParadiseObject!);
|
||||||
_objectDeleted.OnNext(args);
|
_objectDeleted.OnNext(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +261,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
clickPoint = new Vector3d(x, y, z);
|
clickPoint = new Vector3d(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
||||||
@ -335,7 +332,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
userId = vp_int(sender, IntegerAttribute.FriendUserId);
|
userId = vp_int(sender, IntegerAttribute.FriendUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = (User)await GetUserAsync(userId).ConfigureAwait(false);
|
User user = await GetUserAsync(userId).ConfigureAwait(false);
|
||||||
_friends.AddOrUpdate(userId, user, (_, _) => user);
|
_friends.AddOrUpdate(userId, user, (_, _) => user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,8 +423,8 @@ public sealed partial class VirtualParadiseClient
|
|||||||
clickPoint = new Vector3d(x, y, z);
|
clickPoint = new Vector3d(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
IAvatar clickedAvatar = GetAvatar(clickedSession)!;
|
Avatar clickedAvatar = GetAvatar(clickedSession)!;
|
||||||
var args = new AvatarClickedEventArgs(avatar, clickedAvatar, clickPoint);
|
var args = new AvatarClickedEventArgs(avatar, clickedAvatar, clickPoint);
|
||||||
_avatarClicked.OnNext(args);
|
_avatarClicked.OnNext(args);
|
||||||
}
|
}
|
||||||
@ -460,8 +457,8 @@ public sealed partial class VirtualParadiseClient
|
|||||||
: await GetWorldAsync(worldName).ConfigureAwait(false))!;
|
: await GetWorldAsync(worldName).ConfigureAwait(false))!;
|
||||||
var location = new Location(world, position, rotation);
|
var location = new Location(world, position, rotation);
|
||||||
|
|
||||||
((Avatar)CurrentAvatar!).Location = location;
|
CurrentAvatar!.Location = location;
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
var args = new TeleportedEventArgs(avatar, location);
|
var args = new TeleportedEventArgs(avatar, location);
|
||||||
_teleported.OnNext(args);
|
_teleported.OnNext(args);
|
||||||
}
|
}
|
||||||
@ -477,7 +474,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
objectId = vp_int(sender, IntegerAttribute.ObjectId);
|
objectId = vp_int(sender, IntegerAttribute.ObjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
||||||
@ -508,7 +505,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
var uri = new Uri(url);
|
var uri = new Uri(url);
|
||||||
var args = new UriReceivedEventArgs(uri, target, avatar);
|
var args = new UriReceivedEventArgs(uri, target, avatar);
|
||||||
_uriReceived.OnNext(args);
|
_uriReceived.OnNext(args);
|
||||||
@ -525,7 +522,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
objectId = vp_int(sender, IntegerAttribute.ObjectId);
|
objectId = vp_int(sender, IntegerAttribute.ObjectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = GetAvatar(session)!;
|
Avatar avatar = GetAvatar(session)!;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
|
||||||
@ -551,7 +548,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
name = vp_string(NativeInstanceHandle, StringAttribute.JoinName);
|
name = vp_string(NativeInstanceHandle, StringAttribute.JoinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
IUser user = await GetUserAsync(userId).ConfigureAwait(false);
|
User user = await GetUserAsync(userId).ConfigureAwait(false);
|
||||||
var joinRequest = new JoinRequest(this, requestId, name, user);
|
var joinRequest = new JoinRequest(this, requestId, name, user);
|
||||||
_joinRequestReceived.OnNext(joinRequest);
|
_joinRequestReceived.OnNext(joinRequest);
|
||||||
}
|
}
|
||||||
@ -585,7 +582,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
World world = (await GetWorldAsync(worldName).ConfigureAwait(false))!;
|
World world = (await GetWorldAsync(worldName).ConfigureAwait(false))!;
|
||||||
IUser user = await GetUserAsync(userId).ConfigureAwait(false);
|
User user = await GetUserAsync(userId).ConfigureAwait(false);
|
||||||
|
|
||||||
var location = new Location(world, position, rotation);
|
var location = new Location(world, position, rotation);
|
||||||
var request = new InviteRequest(this, requestId, avatarName, user, location);
|
var request = new InviteRequest(this, requestId, avatarName, user, location);
|
||||||
|
@ -16,7 +16,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// The user whose ID is equal to <paramref name="userId" />, or <see langword="null" /> if no match was found.
|
/// The user whose ID is equal to <paramref name="userId" />, or <see langword="null" /> if no match was found.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async Task<IUser> GetUserAsync(int userId)
|
public async Task<User> GetUserAsync(int userId)
|
||||||
{
|
{
|
||||||
if (_users.TryGetValue(userId, out User? user))
|
if (_users.TryGetValue(userId, out User? user))
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
/// Gets a read-only view of the cached avatars.
|
/// Gets a read-only view of the cached avatars.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The cached avatars.</value>
|
/// <value>The cached avatars.</value>
|
||||||
public IReadOnlyList<IAvatar> Avatars
|
public IReadOnlyList<Avatar> Avatars
|
||||||
{
|
{
|
||||||
get => _avatars.Values.ToArray();
|
get => _avatars.Values.ToArray();
|
||||||
}
|
}
|
||||||
@ -77,15 +77,15 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// An instance of <see cref="Avatar" />, 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>
|
/// </value>
|
||||||
public IAvatar? CurrentAvatar { get; internal set; }
|
public Avatar? CurrentAvatar { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current user to which this client is logged in.
|
/// Gets the current user to which this client is logged in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>
|
/// <value>
|
||||||
/// An instance of <see cref="IUser" />, 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>
|
/// </value>
|
||||||
public IUser? CurrentUser { get; internal set; }
|
public User? CurrentUser { get; internal set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the world to which this client is currently connected.
|
/// Gets the world to which this client is currently connected.
|
||||||
@ -399,7 +399,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
if (CurrentAvatar is not null)
|
if (CurrentAvatar is not null)
|
||||||
{
|
{
|
||||||
// TODO why is this here? we reassign CurrentAvatar right below!
|
// TODO why is this here? we reassign CurrentAvatar right below!
|
||||||
((Avatar)CurrentAvatar).Location = new Location(world);
|
CurrentAvatar.Location = new Location(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
world.Size = new Size(size, size);
|
world.Size = new Size(size, size);
|
||||||
@ -565,7 +565,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
/// <para><paramref name="message" /> is too long to send.</para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public Task<IUserMessage> SendMessageAsync(string message)
|
public Task<Message> SendMessageAsync(string message)
|
||||||
{
|
{
|
||||||
if (message is null)
|
if (message is null)
|
||||||
{
|
{
|
||||||
@ -593,9 +593,14 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.FromResult((IUserMessage)new UserMessage(
|
Avatar? avatar = CurrentAvatar;
|
||||||
CurrentAvatar!,
|
return Task.FromResult(new Message(
|
||||||
message
|
MessageType.ChatMessage,
|
||||||
|
avatar!.Name,
|
||||||
|
message,
|
||||||
|
avatar,
|
||||||
|
FontStyle.Regular,
|
||||||
|
Color.Black
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +620,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
/// <para><paramref name="message" /> is too long to send.</para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public Task<IConsoleMessage> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
public Task<Message> SendMessageAsync(string message, FontStyle fontStyle, Color color)
|
||||||
{
|
{
|
||||||
return SendMessageAsync(null, message, fontStyle, color);
|
return SendMessageAsync(null, message, fontStyle, color);
|
||||||
}
|
}
|
||||||
@ -637,7 +642,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
/// -or-
|
/// -or-
|
||||||
/// <para><paramref name="message" /> is too long to send.</para>
|
/// <para><paramref name="message" /> is too long to send.</para>
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public Task<IConsoleMessage> 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)
|
if (message is null)
|
||||||
{
|
{
|
||||||
@ -675,13 +680,14 @@ public sealed partial class VirtualParadiseClient : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IAvatar avatar = CurrentAvatar!;
|
Avatar avatar = CurrentAvatar!;
|
||||||
return Task.FromResult((IConsoleMessage)new ConsoleMessage(
|
return Task.FromResult(new Message(
|
||||||
avatar,
|
MessageType.ConsoleMessage,
|
||||||
avatar.Name,
|
name,
|
||||||
message,
|
message,
|
||||||
color,
|
avatar,
|
||||||
fontStyle
|
fontStyle,
|
||||||
|
color
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user