🚧 clean up listeners

This commit is contained in:
2023-10-09 09:17:43 +03:00
parent c214b6ca7f
commit 5d812d7acc
4 changed files with 21 additions and 2 deletions
+10 -1
View File
@@ -18,7 +18,7 @@ using Ragon.Protocol;
namespace Ragon.Client
{
public class RagonRoom
public class RagonRoom: IDisposable
{
private delegate void OnEventDelegate(RagonPlayer player, RagonBuffer serializer);
@@ -130,5 +130,14 @@ namespace Ragon.Client
public void DestroyEntity(RagonEntity entityId) => DestroyEntity(entityId, null);
public void DestroyEntity(RagonEntity entityId, RagonPayload payload) => _entityCache.Destroy(entityId, payload);
public void Dispose()
{
Cleanup();
_events.Clear();
_listeners.Clear();
_localListeners.Clear();
}
}
}