diff --git a/Api/Utility/Factory.cs b/Api/Utility/Factory.cs index 46bda57..eb4f755 100644 --- a/Api/Utility/Factory.cs +++ b/Api/Utility/Factory.cs @@ -78,13 +78,42 @@ namespace Milimoe.FunGame.Core.Api.Utility return RoomFactory.Create(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password); } + /// + /// 通过DataSet获取房间实例 + /// + /// + /// + /// + public static Room GetRoom(DataRow DrRoom, User User) + { + Room room = General.HallInstance; + if (DrRoom != null) + { + long Id = (long)DrRoom[RoomQuery.Column_ID]; + string Roomid = (string)DrRoom[RoomQuery.Column_RoomID]; + DateTime CreateTime = (DateTime)DrRoom[RoomQuery.Column_CreateTime]; + User RoomMaster = User; + RoomType RoomType = (RoomType)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomType]); + RoomState RoomState = (RoomState)Convert.ToInt32(DrRoom[RoomQuery.Column_RoomState]); + string Password = (string)DrRoom[RoomQuery.Column_Password]; + room = GetRoom(Id, Roomid, CreateTime, RoomMaster, RoomType, RoomState, Password); + } + return room; + } + + /// + /// 通过DataSet获取房间列表 + /// + /// + /// + /// public static List GetRooms(DataSet DsRoom, DataSet DsUser) { List list = new() { General.HallInstance }; - if (DsRoom != null && DsRoom.Tables.Count > 0) + if (DsRoom != null && DsRoom.Tables[0].Rows.Count > 0) { foreach (DataRow DrRoom in DsRoom.Tables[0].Rows) { diff --git a/Api/Utility/PluginLoader.cs b/Api/Utility/PluginLoader.cs index 77265c5..939d7c5 100644 --- a/Api/Utility/PluginLoader.cs +++ b/Api/Utility/PluginLoader.cs @@ -13,682 +13,682 @@ namespace Milimoe.FunGame.Core.Api.Utility } - public static PluginLoader LoadPlugins() + public static PluginLoader LoadPlugins(params object[] objs) { PluginLoader loader = new(); - PluginManager.LoadPlugins(loader.Plugins); + PluginManager.LoadPlugins(loader.Plugins, objs); return loader; } - public void OnBeforeConnectEvent(ConnectEventArgs e) + public void OnBeforeConnectEvent(object sender,ConnectEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeConnectEvent(e); + plugin.OnBeforeConnectEvent(sender, e); }); } - public void OnAfterConnectEvent(ConnectEventArgs e) + public void OnAfterConnectEvent(object sender,ConnectEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterConnectEvent(e); + plugin.OnAfterConnectEvent(sender, e); }); } - public void OnSucceedConnectEvent(ConnectEventArgs e) + public void OnSucceedConnectEvent(object sender,ConnectEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedConnectEvent(e); + plugin.OnSucceedConnectEvent(sender, e); }); } - public void OnFailedConnectEvent(ConnectEventArgs e) + public void OnFailedConnectEvent(object sender,ConnectEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedConnectEvent(e); + plugin.OnFailedConnectEvent(sender, e); }); } - public void OnBeforeDisconnectEvent(GeneralEventArgs e) + public void OnBeforeDisconnectEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeDisconnectEvent(e); + plugin.OnBeforeDisconnectEvent(sender, e); }); } - public void OnAfterDisconnectEvent(GeneralEventArgs e) + public void OnAfterDisconnectEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterDisconnectEvent(e); + plugin.OnAfterDisconnectEvent(sender, e); }); } - public void OnSucceedDisconnectEvent(GeneralEventArgs e) + public void OnSucceedDisconnectEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedDisconnectEvent(e); + plugin.OnSucceedDisconnectEvent(sender, e); }); } - public void OnFailedDisconnectEvent(GeneralEventArgs e) + public void OnFailedDisconnectEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedDisconnectEvent(e); + plugin.OnFailedDisconnectEvent(sender, e); }); } - public void OnBeforeLoginEvent(LoginEventArgs e) + public void OnBeforeLoginEvent(object sender,LoginEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeLoginEvent(e); + plugin.OnBeforeLoginEvent(sender, e); }); } - public void OnAfterLoginEvent(LoginEventArgs e) + public void OnAfterLoginEvent(object sender,LoginEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterLoginEvent(e); + plugin.OnAfterLoginEvent(sender, e); }); } - public void OnSucceedLoginEvent(LoginEventArgs e) + public void OnSucceedLoginEvent(object sender,LoginEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedLoginEvent(e); + plugin.OnSucceedLoginEvent(sender, e); }); } - public void OnFailedLoginEvent(LoginEventArgs e) + public void OnFailedLoginEvent(object sender,LoginEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedLoginEvent(e); + plugin.OnFailedLoginEvent(sender, e); }); } - public void OnBeforeLogoutEvent(GeneralEventArgs e) + public void OnBeforeLogoutEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeLogoutEvent(e); + plugin.OnBeforeLogoutEvent(sender, e); }); } - public void OnAfterLogoutEvent(GeneralEventArgs e) + public void OnAfterLogoutEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterLogoutEvent(e); + plugin.OnAfterLogoutEvent(sender, e); }); } - public void OnSucceedLogoutEvent(GeneralEventArgs e) + public void OnSucceedLogoutEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedLogoutEvent(e); + plugin.OnSucceedLogoutEvent(sender, e); }); } - public void OnFailedLogoutEvent(GeneralEventArgs e) + public void OnFailedLogoutEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedLogoutEvent(e); + plugin.OnFailedLogoutEvent(sender, e); }); } - public void OnBeforeRegEvent(RegisterEventArgs e) + public void OnBeforeRegEvent(object sender,RegisterEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeRegEvent(e); + plugin.OnBeforeRegEvent(sender, e); }); } - public void OnAfterRegEvent(RegisterEventArgs e) + public void OnAfterRegEvent(object sender,RegisterEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterRegEvent(e); + plugin.OnAfterRegEvent(sender, e); }); } - public void OnSucceedRegEvent(RegisterEventArgs e) + public void OnSucceedRegEvent(object sender,RegisterEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedRegEvent(e); + plugin.OnSucceedRegEvent(sender, e); }); } - public void OnFailedRegEvent(RegisterEventArgs e) + public void OnFailedRegEvent(object sender,RegisterEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedRegEvent(e); + plugin.OnFailedRegEvent(sender, e); }); } - public void OnBeforeIntoRoomEvent(RoomEventArgs e) + public void OnBeforeIntoRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeIntoRoomEvent(e); + plugin.OnBeforeIntoRoomEvent(sender, e); }); } - public void OnAfterIntoRoomEvent(RoomEventArgs e) + public void OnAfterIntoRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterIntoRoomEvent(e); + plugin.OnAfterIntoRoomEvent(sender, e); }); } - public void OnSucceedIntoRoomEvent(RoomEventArgs e) + public void OnSucceedIntoRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedIntoRoomEvent(e); + plugin.OnSucceedIntoRoomEvent(sender, e); }); } - public void OnFailedIntoRoomEvent(RoomEventArgs e) + public void OnFailedIntoRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedIntoRoomEvent(e); + plugin.OnFailedIntoRoomEvent(sender, e); }); } - public void OnBeforeSendTalkEvent(SendTalkEventArgs e) + public void OnBeforeSendTalkEvent(object sender,SendTalkEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeSendTalkEvent(e); + plugin.OnBeforeSendTalkEvent(sender, e); }); } - public void OnAfterSendTalkEvent(SendTalkEventArgs e) + public void OnAfterSendTalkEvent(object sender,SendTalkEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterSendTalkEvent(e); + plugin.OnAfterSendTalkEvent(sender, e); }); } - public void OnSucceedSendTalkEvent(SendTalkEventArgs e) + public void OnSucceedSendTalkEvent(object sender,SendTalkEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedSendTalkEvent(e); + plugin.OnSucceedSendTalkEvent(sender, e); }); } - public void OnFailedSendTalkEvent(SendTalkEventArgs e) + public void OnFailedSendTalkEvent(object sender,SendTalkEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedSendTalkEvent(e); + plugin.OnFailedSendTalkEvent(sender, e); }); } - public void OnBeforeCreateRoomEvent(RoomEventArgs e) + public void OnBeforeCreateRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeCreateRoomEvent(e); + plugin.OnBeforeCreateRoomEvent(sender, e); }); } - public void OnAfterCreateRoomEvent(RoomEventArgs e) + public void OnAfterCreateRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterCreateRoomEvent(e); + plugin.OnAfterCreateRoomEvent(sender, e); }); } - public void OnSucceedCreateRoomEvent(RoomEventArgs e) + public void OnSucceedCreateRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedCreateRoomEvent(e); + plugin.OnSucceedCreateRoomEvent(sender, e); }); } - public void OnFailedCreateRoomEvent(RoomEventArgs e) + public void OnFailedCreateRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedCreateRoomEvent(e); + plugin.OnFailedCreateRoomEvent(sender, e); }); } - public void OnBeforeQuitRoomEvent(RoomEventArgs e) + public void OnBeforeQuitRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeQuitRoomEvent(e); + plugin.OnBeforeQuitRoomEvent(sender, e); }); } - public void OnAfterQuitRoomEvent(RoomEventArgs e) + public void OnAfterQuitRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterQuitRoomEvent(e); + plugin.OnAfterQuitRoomEvent(sender, e); }); } - public void OnSucceedQuitRoomEvent(RoomEventArgs e) + public void OnSucceedQuitRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedQuitRoomEvent(e); + plugin.OnSucceedQuitRoomEvent(sender, e); }); } - public void OnFailedQuitRoomEvent(RoomEventArgs e) + public void OnFailedQuitRoomEvent(object sender,RoomEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedQuitRoomEvent(e); + plugin.OnFailedQuitRoomEvent(sender, e); }); } - public void OnBeforeChangeRoomSettingEvent(GeneralEventArgs e) + public void OnBeforeChangeRoomSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeChangeRoomSettingEvent(e); + plugin.OnBeforeChangeRoomSettingEvent(sender, e); }); } - public void OnAfterChangeRoomSettingEvent(GeneralEventArgs e) + public void OnAfterChangeRoomSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterChangeRoomSettingEvent(e); + plugin.OnAfterChangeRoomSettingEvent(sender, e); }); } - public void OnSucceedChangeRoomSettingEvent(GeneralEventArgs e) + public void OnSucceedChangeRoomSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedChangeRoomSettingEvent(e); + plugin.OnSucceedChangeRoomSettingEvent(sender, e); }); } - public void OnFailedChangeRoomSettingEvent(GeneralEventArgs e) + public void OnFailedChangeRoomSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedChangeRoomSettingEvent(e); + plugin.OnFailedChangeRoomSettingEvent(sender, e); }); } - public void OnBeforeStartMatchEvent(GeneralEventArgs e) + public void OnBeforeStartMatchEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeStartMatchEvent(e); + plugin.OnBeforeStartMatchEvent(sender, e); }); } - public void OnAfterStartMatchEvent(GeneralEventArgs e) + public void OnAfterStartMatchEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterStartMatchEvent(e); + plugin.OnAfterStartMatchEvent(sender, e); }); } - public void OnSucceedStartMatchEvent(GeneralEventArgs e) + public void OnSucceedStartMatchEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedStartMatchEvent(e); + plugin.OnSucceedStartMatchEvent(sender, e); }); } - public void OnFailedStartMatchEvent(GeneralEventArgs e) + public void OnFailedStartMatchEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedStartMatchEvent(e); + plugin.OnFailedStartMatchEvent(sender, e); }); } - public void OnBeforeStartGameEvent(GeneralEventArgs e) + public void OnBeforeStartGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeStartGameEvent(e); + plugin.OnBeforeStartGameEvent(sender, e); }); } - public void OnAfterStartGameEvent(GeneralEventArgs e) + public void OnAfterStartGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterStartGameEvent(e); + plugin.OnAfterStartGameEvent(sender, e); }); } - public void OnSucceedStartGameEvent(GeneralEventArgs e) + public void OnSucceedStartGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedStartGameEvent(e); + plugin.OnSucceedStartGameEvent(sender, e); }); } - public void OnFailedStartGameEvent(GeneralEventArgs e) + public void OnFailedStartGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedStartGameEvent(e); + plugin.OnFailedStartGameEvent(sender, e); }); } - public void OnBeforeChangeProfileEvent(GeneralEventArgs e) + public void OnBeforeChangeProfileEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeChangeProfileEvent(e); + plugin.OnBeforeChangeProfileEvent(sender, e); }); } - public void OnAfterChangeProfileEvent(GeneralEventArgs e) + public void OnAfterChangeProfileEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterChangeProfileEvent(e); + plugin.OnAfterChangeProfileEvent(sender, e); }); } - public void OnSucceedChangeProfileEvent(GeneralEventArgs e) + public void OnSucceedChangeProfileEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedChangeProfileEvent(e); + plugin.OnSucceedChangeProfileEvent(sender, e); }); } - public void OnFailedChangeProfileEvent(GeneralEventArgs e) + public void OnFailedChangeProfileEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedChangeProfileEvent(e); + plugin.OnFailedChangeProfileEvent(sender, e); }); } - public void OnBeforeChangeAccountSettingEvent(GeneralEventArgs e) + public void OnBeforeChangeAccountSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeChangeAccountSettingEvent(e); + plugin.OnBeforeChangeAccountSettingEvent(sender, e); }); } - public void OnAfterChangeAccountSettingEvent(GeneralEventArgs e) + public void OnAfterChangeAccountSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterChangeAccountSettingEvent(e); + plugin.OnAfterChangeAccountSettingEvent(sender, e); }); } - public void OnSucceedChangeAccountSettingEvent(GeneralEventArgs e) + public void OnSucceedChangeAccountSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedChangeAccountSettingEvent(e); + plugin.OnSucceedChangeAccountSettingEvent(sender, e); }); } - public void OnFailedChangeAccountSettingEvent(GeneralEventArgs e) + public void OnFailedChangeAccountSettingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedChangeAccountSettingEvent(e); + plugin.OnFailedChangeAccountSettingEvent(sender, e); }); } - public void OnBeforeOpenInventoryEvent(GeneralEventArgs e) + public void OnBeforeOpenInventoryEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeOpenInventoryEvent(e); + plugin.OnBeforeOpenInventoryEvent(sender, e); }); } - public void OnAfterOpenInventoryEvent(GeneralEventArgs e) + public void OnAfterOpenInventoryEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterOpenInventoryEvent(e); + plugin.OnAfterOpenInventoryEvent(sender, e); }); } - public void OnSucceedOpenInventoryEvent(GeneralEventArgs e) + public void OnSucceedOpenInventoryEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedOpenInventoryEvent(e); + plugin.OnSucceedOpenInventoryEvent(sender, e); }); } - public void OnFailedOpenInventoryEvent(GeneralEventArgs e) + public void OnFailedOpenInventoryEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedOpenInventoryEvent(e); + plugin.OnFailedOpenInventoryEvent(sender, e); }); } - public void OnBeforeSignInEvent(GeneralEventArgs e) + public void OnBeforeSignInEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeSignInEvent(e); + plugin.OnBeforeSignInEvent(sender, e); }); } - public void OnAfterSignInEvent(GeneralEventArgs e) + public void OnAfterSignInEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterSignInEvent(e); + plugin.OnAfterSignInEvent(sender, e); }); } - public void OnSucceedSignInEvent(GeneralEventArgs e) + public void OnSucceedSignInEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedSignInEvent(e); + plugin.OnSucceedSignInEvent(sender, e); }); } - public void OnFailedSignInEvent(GeneralEventArgs e) + public void OnFailedSignInEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedSignInEvent(e); + plugin.OnFailedSignInEvent(sender, e); }); } - public void OnBeforeOpenStoreEvent(GeneralEventArgs e) + public void OnBeforeOpenStoreEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeOpenStoreEvent(e); + plugin.OnBeforeOpenStoreEvent(sender, e); }); } - public void OnAfterOpenStoreEvent(GeneralEventArgs e) + public void OnAfterOpenStoreEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterOpenStoreEvent(e); + plugin.OnAfterOpenStoreEvent(sender, e); }); } - public void OnSucceedOpenStoreEvent(GeneralEventArgs e) + public void OnSucceedOpenStoreEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedOpenStoreEvent(e); + plugin.OnSucceedOpenStoreEvent(sender, e); }); } - public void OnFailedOpenStoreEvent(GeneralEventArgs e) + public void OnFailedOpenStoreEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedOpenStoreEvent(e); + plugin.OnFailedOpenStoreEvent(sender, e); }); } - public void OnBeforeBuyItemEvent(GeneralEventArgs e) + public void OnBeforeBuyItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeBuyItemEvent(e); + plugin.OnBeforeBuyItemEvent(sender, e); }); } - public void OnAfterBuyItemEvent(GeneralEventArgs e) + public void OnAfterBuyItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterBuyItemEvent(e); + plugin.OnAfterBuyItemEvent(sender, e); }); } - public void OnSucceedBuyItemEvent(GeneralEventArgs e) + public void OnSucceedBuyItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedBuyItemEvent(e); + plugin.OnSucceedBuyItemEvent(sender, e); }); } - public void OnFailedBuyItemEvent(GeneralEventArgs e) + public void OnFailedBuyItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedBuyItemEvent(e); + plugin.OnFailedBuyItemEvent(sender, e); }); } - public void OnBeforeShowRankingEvent(GeneralEventArgs e) + public void OnBeforeShowRankingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeShowRankingEvent(e); + plugin.OnBeforeShowRankingEvent(sender, e); }); } - public void OnAfterShowRankingEvent(GeneralEventArgs e) + public void OnAfterShowRankingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterShowRankingEvent(e); + plugin.OnAfterShowRankingEvent(sender, e); }); } - public void OnSucceedShowRankingEvent(GeneralEventArgs e) + public void OnSucceedShowRankingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedShowRankingEvent(e); + plugin.OnSucceedShowRankingEvent(sender, e); }); } - public void OnFailedShowRankingEvent(GeneralEventArgs e) + public void OnFailedShowRankingEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedShowRankingEvent(e); + plugin.OnFailedShowRankingEvent(sender, e); }); } - public void OnBeforeUseItemEvent(GeneralEventArgs e) + public void OnBeforeUseItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeUseItemEvent(e); + plugin.OnBeforeUseItemEvent(sender, e); }); } - public void OnAfterUseItemEvent(GeneralEventArgs e) + public void OnAfterUseItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterUseItemEvent(e); + plugin.OnAfterUseItemEvent(sender, e); }); } - public void OnSucceedUseItemEvent(GeneralEventArgs e) + public void OnSucceedUseItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedUseItemEvent(e); + plugin.OnSucceedUseItemEvent(sender, e); }); } - public void OnFailedUseItemEvent(GeneralEventArgs e) + public void OnFailedUseItemEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedUseItemEvent(e); + plugin.OnFailedUseItemEvent(sender, e); }); } - public void OnBeforeEndGameEvent(GeneralEventArgs e) + public void OnBeforeEndGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnBeforeEndGameEvent(e); + plugin.OnBeforeEndGameEvent(sender, e); }); } - public void OnAfterEndGameEvent(GeneralEventArgs e) + public void OnAfterEndGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnAfterEndGameEvent(e); + plugin.OnAfterEndGameEvent(sender, e); }); } - public void OnSucceedEndGameEvent(GeneralEventArgs e) + public void OnSucceedEndGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnSucceedEndGameEvent(e); + plugin.OnSucceedEndGameEvent(sender, e); }); } - public void OnFailedEndGameEvent(GeneralEventArgs e) + public void OnFailedEndGameEvent(object sender,GeneralEventArgs e) { Parallel.ForEach(Plugins.Values, plugin => { - plugin.OnFailedEndGameEvent(e); + plugin.OnFailedEndGameEvent(sender, e); }); } } diff --git a/Interface/Base/IPlugin.cs b/Interface/Base/IPlugin.cs index 1b307c3..b4954d8 100644 --- a/Interface/Base/IPlugin.cs +++ b/Interface/Base/IPlugin.cs @@ -9,6 +9,6 @@ public string Version { get; } public string Author { get; } - public bool Load(); + public bool Load(params object[] objs); } } diff --git a/Interface/Event/EventHandlers.cs b/Interface/Event/EventHandlers.cs index 2391b08..b849cc9 100644 --- a/Interface/Event/EventHandlers.cs +++ b/Interface/Event/EventHandlers.cs @@ -25,10 +25,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedConnect; public event FailedEventHandler? FailedConnect; - public void OnBeforeConnectEvent(ConnectEventArgs e); - public void OnAfterConnectEvent(ConnectEventArgs e); - public void OnSucceedConnectEvent(ConnectEventArgs e); - public void OnFailedConnectEvent(ConnectEventArgs e); + public void OnBeforeConnectEvent(object sender,ConnectEventArgs e); + public void OnAfterConnectEvent(object sender,ConnectEventArgs e); + public void OnSucceedConnectEvent(object sender,ConnectEventArgs e); + public void OnFailedConnectEvent(object sender,ConnectEventArgs e); } public interface IDisconnectEventHandler : IEventHandler @@ -38,10 +38,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedDisconnect; public event FailedEventHandler? FailedDisconnect; - public void OnBeforeDisconnectEvent(GeneralEventArgs e); - public void OnAfterDisconnectEvent(GeneralEventArgs e); - public void OnSucceedDisconnectEvent(GeneralEventArgs e); - public void OnFailedDisconnectEvent(GeneralEventArgs e); + public void OnBeforeDisconnectEvent(object sender,GeneralEventArgs e); + public void OnAfterDisconnectEvent(object sender,GeneralEventArgs e); + public void OnSucceedDisconnectEvent(object sender,GeneralEventArgs e); + public void OnFailedDisconnectEvent(object sender,GeneralEventArgs e); } public interface ILoginEventHandler : IEventHandler @@ -56,10 +56,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedLogin; public event FailedEventHandler? FailedLogin; - public void OnBeforeLoginEvent(LoginEventArgs e); - public void OnAfterLoginEvent(LoginEventArgs e); - public void OnSucceedLoginEvent(LoginEventArgs e); - public void OnFailedLoginEvent(LoginEventArgs e); + public void OnBeforeLoginEvent(object sender,LoginEventArgs e); + public void OnAfterLoginEvent(object sender,LoginEventArgs e); + public void OnSucceedLoginEvent(object sender,LoginEventArgs e); + public void OnFailedLoginEvent(object sender,LoginEventArgs e); } public interface ILogoutEventHandler : IEventHandler @@ -69,10 +69,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedLogout; public event FailedEventHandler? FailedLogout; - public void OnBeforeLogoutEvent(GeneralEventArgs e); - public void OnAfterLogoutEvent(GeneralEventArgs e); - public void OnSucceedLogoutEvent(GeneralEventArgs e); - public void OnFailedLogoutEvent(GeneralEventArgs e); + public void OnBeforeLogoutEvent(object sender,GeneralEventArgs e); + public void OnAfterLogoutEvent(object sender,GeneralEventArgs e); + public void OnSucceedLogoutEvent(object sender,GeneralEventArgs e); + public void OnFailedLogoutEvent(object sender,GeneralEventArgs e); } public interface IRegEventHandler : IEventHandler @@ -87,10 +87,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedReg; public event FailedEventHandler? FailedReg; - public void OnBeforeRegEvent(RegisterEventArgs e); - public void OnAfterRegEvent(RegisterEventArgs e); - public void OnSucceedRegEvent(RegisterEventArgs e); - public void OnFailedRegEvent(RegisterEventArgs e); + public void OnBeforeRegEvent(object sender,RegisterEventArgs e); + public void OnAfterRegEvent(object sender,RegisterEventArgs e); + public void OnSucceedRegEvent(object sender,RegisterEventArgs e); + public void OnFailedRegEvent(object sender,RegisterEventArgs e); } public interface IIntoRoomEventHandler : IEventHandler @@ -105,10 +105,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedIntoRoom; public event FailedEventHandler? FailedIntoRoom; - public void OnBeforeIntoRoomEvent(RoomEventArgs e); - public void OnAfterIntoRoomEvent(RoomEventArgs e); - public void OnSucceedIntoRoomEvent(RoomEventArgs e); - public void OnFailedIntoRoomEvent(RoomEventArgs e); + public void OnBeforeIntoRoomEvent(object sender,RoomEventArgs e); + public void OnAfterIntoRoomEvent(object sender,RoomEventArgs e); + public void OnSucceedIntoRoomEvent(object sender,RoomEventArgs e); + public void OnFailedIntoRoomEvent(object sender,RoomEventArgs e); } public interface ISendTalkEventHandler : IEventHandler @@ -123,10 +123,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedSendTalk; public event FailedEventHandler? FailedSendTalk; - public void OnBeforeSendTalkEvent(SendTalkEventArgs e); - public void OnAfterSendTalkEvent(SendTalkEventArgs e); - public void OnSucceedSendTalkEvent(SendTalkEventArgs e); - public void OnFailedSendTalkEvent(SendTalkEventArgs e); + public void OnBeforeSendTalkEvent(object sender,SendTalkEventArgs e); + public void OnAfterSendTalkEvent(object sender,SendTalkEventArgs e); + public void OnSucceedSendTalkEvent(object sender,SendTalkEventArgs e); + public void OnFailedSendTalkEvent(object sender,SendTalkEventArgs e); } public interface ICreateRoomEventHandler : IEventHandler @@ -141,10 +141,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedCreateRoom; public event FailedEventHandler? FailedCreateRoom; - public void OnBeforeCreateRoomEvent(RoomEventArgs e); - public void OnAfterCreateRoomEvent(RoomEventArgs e); - public void OnSucceedCreateRoomEvent(RoomEventArgs e); - public void OnFailedCreateRoomEvent(RoomEventArgs e); + public void OnBeforeCreateRoomEvent(object sender,RoomEventArgs e); + public void OnAfterCreateRoomEvent(object sender,RoomEventArgs e); + public void OnSucceedCreateRoomEvent(object sender,RoomEventArgs e); + public void OnFailedCreateRoomEvent(object sender,RoomEventArgs e); } public interface IQuitRoomEventHandler : IEventHandler @@ -159,10 +159,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedQuitRoom; public event FailedEventHandler? FailedQuitRoom; - public void OnBeforeQuitRoomEvent(RoomEventArgs e); - public void OnAfterQuitRoomEvent(RoomEventArgs e); - public void OnSucceedQuitRoomEvent(RoomEventArgs e); - public void OnFailedQuitRoomEvent(RoomEventArgs e); + public void OnBeforeQuitRoomEvent(object sender,RoomEventArgs e); + public void OnAfterQuitRoomEvent(object sender,RoomEventArgs e); + public void OnSucceedQuitRoomEvent(object sender,RoomEventArgs e); + public void OnFailedQuitRoomEvent(object sender,RoomEventArgs e); } public interface IChangeRoomSettingEventHandler : IEventHandler @@ -172,10 +172,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedChangeRoomSetting; public event FailedEventHandler? FailedChangeRoomSetting; - public void OnBeforeChangeRoomSettingEvent(GeneralEventArgs e); - public void OnAfterChangeRoomSettingEvent(GeneralEventArgs e); - public void OnSucceedChangeRoomSettingEvent(GeneralEventArgs e); - public void OnFailedChangeRoomSettingEvent(GeneralEventArgs e); + public void OnBeforeChangeRoomSettingEvent(object sender,GeneralEventArgs e); + public void OnAfterChangeRoomSettingEvent(object sender,GeneralEventArgs e); + public void OnSucceedChangeRoomSettingEvent(object sender,GeneralEventArgs e); + public void OnFailedChangeRoomSettingEvent(object sender,GeneralEventArgs e); } public interface IStartMatchEventHandler : IEventHandler @@ -185,10 +185,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedStartMatch; public event FailedEventHandler? FailedStartMatch; - public void OnBeforeStartMatchEvent(GeneralEventArgs e); - public void OnAfterStartMatchEvent(GeneralEventArgs e); - public void OnSucceedStartMatchEvent(GeneralEventArgs e); - public void OnFailedStartMatchEvent(GeneralEventArgs e); + public void OnBeforeStartMatchEvent(object sender,GeneralEventArgs e); + public void OnAfterStartMatchEvent(object sender,GeneralEventArgs e); + public void OnSucceedStartMatchEvent(object sender,GeneralEventArgs e); + public void OnFailedStartMatchEvent(object sender,GeneralEventArgs e); } public interface IStartGameEventHandler : IEventHandler @@ -198,10 +198,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedStartGame; public event FailedEventHandler? FailedStartGame; - public void OnBeforeStartGameEvent(GeneralEventArgs e); - public void OnAfterStartGameEvent(GeneralEventArgs e); - public void OnSucceedStartGameEvent(GeneralEventArgs e); - public void OnFailedStartGameEvent(GeneralEventArgs e); + public void OnBeforeStartGameEvent(object sender,GeneralEventArgs e); + public void OnAfterStartGameEvent(object sender,GeneralEventArgs e); + public void OnSucceedStartGameEvent(object sender,GeneralEventArgs e); + public void OnFailedStartGameEvent(object sender,GeneralEventArgs e); } public interface IChangeProfileEventHandler : IEventHandler @@ -211,10 +211,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedChangeProfile; public event FailedEventHandler? FailedChangeProfile; - public void OnBeforeChangeProfileEvent(GeneralEventArgs e); - public void OnAfterChangeProfileEvent(GeneralEventArgs e); - public void OnSucceedChangeProfileEvent(GeneralEventArgs e); - public void OnFailedChangeProfileEvent(GeneralEventArgs e); + public void OnBeforeChangeProfileEvent(object sender,GeneralEventArgs e); + public void OnAfterChangeProfileEvent(object sender,GeneralEventArgs e); + public void OnSucceedChangeProfileEvent(object sender,GeneralEventArgs e); + public void OnFailedChangeProfileEvent(object sender,GeneralEventArgs e); } public interface IChangeAccountSettingEventHandler : IEventHandler @@ -224,10 +224,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedChangeAccountSetting; public event FailedEventHandler? FailedChangeAccountSetting; - public void OnBeforeChangeAccountSettingEvent(GeneralEventArgs e); - public void OnAfterChangeAccountSettingEvent(GeneralEventArgs e); - public void OnSucceedChangeAccountSettingEvent(GeneralEventArgs e); - public void OnFailedChangeAccountSettingEvent(GeneralEventArgs e); + public void OnBeforeChangeAccountSettingEvent(object sender,GeneralEventArgs e); + public void OnAfterChangeAccountSettingEvent(object sender,GeneralEventArgs e); + public void OnSucceedChangeAccountSettingEvent(object sender,GeneralEventArgs e); + public void OnFailedChangeAccountSettingEvent(object sender,GeneralEventArgs e); } public interface IOpenInventoryEventHandler : IEventHandler @@ -237,10 +237,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedOpenInventory; public event FailedEventHandler? FailedOpenInventory; - public void OnBeforeOpenInventoryEvent(GeneralEventArgs e); - public void OnAfterOpenInventoryEvent(GeneralEventArgs e); - public void OnSucceedOpenInventoryEvent(GeneralEventArgs e); - public void OnFailedOpenInventoryEvent(GeneralEventArgs e); + public void OnBeforeOpenInventoryEvent(object sender,GeneralEventArgs e); + public void OnAfterOpenInventoryEvent(object sender,GeneralEventArgs e); + public void OnSucceedOpenInventoryEvent(object sender,GeneralEventArgs e); + public void OnFailedOpenInventoryEvent(object sender,GeneralEventArgs e); } public interface ISignInEventHandler : IEventHandler @@ -250,10 +250,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedSignIn; public event FailedEventHandler? FailedSignIn; - public void OnBeforeSignInEvent(GeneralEventArgs e); - public void OnAfterSignInEvent(GeneralEventArgs e); - public void OnSucceedSignInEvent(GeneralEventArgs e); - public void OnFailedSignInEvent(GeneralEventArgs e); + public void OnBeforeSignInEvent(object sender,GeneralEventArgs e); + public void OnAfterSignInEvent(object sender,GeneralEventArgs e); + public void OnSucceedSignInEvent(object sender,GeneralEventArgs e); + public void OnFailedSignInEvent(object sender,GeneralEventArgs e); } public interface IOpenStoreEventHandler : IEventHandler @@ -263,10 +263,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedOpenStore; public event FailedEventHandler? FailedOpenStore; - public void OnBeforeOpenStoreEvent(GeneralEventArgs e); - public void OnAfterOpenStoreEvent(GeneralEventArgs e); - public void OnSucceedOpenStoreEvent(GeneralEventArgs e); - public void OnFailedOpenStoreEvent(GeneralEventArgs e); + public void OnBeforeOpenStoreEvent(object sender,GeneralEventArgs e); + public void OnAfterOpenStoreEvent(object sender,GeneralEventArgs e); + public void OnSucceedOpenStoreEvent(object sender,GeneralEventArgs e); + public void OnFailedOpenStoreEvent(object sender,GeneralEventArgs e); } public interface IBuyItemEventHandler : IEventHandler @@ -276,10 +276,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedBuyItem; public event FailedEventHandler? FailedBuyItem; - public void OnBeforeBuyItemEvent(GeneralEventArgs e); - public void OnAfterBuyItemEvent(GeneralEventArgs e); - public void OnSucceedBuyItemEvent(GeneralEventArgs e); - public void OnFailedBuyItemEvent(GeneralEventArgs e); + public void OnBeforeBuyItemEvent(object sender,GeneralEventArgs e); + public void OnAfterBuyItemEvent(object sender,GeneralEventArgs e); + public void OnSucceedBuyItemEvent(object sender,GeneralEventArgs e); + public void OnFailedBuyItemEvent(object sender,GeneralEventArgs e); } public interface IShowRankingEventHandler : IEventHandler @@ -289,10 +289,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedShowRanking; public event FailedEventHandler? FailedShowRanking; - public void OnBeforeShowRankingEvent(GeneralEventArgs e); - public void OnAfterShowRankingEvent(GeneralEventArgs e); - public void OnSucceedShowRankingEvent(GeneralEventArgs e); - public void OnFailedShowRankingEvent(GeneralEventArgs e); + public void OnBeforeShowRankingEvent(object sender,GeneralEventArgs e); + public void OnAfterShowRankingEvent(object sender,GeneralEventArgs e); + public void OnSucceedShowRankingEvent(object sender,GeneralEventArgs e); + public void OnFailedShowRankingEvent(object sender,GeneralEventArgs e); } public interface IUseItemEventHandler : IEventHandler @@ -302,10 +302,10 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedUseItem; public event FailedEventHandler? FailedUseItem; - public void OnBeforeUseItemEvent(GeneralEventArgs e); - public void OnAfterUseItemEvent(GeneralEventArgs e); - public void OnSucceedUseItemEvent(GeneralEventArgs e); - public void OnFailedUseItemEvent(GeneralEventArgs e); + public void OnBeforeUseItemEvent(object sender,GeneralEventArgs e); + public void OnAfterUseItemEvent(object sender,GeneralEventArgs e); + public void OnSucceedUseItemEvent(object sender,GeneralEventArgs e); + public void OnFailedUseItemEvent(object sender,GeneralEventArgs e); } public interface IEndGameEventHandler : IEventHandler @@ -315,9 +315,9 @@ namespace Milimoe.FunGame.Core.Interface public event SucceedEventHandler? SucceedEndGame; public event FailedEventHandler? FailedEndGame; - public void OnBeforeEndGameEvent(GeneralEventArgs e); - public void OnAfterEndGameEvent(GeneralEventArgs e); - public void OnSucceedEndGameEvent(GeneralEventArgs e); - public void OnFailedEndGameEvent(GeneralEventArgs e); + public void OnBeforeEndGameEvent(object sender,GeneralEventArgs e); + public void OnAfterEndGameEvent(object sender,GeneralEventArgs e); + public void OnSucceedEndGameEvent(object sender,GeneralEventArgs e); + public void OnFailedEndGameEvent(object sender,GeneralEventArgs e); } } diff --git a/Library/Common/Event/RoomEventArgs.cs b/Library/Common/Event/RoomEventArgs.cs index 9579c3d..7cc0c39 100644 --- a/Library/Common/Event/RoomEventArgs.cs +++ b/Library/Common/Event/RoomEventArgs.cs @@ -1,12 +1,15 @@ -using Milimoe.FunGame.Core.Entity; +using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame.Core.Entity; using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Core.Library.Common.Event { public class RoomEventArgs : GeneralEventArgs { + public Room Room { get; set; } = General.HallInstance; public string RoomID { get; set; } = ""; public long RoomMaster { get; set; } = 0; + public string RoomTypeString { get; set; } = GameMode.All; public RoomType RoomType { get; set; } = RoomType.All; public RoomState RoomState { get; set; } = RoomState.Created; public bool HasPassword => Password.Trim() != ""; @@ -14,22 +17,35 @@ namespace Milimoe.FunGame.Core.Library.Common.Event public RoomEventArgs(string RoomType, string Password) { + RoomTypeString = RoomType; this.RoomType = RoomType switch { - GameMode.GameMode_Mix => Constant.RoomType.Mix, - GameMode.GameMode_Team => Constant.RoomType.Team, - GameMode.GameMode_MixHasPass => Constant.RoomType.MixHasPass, - GameMode.GameMode_TeamHasPass => Constant.RoomType.TeamHasPass, + GameMode.Mix => Constant.RoomType.Mix, + GameMode.Team => Constant.RoomType.Team, + GameMode.MixHasPass => Constant.RoomType.MixHasPass, + GameMode.TeamHasPass => Constant.RoomType.TeamHasPass, + GameMode.AllHasPass => Constant.RoomType.AllHasPass, _ => Constant.RoomType.All }; this.Password = Password; + Room = Factory.GetRoom(RoomType: this.RoomType, Password: this.Password); } public RoomEventArgs(Room Room) { + this.Room = Room; RoomID = Room.Roomid; RoomMaster = Room.RoomMaster != null ? Room.RoomMaster.Id : 0; RoomType = Room.RoomType; + RoomTypeString = Room.RoomType switch + { + RoomType.Mix => GameMode.Mix, + RoomType.Team => GameMode.Team, + RoomType.MixHasPass => GameMode.MixHasPass, + RoomType.TeamHasPass => GameMode.TeamHasPass, + RoomType.AllHasPass => GameMode.AllHasPass, + _ => GameMode.All + }; RoomState = Room.RoomState; Password = Room.Password; } diff --git a/Library/Common/Plugin/BasePlugin.cs b/Library/Common/Plugin/BasePlugin.cs index c2825d6..98b78d2 100644 --- a/Library/Common/Plugin/BasePlugin.cs +++ b/Library/Common/Plugin/BasePlugin.cs @@ -1,5 +1,8 @@ -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.Constant; +using Milimoe.FunGame.Core.Model; namespace Milimoe.FunGame.Core.Library.Common.Plugin { @@ -33,7 +36,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Plugin /// /// 加载插件 /// - public bool Load() + public bool Load(params object[] objs) { if (IsLoaded) { @@ -44,6 +47,8 @@ namespace Milimoe.FunGame.Core.Library.Common.Plugin { // 插件加载后,不允许再次加载此插件 IsLoaded = true; + // 初始化此插件(传入委托或者Model) + Init(objs); // 触发绑定事件 BindEvent(); // 如果加载后需要执行代码,请重写AfterLoad方法 @@ -69,6 +74,43 @@ namespace Milimoe.FunGame.Core.Library.Common.Plugin return true; } + /// + /// 传递委托以便让插件调用 + /// + private void Init(params object[] objs) + { + if (objs.Length > 0) WritelnSystemInfo = (Action)objs[0]; + if (objs.Length > 1) NewDataRequest = (Func)objs[1]; + if (objs.Length > 2) NewLongRunningDataRequest = (Func)objs[2]; + if (objs.Length > 3) Session = (Session)objs[3]; + if (objs.Length > 4) Config = (FunGameConfig)objs[4]; + } + + /// + /// 输出系统消息 + /// + protected Action WritelnSystemInfo = new(msg => Console.Write("\r" + msg + "\n\r> ")); + + /// + /// 基于本地已连接的Socket创建新的数据请求 + /// + protected Func NewDataRequest = new(type => throw new ConnectFailedException()); + + /// + /// 基于本地已连接的Socket创建长时间运行的数据请求 + /// + protected Func NewLongRunningDataRequest = new(type => throw new ConnectFailedException()); + + /// + /// Session对象 + /// + protected Session Session = new(); + + /// + /// Config对象 + /// + protected FunGameConfig Config = new(); + /// /// 绑定事件。在后触发 /// @@ -349,424 +391,424 @@ namespace Milimoe.FunGame.Core.Library.Common.Plugin public event IEventHandler.SucceedEventHandler? SucceedEndGame; public event IEventHandler.FailedEventHandler? FailedEndGame; - public void OnBeforeConnectEvent(ConnectEventArgs e) + public void OnBeforeConnectEvent(object sender, ConnectEventArgs e) { - BeforeConnect?.Invoke(this, e); + BeforeConnect?.Invoke(sender, e); } - public void OnAfterConnectEvent(ConnectEventArgs e) + public void OnAfterConnectEvent(object sender, ConnectEventArgs e) { - AfterConnect?.Invoke(this, e); + AfterConnect?.Invoke(sender, e); } - public void OnSucceedConnectEvent(ConnectEventArgs e) + public void OnSucceedConnectEvent(object sender, ConnectEventArgs e) { - SucceedConnect?.Invoke(this, e); + SucceedConnect?.Invoke(sender, e); } - public void OnFailedConnectEvent(ConnectEventArgs e) + public void OnFailedConnectEvent(object sender, ConnectEventArgs e) { - FailedConnect?.Invoke(this, e); + FailedConnect?.Invoke(sender, e); } - public void OnBeforeDisconnectEvent(GeneralEventArgs e) + public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e) { - BeforeDisconnect?.Invoke(this, e); + BeforeDisconnect?.Invoke(sender, e); } - public void OnAfterDisconnectEvent(GeneralEventArgs e) + public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e) { - AfterDisconnect?.Invoke(this, e); + AfterDisconnect?.Invoke(sender, e); } - public void OnSucceedDisconnectEvent(GeneralEventArgs e) + public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e) { - SucceedDisconnect?.Invoke(this, e); + SucceedDisconnect?.Invoke(sender, e); } - public void OnFailedDisconnectEvent(GeneralEventArgs e) + public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e) { - FailedDisconnect?.Invoke(this, e); + FailedDisconnect?.Invoke(sender, e); } - public void OnBeforeLoginEvent(LoginEventArgs e) + public void OnBeforeLoginEvent(object sender, LoginEventArgs e) { - BeforeLogin?.Invoke(this, e); + BeforeLogin?.Invoke(sender, e); } - public void OnAfterLoginEvent(LoginEventArgs e) + public void OnAfterLoginEvent(object sender, LoginEventArgs e) { - AfterLogin?.Invoke(this, e); + AfterLogin?.Invoke(sender, e); } - public void OnSucceedLoginEvent(LoginEventArgs e) + public void OnSucceedLoginEvent(object sender, LoginEventArgs e) { - SucceedLogin?.Invoke(this, e); + SucceedLogin?.Invoke(sender, e); } - public void OnFailedLoginEvent(LoginEventArgs e) + public void OnFailedLoginEvent(object sender, LoginEventArgs e) { - FailedLogin?.Invoke(this, e); + FailedLogin?.Invoke(sender, e); } - public void OnBeforeLogoutEvent(GeneralEventArgs e) + public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e) { - BeforeLogout?.Invoke(this, e); + BeforeLogout?.Invoke(sender, e); } - public void OnAfterLogoutEvent(GeneralEventArgs e) + public void OnAfterLogoutEvent(object sender, GeneralEventArgs e) { - AfterLogout?.Invoke(this, e); + AfterLogout?.Invoke(sender, e); } - public void OnSucceedLogoutEvent(GeneralEventArgs e) + public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e) { - SucceedLogout?.Invoke(this, e); + SucceedLogout?.Invoke(sender, e); } - public void OnFailedLogoutEvent(GeneralEventArgs e) + public void OnFailedLogoutEvent(object sender, GeneralEventArgs e) { - FailedLogout?.Invoke(this, e); + FailedLogout?.Invoke(sender, e); } - public void OnBeforeRegEvent(RegisterEventArgs e) + public void OnBeforeRegEvent(object sender, RegisterEventArgs e) { - BeforeReg?.Invoke(this, e); + BeforeReg?.Invoke(sender, e); } - public void OnAfterRegEvent(RegisterEventArgs e) + public void OnAfterRegEvent(object sender, RegisterEventArgs e) { - AfterReg?.Invoke(this, e); + AfterReg?.Invoke(sender, e); } - public void OnSucceedRegEvent(RegisterEventArgs e) + public void OnSucceedRegEvent(object sender, RegisterEventArgs e) { - SucceedReg?.Invoke(this, e); + SucceedReg?.Invoke(sender, e); } - public void OnFailedRegEvent(RegisterEventArgs e) + public void OnFailedRegEvent(object sender, RegisterEventArgs e) { - FailedReg?.Invoke(this, e); + FailedReg?.Invoke(sender, e); } - public void OnBeforeIntoRoomEvent(RoomEventArgs e) + public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e) { - BeforeIntoRoom?.Invoke(this, e); + BeforeIntoRoom?.Invoke(sender, e); } - public void OnAfterIntoRoomEvent(RoomEventArgs e) + public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e) { - AfterIntoRoom?.Invoke(this, e); + AfterIntoRoom?.Invoke(sender, e); } - public void OnSucceedIntoRoomEvent(RoomEventArgs e) + public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e) { - SucceedIntoRoom?.Invoke(this, e); + SucceedIntoRoom?.Invoke(sender, e); } - public void OnFailedIntoRoomEvent(RoomEventArgs e) + public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e) { - FailedIntoRoom?.Invoke(this, e); + FailedIntoRoom?.Invoke(sender, e); } - public void OnBeforeSendTalkEvent(SendTalkEventArgs e) + public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e) { - BeforeSendTalk?.Invoke(this, e); + BeforeSendTalk?.Invoke(sender, e); } - public void OnAfterSendTalkEvent(SendTalkEventArgs e) + public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e) { - AfterSendTalk?.Invoke(this, e); + AfterSendTalk?.Invoke(sender, e); } - public void OnSucceedSendTalkEvent(SendTalkEventArgs e) + public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e) { - SucceedSendTalk?.Invoke(this, e); + SucceedSendTalk?.Invoke(sender, e); } - public void OnFailedSendTalkEvent(SendTalkEventArgs e) + public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e) { - FailedSendTalk?.Invoke(this, e); + FailedSendTalk?.Invoke(sender, e); } - public void OnBeforeCreateRoomEvent(RoomEventArgs e) + public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e) { - BeforeCreateRoom?.Invoke(this, e); + BeforeCreateRoom?.Invoke(sender, e); } - public void OnAfterCreateRoomEvent(RoomEventArgs e) + public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e) { - AfterCreateRoom?.Invoke(this, e); + AfterCreateRoom?.Invoke(sender, e); } - public void OnSucceedCreateRoomEvent(RoomEventArgs e) + public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e) { - SucceedCreateRoom?.Invoke(this, e); + SucceedCreateRoom?.Invoke(sender, e); } - public void OnFailedCreateRoomEvent(RoomEventArgs e) + public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e) { - FailedCreateRoom?.Invoke(this, e); + FailedCreateRoom?.Invoke(sender, e); } - public void OnBeforeQuitRoomEvent(RoomEventArgs e) + public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e) { - BeforeQuitRoom?.Invoke(this, e); + BeforeQuitRoom?.Invoke(sender, e); } - public void OnAfterQuitRoomEvent(RoomEventArgs e) + public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e) { - AfterQuitRoom?.Invoke(this, e); + AfterQuitRoom?.Invoke(sender, e); } - public void OnSucceedQuitRoomEvent(RoomEventArgs e) + public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e) { - SucceedQuitRoom?.Invoke(this, e); + SucceedQuitRoom?.Invoke(sender, e); } - public void OnFailedQuitRoomEvent(RoomEventArgs e) + public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e) { - FailedQuitRoom?.Invoke(this, e); + FailedQuitRoom?.Invoke(sender, e); } - public void OnBeforeChangeRoomSettingEvent(GeneralEventArgs e) + public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e) { - BeforeChangeRoomSetting?.Invoke(this, e); + BeforeChangeRoomSetting?.Invoke(sender, e); } - public void OnAfterChangeRoomSettingEvent(GeneralEventArgs e) + public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e) { - AfterChangeRoomSetting?.Invoke(this, e); + AfterChangeRoomSetting?.Invoke(sender, e); } - public void OnSucceedChangeRoomSettingEvent(GeneralEventArgs e) + public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e) { - SucceedChangeRoomSetting?.Invoke(this, e); + SucceedChangeRoomSetting?.Invoke(sender, e); } - public void OnFailedChangeRoomSettingEvent(GeneralEventArgs e) + public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e) { - FailedChangeRoomSetting?.Invoke(this, e); + FailedChangeRoomSetting?.Invoke(sender, e); } - public void OnBeforeStartMatchEvent(GeneralEventArgs e) + public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e) { - BeforeStartMatch?.Invoke(this, e); + BeforeStartMatch?.Invoke(sender, e); } - public void OnAfterStartMatchEvent(GeneralEventArgs e) + public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e) { - AfterStartMatch?.Invoke(this, e); + AfterStartMatch?.Invoke(sender, e); } - public void OnSucceedStartMatchEvent(GeneralEventArgs e) + public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e) { - SucceedStartMatch?.Invoke(this, e); + SucceedStartMatch?.Invoke(sender, e); } - public void OnFailedStartMatchEvent(GeneralEventArgs e) + public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e) { - FailedStartMatch?.Invoke(this, e); + FailedStartMatch?.Invoke(sender, e); } - public void OnBeforeStartGameEvent(GeneralEventArgs e) + public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e) { - BeforeStartGame?.Invoke(this, e); + BeforeStartGame?.Invoke(sender, e); } - public void OnAfterStartGameEvent(GeneralEventArgs e) + public void OnAfterStartGameEvent(object sender, GeneralEventArgs e) { - AfterStartGame?.Invoke(this, e); + AfterStartGame?.Invoke(sender, e); } - public void OnSucceedStartGameEvent(GeneralEventArgs e) + public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e) { - SucceedStartGame?.Invoke(this, e); + SucceedStartGame?.Invoke(sender, e); } - public void OnFailedStartGameEvent(GeneralEventArgs e) + public void OnFailedStartGameEvent(object sender, GeneralEventArgs e) { - FailedStartGame?.Invoke(this, e); + FailedStartGame?.Invoke(sender, e); } - public void OnBeforeChangeProfileEvent(GeneralEventArgs e) + public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e) { - BeforeChangeProfile?.Invoke(this, e); + BeforeChangeProfile?.Invoke(sender, e); } - public void OnAfterChangeProfileEvent(GeneralEventArgs e) + public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e) { - AfterChangeProfile?.Invoke(this, e); + AfterChangeProfile?.Invoke(sender, e); } - public void OnSucceedChangeProfileEvent(GeneralEventArgs e) + public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e) { - SucceedChangeProfile?.Invoke(this, e); + SucceedChangeProfile?.Invoke(sender, e); } - public void OnFailedChangeProfileEvent(GeneralEventArgs e) + public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e) { - FailedChangeProfile?.Invoke(this, e); + FailedChangeProfile?.Invoke(sender, e); } - public void OnBeforeChangeAccountSettingEvent(GeneralEventArgs e) + public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e) { - BeforeChangeAccountSetting?.Invoke(this, e); + BeforeChangeAccountSetting?.Invoke(sender, e); } - public void OnAfterChangeAccountSettingEvent(GeneralEventArgs e) + public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e) { - AfterChangeAccountSetting?.Invoke(this, e); + AfterChangeAccountSetting?.Invoke(sender, e); } - public void OnSucceedChangeAccountSettingEvent(GeneralEventArgs e) + public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e) { - SucceedChangeAccountSetting?.Invoke(this, e); + SucceedChangeAccountSetting?.Invoke(sender, e); } - public void OnFailedChangeAccountSettingEvent(GeneralEventArgs e) + public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e) { - FailedChangeAccountSetting?.Invoke(this, e); + FailedChangeAccountSetting?.Invoke(sender, e); } - public void OnBeforeOpenInventoryEvent(GeneralEventArgs e) + public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e) { - BeforeOpenInventory?.Invoke(this, e); + BeforeOpenInventory?.Invoke(sender, e); } - public void OnAfterOpenInventoryEvent(GeneralEventArgs e) + public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e) { - AfterOpenInventory?.Invoke(this, e); + AfterOpenInventory?.Invoke(sender, e); } - public void OnSucceedOpenInventoryEvent(GeneralEventArgs e) + public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e) { - SucceedOpenInventory?.Invoke(this, e); + SucceedOpenInventory?.Invoke(sender, e); } - public void OnFailedOpenInventoryEvent(GeneralEventArgs e) + public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e) { - FailedOpenInventory?.Invoke(this, e); + FailedOpenInventory?.Invoke(sender, e); } - public void OnBeforeSignInEvent(GeneralEventArgs e) + public void OnBeforeSignInEvent(object sender, GeneralEventArgs e) { - BeforeSignIn?.Invoke(this, e); + BeforeSignIn?.Invoke(sender, e); } - public void OnAfterSignInEvent(GeneralEventArgs e) + public void OnAfterSignInEvent(object sender, GeneralEventArgs e) { - AfterSignIn?.Invoke(this, e); + AfterSignIn?.Invoke(sender, e); } - public void OnSucceedSignInEvent(GeneralEventArgs e) + public void OnSucceedSignInEvent(object sender, GeneralEventArgs e) { - SucceedSignIn?.Invoke(this, e); + SucceedSignIn?.Invoke(sender, e); } - public void OnFailedSignInEvent(GeneralEventArgs e) + public void OnFailedSignInEvent(object sender, GeneralEventArgs e) { - FailedSignIn?.Invoke(this, e); + FailedSignIn?.Invoke(sender, e); } - public void OnBeforeOpenStoreEvent(GeneralEventArgs e) + public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e) { - BeforeOpenStore?.Invoke(this, e); + BeforeOpenStore?.Invoke(sender, e); } - public void OnAfterOpenStoreEvent(GeneralEventArgs e) + public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e) { - AfterOpenStore?.Invoke(this, e); + AfterOpenStore?.Invoke(sender, e); } - public void OnSucceedOpenStoreEvent(GeneralEventArgs e) + public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e) { - SucceedOpenStore?.Invoke(this, e); + SucceedOpenStore?.Invoke(sender, e); } - public void OnFailedOpenStoreEvent(GeneralEventArgs e) + public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e) { - FailedOpenStore?.Invoke(this, e); + FailedOpenStore?.Invoke(sender, e); } - public void OnBeforeBuyItemEvent(GeneralEventArgs e) + public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e) { - BeforeBuyItem?.Invoke(this, e); + BeforeBuyItem?.Invoke(sender, e); } - public void OnAfterBuyItemEvent(GeneralEventArgs e) + public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e) { - AfterBuyItem?.Invoke(this, e); + AfterBuyItem?.Invoke(sender, e); } - public void OnSucceedBuyItemEvent(GeneralEventArgs e) + public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e) { - SucceedBuyItem?.Invoke(this, e); + SucceedBuyItem?.Invoke(sender, e); } - public void OnFailedBuyItemEvent(GeneralEventArgs e) + public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e) { - FailedBuyItem?.Invoke(this, e); + FailedBuyItem?.Invoke(sender, e); } - public void OnBeforeShowRankingEvent(GeneralEventArgs e) + public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e) { - BeforeShowRanking?.Invoke(this, e); + BeforeShowRanking?.Invoke(sender, e); } - public void OnAfterShowRankingEvent(GeneralEventArgs e) + public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e) { - AfterShowRanking?.Invoke(this, e); + AfterShowRanking?.Invoke(sender, e); } - public void OnSucceedShowRankingEvent(GeneralEventArgs e) + public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e) { - SucceedShowRanking?.Invoke(this, e); + SucceedShowRanking?.Invoke(sender, e); } - public void OnFailedShowRankingEvent(GeneralEventArgs e) + public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e) { - FailedShowRanking?.Invoke(this, e); + FailedShowRanking?.Invoke(sender, e); } - public void OnBeforeUseItemEvent(GeneralEventArgs e) + public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e) { - BeforeUseItem?.Invoke(this, e); + BeforeUseItem?.Invoke(sender, e); } - public void OnAfterUseItemEvent(GeneralEventArgs e) + public void OnAfterUseItemEvent(object sender, GeneralEventArgs e) { - AfterUseItem?.Invoke(this, e); + AfterUseItem?.Invoke(sender, e); } - public void OnSucceedUseItemEvent(GeneralEventArgs e) + public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e) { - SucceedUseItem?.Invoke(this, e); + SucceedUseItem?.Invoke(sender, e); } - public void OnFailedUseItemEvent(GeneralEventArgs e) + public void OnFailedUseItemEvent(object sender, GeneralEventArgs e) { - FailedUseItem?.Invoke(this, e); + FailedUseItem?.Invoke(sender, e); } - public void OnBeforeEndGameEvent(GeneralEventArgs e) + public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e) { - BeforeEndGame?.Invoke(this, e); + BeforeEndGame?.Invoke(sender, e); } - public void OnAfterEndGameEvent(GeneralEventArgs e) + public void OnAfterEndGameEvent(object sender, GeneralEventArgs e) { - AfterEndGame?.Invoke(this, e); + AfterEndGame?.Invoke(sender, e); } - public void OnSucceedEndGameEvent(GeneralEventArgs e) + public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e) { - SucceedEndGame?.Invoke(this, e); + SucceedEndGame?.Invoke(sender, e); } - public void OnFailedEndGameEvent(GeneralEventArgs e) + public void OnFailedEndGameEvent(object sender, GeneralEventArgs e) { - FailedEndGame?.Invoke(this, e); + FailedEndGame?.Invoke(sender, e); } } } diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs index 124f596..fa6c895 100644 --- a/Library/Constant/ConstantSet.cs +++ b/Library/Constant/ConstantSet.cs @@ -102,11 +102,11 @@ namespace Milimoe.FunGame.Core.Library.Constant public class GameMode { - public const string GameMode_All = "所有模式"; - public const string GameMode_AllHasPass = "带密码的所有模式"; - public const string GameMode_Mix = "混战模式"; - public const string GameMode_MixHasPass = "带密码的混战模式"; - public const string GameMode_Team = "团队模式"; - public const string GameMode_TeamHasPass = "带密码的团队模式"; + public const string All = "所有模式"; + public const string AllHasPass = "带密码的所有模式"; + public const string Mix = "混战模式"; + public const string MixHasPass = "带密码的混战模式"; + public const string Team = "团队模式"; + public const string TeamHasPass = "带密码的团队模式"; } } diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs index 0fb5f9c..a5be9ee 100644 --- a/Library/Constant/TypeEnum.cs +++ b/Library/Constant/TypeEnum.cs @@ -32,6 +32,7 @@ namespace Milimoe.FunGame.Core.Library.Constant All, Mix, Team, + AllHasPass, MixHasPass, TeamHasPass } diff --git a/Model/FunGameConfig.cs b/Model/FunGameConfig.cs index 11b851b..a1c972c 100644 --- a/Model/FunGameConfig.cs +++ b/Model/FunGameConfig.cs @@ -37,7 +37,7 @@ namespace Milimoe.FunGame.Core.Model /// /// 当前游戏模式 /// - public string FunGame_GameMode { get; set; } = GameMode.GameMode_Mix; + public string FunGame_GameMode { get; set; } = GameMode.Mix; /// /// 服务器名称 diff --git a/Service/PluginManager.cs b/Service/PluginManager.cs index ed75f14..9cfd8e7 100644 --- a/Service/PluginManager.cs +++ b/Service/PluginManager.cs @@ -10,7 +10,7 @@ namespace Milimoe.FunGame.Core.Service /// /// /// - internal static Dictionary LoadPlugins(Dictionary plugins) + internal static Dictionary LoadPlugins(Dictionary plugins, params object[] objs) { string[] dlls = Directory.GetFiles("plugins", "*.dll"); @@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Service foreach (Type type in assembly.GetTypes().AsEnumerable().Where(type => type.IsSubclassOf(typeof(BasePlugin)))) { BasePlugin? instance = (BasePlugin?)Activator.CreateInstance(type); - if (instance != null && instance.Load()) + if (instance != null && instance.Load(objs)) { plugins.TryAdd(instance.Name, instance); }