mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-12-05 08:09:04 +00:00
插件示例
This commit is contained in:
parent
999f902da5
commit
d8d0abb4c1
@ -1,43 +1,89 @@
|
|||||||
using Milimoe.FunGame.Core.Interface;
|
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||||
|
using Milimoe.FunGame.Core.Interface;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Event;
|
using Milimoe.FunGame.Core.Library.Common.Event;
|
||||||
using Milimoe.FunGame.Core.Library.Common.Plugin;
|
using Milimoe.FunGame.Core.Library.Common.Plugin;
|
||||||
using Milimoe.FunGame.Core.Library.Constant;
|
|
||||||
|
|
||||||
namespace FunGame.Testing.Solutions
|
namespace FunGame.Testing.Solutions
|
||||||
{
|
{
|
||||||
internal class MyPlugin : BasePlugin, ILoginEvent
|
public class MyPlugin : BasePlugin, ILoginEvent, IConnectEvent, IIntoRoomEvent
|
||||||
{
|
{
|
||||||
public override string Name => "FunGame Testing Plugin";
|
public override string Name => "测试插件";
|
||||||
|
|
||||||
public override string Description => "My First Plugin";
|
public override string Description => "My First Plugin";
|
||||||
|
|
||||||
public override string Version => "1.0.0";
|
public override string Version => "1.0.0";
|
||||||
|
|
||||||
public override string Author => "FunGamer";
|
public override string Author => "milimoe";
|
||||||
|
|
||||||
public MyPlugin()
|
public MyPlugin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventResult AfterLoginEvent(object sender, LoginEventArgs e)
|
public void AfterLoginEvent(object sender, LoginEventArgs e)
|
||||||
{
|
{
|
||||||
return EventResult.Success;
|
WritelnSystemInfo("[" + Name + "] 触发AfterLoginEvent! ");
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventResult BeforeLoginEvent(object sender, LoginEventArgs e)
|
public void BeforeLoginEvent(object sender, LoginEventArgs e)
|
||||||
{
|
{
|
||||||
return EventResult.Success;
|
WritelnSystemInfo("[" + Name + "] 试图登录!账号" + e.Username + "密码" + e.Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventResult FailedLoginEvent(object sender, LoginEventArgs e)
|
public void FailedLoginEvent(object sender, LoginEventArgs e)
|
||||||
{
|
{
|
||||||
return EventResult.Success;
|
WritelnSystemInfo("[" + Name + "] 登录失败~~");
|
||||||
}
|
}
|
||||||
|
|
||||||
public EventResult SucceedLoginEvent(object sender, LoginEventArgs e)
|
public void SucceedLoginEvent(object sender, LoginEventArgs e)
|
||||||
{
|
{
|
||||||
return EventResult.Success;
|
WritelnSystemInfo("[" + Name + "] 检测到登录成功?? ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeforeConnectEvent(object sender, ConnectEventArgs e)
|
||||||
|
{
|
||||||
|
WritelnSystemInfo("[" + Name + "] 试图连接服务器!!服务器IP" + e.ServerIP + ":" + e.ServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterConnectEvent(object sender, ConnectEventArgs e)
|
||||||
|
{
|
||||||
|
WritelnSystemInfo("[" + Name + "] 结果:" + e.ConnectResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SucceedConnectEvent(object sender, ConnectEventArgs e)
|
||||||
|
{
|
||||||
|
WritelnSystemInfo("[" + Name + "] 连接服务器成功!!服务器IP" + e.ServerIP + ":" + e.ServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FailedConnectEvent(object sender, ConnectEventArgs e)
|
||||||
|
{
|
||||||
|
WritelnSystemInfo("[" + Name + "] 连接服务器失败!!服务器IP" + e.ServerIP + ":" + e.ServerPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeforeIntoRoomEvent(object sender, RoomEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AfterIntoRoomEvent(object sender, RoomEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SucceedIntoRoomEvent(object sender, RoomEventArgs e)
|
||||||
|
{
|
||||||
|
DataRequest request = NewDataRequest(Milimoe.FunGame.Core.Library.Constant.DataRequestType.Room_GetRoomPlayerCount);
|
||||||
|
request.AddRequestData("roomid", e.RoomID);
|
||||||
|
request.SendRequest();
|
||||||
|
if (request.Result == Milimoe.FunGame.Core.Library.Constant.RequestResult.Success)
|
||||||
|
{
|
||||||
|
WritelnSystemInfo("[" + Name + "] " + e.RoomID + " 的玩家数量为: " + request.GetResult<int>("count"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FailedIntoRoomEvent(object sender, RoomEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user