1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-09 23:55:42 +00:00

fix: suppress events on obj query fail

This commit is contained in:
Oliver Booth 2023-11-14 21:47:50 +00:00
parent 67387f567d
commit f385ba867e
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -263,9 +263,16 @@ public sealed partial class VirtualParadiseClient
} }
VirtualParadiseAvatar avatar = GetAvatar(session)!; VirtualParadiseAvatar avatar = GetAvatar(session)!;
VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); try
var args = new ObjectClickedEventArgs(avatar, virtualParadiseObject, clickPoint); {
_objectClicked.OnNext(args); VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false);
var args = new ObjectClickedEventArgs(avatar, virtualParadiseObject, clickPoint);
_objectClicked.OnNext(args);
}
catch (ObjectNotFoundException)
{
// ignored
}
} }
private async void OnWorldListNativeEvent(nint sender) private async void OnWorldListNativeEvent(nint sender)
@ -281,7 +288,7 @@ public sealed partial class VirtualParadiseClient
avatarCount = vp_int(sender, IntegerAttribute.WorldUsers); avatarCount = vp_int(sender, IntegerAttribute.WorldUsers);
state = (WorldState)vp_int(sender, IntegerAttribute.WorldState); state = (WorldState)vp_int(sender, IntegerAttribute.WorldState);
world = new VirtualParadiseWorld(this, name) {AvatarCount = avatarCount, State = state}; world = new VirtualParadiseWorld(this, name) { AvatarCount = avatarCount, State = state };
_worlds[name] = world; _worlds[name] = world;
} }
@ -468,10 +475,16 @@ public sealed partial class VirtualParadiseClient
} }
VirtualParadiseAvatar avatar = GetAvatar(session)!; VirtualParadiseAvatar avatar = GetAvatar(session)!;
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false); try
{
var args = new ObjectBumpEventArgs(avatar, vpObject, BumpPhase.End); var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
_objectBump.OnNext(args); var args = new ObjectBumpEventArgs(avatar, vpObject, BumpPhase.End);
_objectBump.OnNext(args);
}
catch (ObjectNotFoundException)
{
// ignored
}
} }
private void OnUrlNativeEvent(nint sender) private void OnUrlNativeEvent(nint sender)
@ -510,10 +523,16 @@ public sealed partial class VirtualParadiseClient
} }
VirtualParadiseAvatar avatar = GetAvatar(session)!; VirtualParadiseAvatar avatar = GetAvatar(session)!;
var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false); try
{
var args = new ObjectBumpEventArgs(avatar, vpObject, BumpPhase.Begin); var vpObject = await GetObjectAsync(objectId).ConfigureAwait(false);
_objectBump.OnNext(args); var args = new ObjectBumpEventArgs(avatar, vpObject, BumpPhase.Begin);
_objectBump.OnNext(args);
}
catch (ObjectNotFoundException)
{
// ignored
}
} }
private async void OnJoinNativeEvent(nint sender) private async void OnJoinNativeEvent(nint sender)