2024-01-13 15:15:29 +03:00
|
|
|
using Ragon.Server;
|
2025-01-18 17:30:03 +03:00
|
|
|
using Ragon.Server.Lobby;
|
2023-04-09 11:06:52 +04:00
|
|
|
using Ragon.Server.Plugin;
|
2025-01-18 17:30:03 +03:00
|
|
|
using Ragon.Server.Time;
|
2023-04-09 10:52:18 +04:00
|
|
|
|
2024-05-19 11:28:36 +03:00
|
|
|
namespace Ragon.Relay
|
2023-04-09 10:52:18 +04:00
|
|
|
{
|
2024-05-19 11:28:36 +03:00
|
|
|
public class RelayServerPlugin : BaseServerPlugin
|
2023-04-09 10:52:18 +04:00
|
|
|
{
|
2025-01-18 17:30:03 +03:00
|
|
|
private RelayConfiguration _relayConfiguration;
|
|
|
|
|
private RagonScheduler _scheduler;
|
|
|
|
|
private RagonConnectionRegistry _connectionRegistry;
|
|
|
|
|
private IRagonLobby _lobby;
|
|
|
|
|
private Reporter _reporter;
|
|
|
|
|
|
|
|
|
|
public RelayServerPlugin(RelayConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
_relayConfiguration = config;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnAttached(IRagonServer server)
|
|
|
|
|
{
|
|
|
|
|
base.OnAttached(server);
|
|
|
|
|
|
|
|
|
|
_lobby = server.Lobby;
|
|
|
|
|
_connectionRegistry = server.ConnectionRegistry;
|
|
|
|
|
_scheduler = server.Scheduler;
|
|
|
|
|
_reporter = new Reporter(_relayConfiguration, server, "127.0.0.1", 5000);
|
|
|
|
|
|
|
|
|
|
server.Scheduler.Run(new RagonActionTimer(() => _reporter.Done(), 1, -1));
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-19 11:28:36 +03:00
|
|
|
public override bool OnCommand(string command, string payload)
|
2023-04-13 20:42:05 +04:00
|
|
|
{
|
2024-05-19 11:28:36 +03:00
|
|
|
return true;
|
2023-04-13 20:42:05 +04:00
|
|
|
}
|
2024-01-13 15:15:29 +03:00
|
|
|
|
2024-05-19 11:28:36 +03:00
|
|
|
public override IRoomPlugin CreateRoomPlugin(RoomInformation information)
|
|
|
|
|
{
|
|
|
|
|
return new RelayRoomPlugin();
|
|
|
|
|
}
|
2024-01-13 15:15:29 +03:00
|
|
|
}
|
2023-04-09 10:52:18 +04:00
|
|
|
}
|