🚧 plugin system, webhook system
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DebugType>none</DebugType>
|
||||
<OutputPath>/Users/edmand46/RagonProjects/ragon-unity-sdk/Assets/Ragon/Runtime/Plugins</OutputPath>
|
||||
<OutputPath>/Users/edmand46/RagonProjects/ragon-oss-sdk/Assets/Ragon/Plugins/</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace Ragon.Client;
|
||||
|
||||
public interface IRagonConnectedListener
|
||||
public interface IRagonConnectionListener
|
||||
{
|
||||
void OnConnected(RagonClient client);
|
||||
void OnDisconnected(RagonClient client);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Ragon.Client
|
||||
{
|
||||
public interface IRagonListener :
|
||||
IRagonAuthorizationListener,
|
||||
IRagonConnectedListener,
|
||||
IRagonConnectionListener,
|
||||
IRagonFailedListener,
|
||||
IRagonJoinListener,
|
||||
IRagonLeftListener,
|
||||
|
||||
@@ -87,23 +87,18 @@ namespace Ragon.Client
|
||||
_handlers = new Handler[byte.MaxValue];
|
||||
_handlers[(byte)RagonOperation.AUTHORIZED_SUCCESS] = new AuthorizeSuccessHandler(_listenerList);
|
||||
_handlers[(byte)RagonOperation.AUTHORIZED_FAILED] = new AuthorizeFailedHandler(_listenerList);
|
||||
_handlers[(byte)RagonOperation.JOIN_SUCCESS] =
|
||||
new JoinSuccessHandler(this, _readBuffer, _listenerList, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.JOIN_SUCCESS] = new JoinSuccessHandler(this, _readBuffer, _listenerList, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.JOIN_FAILED] = new JoinFailedHandler(_listenerList);
|
||||
_handlers[(byte)RagonOperation.LEAVE_ROOM] = new LeaveRoomHandler(this, _listenerList, _entityCache);
|
||||
_handlers[(byte)RagonOperation.OWNERSHIP_CHANGED] =
|
||||
new OwnershipHandler(_listenerList, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.OWNERSHIP_CHANGED] = new OwnershipHandler(_listenerList, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.PLAYER_JOINED] = new PlayerJoinHandler(_playerCache, _listenerList);
|
||||
_handlers[(byte)RagonOperation.PLAYER_LEAVED] =
|
||||
new PlayerLeftHandler(_entityCache, _playerCache, _listenerList);
|
||||
_handlers[(byte)RagonOperation.PLAYER_LEAVED] = new PlayerLeftHandler(_entityCache, _playerCache, _listenerList);
|
||||
_handlers[(byte)RagonOperation.LOAD_SCENE] = new SceneLoadHandler(this, _listenerList);
|
||||
_handlers[(byte)RagonOperation.CREATE_ENTITY] = new EntityCreateHandler(this, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.DESTROY_ENTITY] = new EntityDestroyHandler(_entityCache);
|
||||
_handlers[(byte)RagonOperation.REMOVE_ENTITY] = new EntityDestroyHandler(_entityCache);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_STATE] = new StateEntityHandler(_entityCache);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_EVENT] =
|
||||
new EntityEventHandler(this, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.SNAPSHOT] =
|
||||
new SnapshotHandler(this, _listenerList, _entityCache, _playerCache);
|
||||
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_EVENT] = new EntityEventHandler(this, _playerCache, _entityCache);
|
||||
_handlers[(byte)RagonOperation.SNAPSHOT] = new SnapshotHandler(this, _listenerList, _entityCache, _playerCache);
|
||||
|
||||
var protocolRaw = RagonVersion.Parse(protocol);
|
||||
_connection.Connect(address, port, protocolRaw);
|
||||
@@ -144,7 +139,7 @@ namespace Ragon.Client
|
||||
|
||||
public void AddListener(IRagonListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonAuthorizationListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonConnectedListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonConnectionListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonFailedListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonJoinListener listener) => _listenerList.Add(listener);
|
||||
public void AddListener(IRagonLeftListener listener) => _listenerList.Add(listener);
|
||||
@@ -155,7 +150,7 @@ namespace Ragon.Client
|
||||
|
||||
public void RemoveListener(IRagonListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonAuthorizationListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonConnectedListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonConnectionListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonFailedListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonJoinListener listener) => _listenerList.Remove(listener);
|
||||
public void RemoveListener(IRagonLeftListener listener) => _listenerList.Remove(listener);
|
||||
|
||||
@@ -81,7 +81,7 @@ public sealed class RagonEntityCache
|
||||
var buffer = _client.Buffer;
|
||||
|
||||
buffer.Clear();
|
||||
buffer.WriteOperation(RagonOperation.DESTROY_ENTITY);
|
||||
buffer.WriteOperation(RagonOperation.REMOVE_ENTITY);
|
||||
buffer.WriteUShort(entity.Id);
|
||||
|
||||
destroyPayload?.Serialize(buffer);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Ragon.Client
|
||||
{
|
||||
private readonly RagonClient _client;
|
||||
private readonly List<IRagonAuthorizationListener> _authorizationListeners = new();
|
||||
private readonly List<IRagonConnectedListener> _connectionListeners = new();
|
||||
private readonly List<IRagonConnectionListener> _connectionListeners = new();
|
||||
private readonly List<IRagonFailedListener> _failedListeners = new();
|
||||
private readonly List<IRagonJoinListener> _joinListeners = new();
|
||||
private readonly List<IRagonLeftListener> _leftListeners = new();
|
||||
@@ -65,7 +65,7 @@ namespace Ragon.Client
|
||||
_authorizationListeners.Add(listener);
|
||||
}
|
||||
|
||||
public void Add(IRagonConnectedListener listener)
|
||||
public void Add(IRagonConnectionListener listener)
|
||||
{
|
||||
_connectionListeners.Add(listener);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace Ragon.Client
|
||||
_authorizationListeners.Remove(listener);
|
||||
}
|
||||
|
||||
public void Remove(IRagonConnectedListener listener)
|
||||
public void Remove(IRagonConnectionListener listener)
|
||||
{
|
||||
_connectionListeners.Remove(listener);
|
||||
}
|
||||
|
||||
@@ -93,13 +93,13 @@ namespace Ragon.Client
|
||||
_client.Reliable.Send(sendData);
|
||||
}
|
||||
|
||||
public void AuthorizeWithKey(string key, string playerName, byte[] additonalData)
|
||||
public void AuthorizeWithKey(string key, string playerName, string payload = "")
|
||||
{
|
||||
_buffer.Clear();
|
||||
_buffer.WriteOperation(RagonOperation.AUTHORIZE);
|
||||
_buffer.WriteString(key);
|
||||
_buffer.WriteString(playerName);
|
||||
_buffer.WriteBytes(additonalData);
|
||||
_buffer.WriteString(payload);
|
||||
|
||||
var sendData = _buffer.ToArray();
|
||||
_client.Reliable.Send(sendData);
|
||||
|
||||
Reference in New Issue
Block a user