From d8d0abb4c1271dc28ebcf185942bef2c512da530 Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 27 Sep 2023 21:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Solutions/MyPlugin.cs | 72 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/Solutions/MyPlugin.cs b/Solutions/MyPlugin.cs index c07b23e..8014871 100644 --- a/Solutions/MyPlugin.cs +++ b/Solutions/MyPlugin.cs @@ -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.Plugin; -using Milimoe.FunGame.Core.Library.Constant; 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 Version => "1.0.0"; - public override string Author => "FunGamer"; + public override string Author => "milimoe"; 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("count")); + } + } + + public void FailedIntoRoomEvent(object sender, RoomEventArgs e) + { + } } }