2022-05-08 00:40:11 +04:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using Game.Source.Events;
|
|
|
|
|
using NLog;
|
2022-04-24 09:05:15 +04:00
|
|
|
using Ragon.Core;
|
|
|
|
|
|
|
|
|
|
namespace Game.Source
|
|
|
|
|
{
|
2022-04-30 08:20:17 +04:00
|
|
|
public class ExamplePlugin: PluginBase
|
2022-04-24 09:05:15 +04:00
|
|
|
{
|
|
|
|
|
public override void OnStart()
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Plugin started");
|
2022-05-08 00:40:11 +04:00
|
|
|
|
2022-05-08 10:11:50 +04:00
|
|
|
/*Subscribe<TestEvent>(123, OnTestEvent);
|
|
|
|
|
*/
|
|
|
|
|
// Subscribe(500, OnTestEvent2);;
|
2022-05-08 09:59:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnTestEvent2(Player obj)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Event without data");
|
2022-04-24 09:05:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnStop()
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Plugin stopped");
|
|
|
|
|
}
|
2022-05-08 00:40:11 +04:00
|
|
|
|
|
|
|
|
private void OnTestEvent(Player player, TestEvent myEvent)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Data " + myEvent.TestData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnPlayerJoined(Player player)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Player joined " + player.PlayerName);
|
2022-05-08 09:59:20 +04:00
|
|
|
|
|
|
|
|
SendEvent(player, 123, new TestEvent()
|
|
|
|
|
{
|
|
|
|
|
TestData = "asdf"
|
|
|
|
|
});
|
2022-05-08 00:40:11 +04:00
|
|
|
|
|
|
|
|
SendEvent(123, new TestEvent()
|
|
|
|
|
{
|
|
|
|
|
TestData = "Hello!",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnPlayerLeaved(Player player)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Player leaved " + player.PlayerName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnEntityCreated(Player creator, Entity entity)
|
|
|
|
|
{
|
|
|
|
|
// entity.
|
2022-05-08 10:11:50 +04:00
|
|
|
// Subscribe(entity, 500, OnEntityTestEvent);
|
2022-05-08 00:40:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnEntityDestroyed(Player destoyer, Entity entity)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-08 10:11:50 +04:00
|
|
|
private void OnEntityTestEvent(Player player, Entity entity)
|
|
|
|
|
{
|
|
|
|
|
_logger.Info("Entity event with empty payload");
|
2022-05-08 00:40:11 +04:00
|
|
|
}
|
2022-04-24 09:05:15 +04:00
|
|
|
}
|
|
|
|
|
}
|