mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 14:28:47 +00:00
Add samples
This commit is contained in:
parent
76dc485ad7
commit
4c31eb58a9
35
Samples/VpSharp.CSharp_Sample/Program.cs
Normal file
35
Samples/VpSharp.CSharp_Sample/Program.cs
Normal 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}!");
|
||||
}
|
||||
}
|
BIN
Samples/VpSharp.CSharp_Sample/VPSDK.dll
Normal file
BIN
Samples/VpSharp.CSharp_Sample/VPSDK.dll
Normal file
Binary file not shown.
23
Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj
Normal file
23
Samples/VpSharp.CSharp_Sample/VpSharp.CSharp_Sample.csproj
Normal 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>
|
BIN
Samples/VpSharp.CSharp_Sample/libvpsdk.so
Normal file
BIN
Samples/VpSharp.CSharp_Sample/libvpsdk.so
Normal file
Binary file not shown.
32
Samples/VpSharp.VB_Sample/Program.vb
Normal file
32
Samples/VpSharp.VB_Sample/Program.vb
Normal 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
|
BIN
Samples/VpSharp.VB_Sample/VPSDK.dll
Normal file
BIN
Samples/VpSharp.VB_Sample/VPSDK.dll
Normal file
Binary file not shown.
22
Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj
Normal file
22
Samples/VpSharp.VB_Sample/VpSharp.VB_Sample.vbproj
Normal 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>
|
BIN
Samples/VpSharp.VB_Sample/libvpsdk.so
Normal file
BIN
Samples/VpSharp.VB_Sample/libvpsdk.so
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user