1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 19:58:48 +00:00

Add samples

This commit is contained in:
Oliver Booth 2022-12-06 19:28:14 +00:00
parent 76dc485ad7
commit 4c31eb58a9
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
8 changed files with 112 additions and 0 deletions

View File

@ -0,0 +1,35 @@
using VpSharp.EventData;
namespace VpSharp.CSharp_Sample;
internal static class Program
{
private static VirtualParadiseClient s_client = null!;
private static async Task Main()
{
var configuration = new VirtualParadiseConfiguration
{
Username = "YOUR_VP_USERNAME",
Password = "YOUR_VP_PASSWORD",
BotName = "Greeter",
Application = new Application("GreeterBot", "1.0")
};
s_client = new VirtualParadiseClient(configuration);
s_client.AvatarJoined += ClientOnAvatarJoined;
await s_client.ConnectAsync();
await s_client.LoginAsync();
await s_client.EnterAsync("WORLD_NAME");
await s_client.CurrentAvatar!.TeleportAsync(Vector3d.Zero);
await Task.Delay(-1);
}
private static async void ClientOnAvatarJoined(object? sender, AvatarJoinedEventArgs args)
{
await s_client.SendMessageAsync($"Hello, {args.Avatar.Name}!");
}
}

Binary file not shown.

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="libvpsdk.so">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="VPSDK.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.

View File

@ -0,0 +1,32 @@
Imports VpSharp.EventData
Module Program
Private WithEvents _client As VirtualParadiseClient
Public Sub Main(args As String())
MainAsync().GetAwaiter().GetResult()
End Sub
Private Async Function MainAsync() As Task
Dim configuration = new VirtualParadiseConfiguration _
With {
.Username = "YOUR_VP_USERNAME",
.Password = "YOUR_VP_PASSWORD",
.BotName = "Greeter",
.Application = New Application("GreeterBot", "1.0")
}
_client = New VirtualParadiseClient(configuration)
Await _client.ConnectAsync()
Await _client.LoginAsync()
Await _client.EnterAsync("WORLD_NAME")
Await _client.CurrentAvatar.TeleportAsync(Vector3d.Zero)
Await Task.Delay(-1)
End Function
Private Async Sub ClientOnAvatarJoined(sender As Object, args As AvatarJoinedEventArgs) Handles _client.AvatarJoined
Await _client.SendMessageAsync("Hello, " & args.Avatar.Name)
End Sub
End Module

Binary file not shown.

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>VpSharp.VB_Sample</RootNamespace>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\VpSharp\VpSharp.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="VPSDK.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="libvpsdk.so">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.