服务器插件、WebAPI插件添加事件触发器;商店相关修改

This commit is contained in:
milimoe 2025-01-22 01:22:25 +08:00
parent a520f7e9b6
commit dab09b9a99
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
8 changed files with 2162 additions and 65 deletions

View File

@ -1,4 +1,5 @@
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Event;
using Milimoe.FunGame.Core.Service;
namespace Milimoe.FunGame.Core.Api.Utility
@ -50,5 +51,677 @@ namespace Milimoe.FunGame.Core.Api.Utility
Plugins.TryAdd(name, value);
}
}
public void OnBeforeConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeConnectEvent(sender, e);
});
}
public void OnAfterConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterConnectEvent(sender, e);
});
}
public void OnSucceedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedConnectEvent(sender, e);
});
}
public void OnFailedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedConnectEvent(sender, e);
});
}
public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeDisconnectEvent(sender, e);
});
}
public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterDisconnectEvent(sender, e);
});
}
public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedDisconnectEvent(sender, e);
});
}
public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedDisconnectEvent(sender, e);
});
}
public void OnBeforeLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeLoginEvent(sender, e);
});
}
public void OnAfterLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterLoginEvent(sender, e);
});
}
public void OnSucceedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedLoginEvent(sender, e);
});
}
public void OnFailedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedLoginEvent(sender, e);
});
}
public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeLogoutEvent(sender, e);
});
}
public void OnAfterLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterLogoutEvent(sender, e);
});
}
public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedLogoutEvent(sender, e);
});
}
public void OnFailedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedLogoutEvent(sender, e);
});
}
public void OnBeforeRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeRegEvent(sender, e);
});
}
public void OnAfterRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterRegEvent(sender, e);
});
}
public void OnSucceedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedRegEvent(sender, e);
});
}
public void OnFailedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedRegEvent(sender, e);
});
}
public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeIntoRoomEvent(sender, e);
});
}
public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterIntoRoomEvent(sender, e);
});
}
public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedIntoRoomEvent(sender, e);
});
}
public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedIntoRoomEvent(sender, e);
});
}
public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeSendTalkEvent(sender, e);
});
}
public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterSendTalkEvent(sender, e);
});
}
public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedSendTalkEvent(sender, e);
});
}
public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedSendTalkEvent(sender, e);
});
}
public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeCreateRoomEvent(sender, e);
});
}
public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterCreateRoomEvent(sender, e);
});
}
public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedCreateRoomEvent(sender, e);
});
}
public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedCreateRoomEvent(sender, e);
});
}
public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeQuitRoomEvent(sender, e);
});
}
public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterQuitRoomEvent(sender, e);
});
}
public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedQuitRoomEvent(sender, e);
});
}
public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedQuitRoomEvent(sender, e);
});
}
public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeRoomSettingEvent(sender, e);
});
}
public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeRoomSettingEvent(sender, e);
});
}
public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeRoomSettingEvent(sender, e);
});
}
public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeRoomSettingEvent(sender, e);
});
}
public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeStartMatchEvent(sender, e);
});
}
public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterStartMatchEvent(sender, e);
});
}
public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedStartMatchEvent(sender, e);
});
}
public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedStartMatchEvent(sender, e);
});
}
public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeStartGameEvent(sender, e);
});
}
public void OnAfterStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterStartGameEvent(sender, e);
});
}
public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedStartGameEvent(sender, e);
});
}
public void OnFailedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedStartGameEvent(sender, e);
});
}
public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeProfileEvent(sender, e);
});
}
public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeProfileEvent(sender, e);
});
}
public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeProfileEvent(sender, e);
});
}
public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeProfileEvent(sender, e);
});
}
public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeAccountSettingEvent(sender, e);
});
}
public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeAccountSettingEvent(sender, e);
});
}
public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeAccountSettingEvent(sender, e);
});
}
public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeAccountSettingEvent(sender, e);
});
}
public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeOpenInventoryEvent(sender, e);
});
}
public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterOpenInventoryEvent(sender, e);
});
}
public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedOpenInventoryEvent(sender, e);
});
}
public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedOpenInventoryEvent(sender, e);
});
}
public void OnBeforeSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeSignInEvent(sender, e);
});
}
public void OnAfterSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterSignInEvent(sender, e);
});
}
public void OnSucceedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedSignInEvent(sender, e);
});
}
public void OnFailedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedSignInEvent(sender, e);
});
}
public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeOpenStoreEvent(sender, e);
});
}
public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterOpenStoreEvent(sender, e);
});
}
public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedOpenStoreEvent(sender, e);
});
}
public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedOpenStoreEvent(sender, e);
});
}
public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeBuyItemEvent(sender, e);
});
}
public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterBuyItemEvent(sender, e);
});
}
public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedBuyItemEvent(sender, e);
});
}
public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedBuyItemEvent(sender, e);
});
}
public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeShowRankingEvent(sender, e);
});
}
public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterShowRankingEvent(sender, e);
});
}
public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedShowRankingEvent(sender, e);
});
}
public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedShowRankingEvent(sender, e);
});
}
public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeUseItemEvent(sender, e);
});
}
public void OnAfterUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterUseItemEvent(sender, e);
});
}
public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedUseItemEvent(sender, e);
});
}
public void OnFailedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedUseItemEvent(sender, e);
});
}
public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeEndGameEvent(sender, e);
});
}
public void OnAfterEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterEndGameEvent(sender, e);
});
}
public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedEndGameEvent(sender, e);
});
}
public void OnFailedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedEndGameEvent(sender, e);
});
}
}
}

View File

@ -1,4 +1,5 @@
using Milimoe.FunGame.Core.Library.Common.Addon;
using Milimoe.FunGame.Core.Library.Common.Event;
using Milimoe.FunGame.Core.Service;
namespace Milimoe.FunGame.Core.Api.Utility
@ -50,5 +51,677 @@ namespace Milimoe.FunGame.Core.Api.Utility
Plugins.TryAdd(name, value);
}
}
public void OnBeforeConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeConnectEvent(sender, e);
});
}
public void OnAfterConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterConnectEvent(sender, e);
});
}
public void OnSucceedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedConnectEvent(sender, e);
});
}
public void OnFailedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedConnectEvent(sender, e);
});
}
public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeDisconnectEvent(sender, e);
});
}
public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterDisconnectEvent(sender, e);
});
}
public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedDisconnectEvent(sender, e);
});
}
public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedDisconnectEvent(sender, e);
});
}
public void OnBeforeLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeLoginEvent(sender, e);
});
}
public void OnAfterLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterLoginEvent(sender, e);
});
}
public void OnSucceedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedLoginEvent(sender, e);
});
}
public void OnFailedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedLoginEvent(sender, e);
});
}
public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeLogoutEvent(sender, e);
});
}
public void OnAfterLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterLogoutEvent(sender, e);
});
}
public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedLogoutEvent(sender, e);
});
}
public void OnFailedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedLogoutEvent(sender, e);
});
}
public void OnBeforeRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeRegEvent(sender, e);
});
}
public void OnAfterRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterRegEvent(sender, e);
});
}
public void OnSucceedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedRegEvent(sender, e);
});
}
public void OnFailedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedRegEvent(sender, e);
});
}
public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeIntoRoomEvent(sender, e);
});
}
public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterIntoRoomEvent(sender, e);
});
}
public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedIntoRoomEvent(sender, e);
});
}
public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedIntoRoomEvent(sender, e);
});
}
public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeSendTalkEvent(sender, e);
});
}
public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterSendTalkEvent(sender, e);
});
}
public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedSendTalkEvent(sender, e);
});
}
public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedSendTalkEvent(sender, e);
});
}
public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeCreateRoomEvent(sender, e);
});
}
public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterCreateRoomEvent(sender, e);
});
}
public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedCreateRoomEvent(sender, e);
});
}
public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedCreateRoomEvent(sender, e);
});
}
public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeQuitRoomEvent(sender, e);
});
}
public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterQuitRoomEvent(sender, e);
});
}
public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedQuitRoomEvent(sender, e);
});
}
public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedQuitRoomEvent(sender, e);
});
}
public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeRoomSettingEvent(sender, e);
});
}
public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeRoomSettingEvent(sender, e);
});
}
public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeRoomSettingEvent(sender, e);
});
}
public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeRoomSettingEvent(sender, e);
});
}
public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeStartMatchEvent(sender, e);
});
}
public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterStartMatchEvent(sender, e);
});
}
public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedStartMatchEvent(sender, e);
});
}
public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedStartMatchEvent(sender, e);
});
}
public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeStartGameEvent(sender, e);
});
}
public void OnAfterStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterStartGameEvent(sender, e);
});
}
public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedStartGameEvent(sender, e);
});
}
public void OnFailedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedStartGameEvent(sender, e);
});
}
public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeProfileEvent(sender, e);
});
}
public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeProfileEvent(sender, e);
});
}
public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeProfileEvent(sender, e);
});
}
public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeProfileEvent(sender, e);
});
}
public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeChangeAccountSettingEvent(sender, e);
});
}
public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterChangeAccountSettingEvent(sender, e);
});
}
public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedChangeAccountSettingEvent(sender, e);
});
}
public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedChangeAccountSettingEvent(sender, e);
});
}
public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeOpenInventoryEvent(sender, e);
});
}
public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterOpenInventoryEvent(sender, e);
});
}
public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedOpenInventoryEvent(sender, e);
});
}
public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedOpenInventoryEvent(sender, e);
});
}
public void OnBeforeSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeSignInEvent(sender, e);
});
}
public void OnAfterSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterSignInEvent(sender, e);
});
}
public void OnSucceedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedSignInEvent(sender, e);
});
}
public void OnFailedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedSignInEvent(sender, e);
});
}
public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeOpenStoreEvent(sender, e);
});
}
public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterOpenStoreEvent(sender, e);
});
}
public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedOpenStoreEvent(sender, e);
});
}
public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedOpenStoreEvent(sender, e);
});
}
public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeBuyItemEvent(sender, e);
});
}
public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterBuyItemEvent(sender, e);
});
}
public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedBuyItemEvent(sender, e);
});
}
public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedBuyItemEvent(sender, e);
});
}
public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeShowRankingEvent(sender, e);
});
}
public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterShowRankingEvent(sender, e);
});
}
public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedShowRankingEvent(sender, e);
});
}
public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedShowRankingEvent(sender, e);
});
}
public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeUseItemEvent(sender, e);
});
}
public void OnAfterUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterUseItemEvent(sender, e);
});
}
public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedUseItemEvent(sender, e);
});
}
public void OnFailedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedUseItemEvent(sender, e);
});
}
public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnBeforeEndGameEvent(sender, e);
});
}
public void OnAfterEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnAfterEndGameEvent(sender, e);
});
}
public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnSucceedEndGameEvent(sender, e);
});
}
public void OnFailedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
plugin.OnFailedEndGameEvent(sender, e);
});
}
}
}

View File

@ -445,6 +445,10 @@ namespace Milimoe.FunGame.Core.Entity
{
builder.AppendLine($"售价:{Price} {General.GameplayEquilibriumConstant.InGameCurrency}");
}
else if (Price > 0)
{
builder.AppendLine($"回收价:{Price} {General.GameplayEquilibriumConstant.InGameCurrency}");
}
if (RemainUseTimes > 0)
{
@ -474,7 +478,7 @@ namespace Milimoe.FunGame.Core.Entity
if (!IsSellable && NextSellableTime != DateTime.MinValue)
{
builder.AppendLine($"此物品将在 {NextSellableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可出售");
sellandtrade.Add($"此物品将在 {NextSellableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可出售");
}
else if (!IsSellable)
{
@ -488,7 +492,7 @@ namespace Milimoe.FunGame.Core.Entity
if (!IsTradable && NextTradableTime != DateTime.MinValue)
{
builder.AppendLine($"此物品将在 {NextTradableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可交易");
sellandtrade.Add($"此物品将在 {NextTradableTime.ToString(General.GeneralDateTimeFormatChinese)} 后可交易");
}
else if (!IsTradable)
{

64
Entity/System/Goods.cs Normal file
View File

@ -0,0 +1,64 @@
using System.Text;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Entity
{
public class Goods
{
public long Id { get; set; } = 0;
public List<Item> Items { get; } = [];
public string Name { get; set; } = "";
public string Description { get; set; } = "";
public Dictionary<string, double> Prices { get; } = [];
public int Stock { get; set; }
public Goods() { }
public Goods(long id, Item item, int stock, string name, string description, Dictionary<string, double>? prices = null)
{
Id = id;
Items.Add(item);
Stock = stock;
Name = name;
Description = description;
if (prices != null) Prices = prices;
}
public Goods(long id, List<Item> items, int stock, string name, string description, Dictionary<string, double>? prices = null)
{
Id = id;
Items = items;
Stock = stock;
Name = name;
Description = description;
if (prices != null) Prices = prices;
}
public override string ToString()
{
StringBuilder builder = new();
builder.AppendLine($"{Id}. {Name}");
builder.AppendLine($"商品描述:{Description}");
builder.AppendLine($"商品售价:{(Prices.Count > 0 ? string.Join("", Prices.Select(kv => $"{kv.Value} {kv.Key}")) : "")}");
builder.AppendLine($"包含物品:{string.Join("", Items.Select(i => $"[{ItemSet.GetQualityTypeName(i.QualityType)}|{ItemSet.GetItemTypeName(i.ItemType)}] {i.Name}"))}");
builder.AppendLine($"剩余库存:{Stock}");
return builder.ToString().Trim();
}
public void SetPrice(string needy, double price)
{
if (price > 0) Prices[needy] = price;
}
public bool GetPrice(string needy, out double price)
{
price = 0;
if (Prices.TryGetValue(needy, out double temp) && temp > 0)
{
price = temp;
return true;
}
return false;
}
}
}

View File

@ -42,13 +42,9 @@ namespace Milimoe.FunGame.Core.Entity
builder.AppendLine($"[ 24H ] 全年无休,永久开放");
}
builder.AppendLine($"☆--- 商品列表 ---☆");
foreach (Goods good in Goods.Values)
foreach (Goods goods in Goods.Values)
{
builder.AppendLine($"{good.Id}. {good.Name}");
builder.AppendLine($"商品描述:{good.Description}");
builder.AppendLine($"商品售价:{string.Join("", good.Prices.Select(kv => $"{kv.Value} {kv.Key}"))}");
builder.AppendLine($"包含物品:{string.Join("", good.Items.Select(i => $"[{ItemSet.GetQualityTypeName(i.QualityType)}|{ItemSet.GetItemTypeName(i.ItemType)}] {i.Name}"))}");
builder.AppendLine($"剩余库存:{good.Stock}");
builder.AppendLine(goods.ToString());
}
return builder.ToString().Trim();
@ -66,10 +62,7 @@ namespace Milimoe.FunGame.Core.Entity
description = item.Description;
}
Goods goods = new(id, item, stock, name, description);
if (item.Price > 0)
{
goods.SetPrice(General.GameplayEquilibriumConstant.InGameCurrency, item.Price);
}
Goods.Add(id, goods);
}
@ -81,57 +74,37 @@ namespace Milimoe.FunGame.Core.Entity
}
}
public void SetPrice(long id, string needy, double price)
{
if (Goods.TryGetValue(id, out Goods? goods) && goods != null)
{
goods.SetPrice(needy, price);
}
}
public bool GetPrice(long id, string needy, out double price)
{
price = 0;
if (Goods.TryGetValue(id, out Goods? goods) && goods != null)
{
return goods.GetPrice(needy, out price);
}
return false;
}
public double GetPrice(long id)
{
double price = 0;
if (Goods.TryGetValue(id, out Goods? goods) && goods != null)
{
goods.GetPrice(General.GameplayEquilibriumConstant.InGameCurrency, out price);
}
return price;
}
public override bool Equals(IBaseEntity? other)
{
return other is Store && other.GetIdName() == GetIdName();
}
}
public class Goods
{
public long Id { get; set; } = 0;
public List<Item> Items { get; } = [];
public string Name { get; set; } = "";
public string Description { get; set; } = "";
public Dictionary<string, double> Prices { get; } = [];
public int Stock { get; set; }
public Goods() { }
public Goods(long id, Item item, int stock, string name, string description, Dictionary<string, double>? prices = null)
{
Id = id;
Items.Add(item);
Stock = stock;
Name = name;
Description = description;
if (prices != null) Prices = prices;
}
public Goods(long id, List<Item> items, int stock, string name, string description, Dictionary<string, double>? prices = null)
{
Id = id;
Items = items;
Stock = stock;
Name = name;
Description = description;
if (prices != null) Prices = prices;
}
public void SetPrice(string needy, double price)
{
Prices[needy] = price;
}
public bool GetPrice(string needy, out double price)
{
price = -1;
if (Prices.TryGetValue(needy, out double temp) && temp > 0)
{
price = temp;
return true;
}
return false;
}
}
}

View File

@ -1,6 +1,8 @@
using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Controller;
using Milimoe.FunGame.Core.Interface;
using Milimoe.FunGame.Core.Interface.Addons;
using Milimoe.FunGame.Core.Library.Common.Event;
namespace Milimoe.FunGame.Core.Library.Common.Addon
{
@ -68,6 +70,8 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
{
// 插件加载后,不允许再次加载此插件
_isLoaded = true;
// 触发绑定事件
BindEvent();
}
return _isLoaded;
}
@ -94,5 +98,705 @@ namespace Milimoe.FunGame.Core.Library.Common.Addon
{
return true;
}
/// <summary>
/// 绑定事件。在<see cref="BeforeLoad"/>后触发
/// </summary>
private void BindEvent()
{
if (this is IConnectEvent)
{
IConnectEvent bind = (IConnectEvent)this;
BeforeConnect += bind.BeforeConnectEvent;
AfterConnect += bind.AfterConnectEvent;
SucceedConnect += bind.SucceedConnectEvent;
FailedConnect += bind.FailedConnectEvent;
}
if (this is IDisconnectEvent)
{
IDisconnectEvent bind = (IDisconnectEvent)this;
BeforeDisconnect += bind.BeforeDisconnectEvent;
AfterDisconnect += bind.AfterDisconnectEvent;
SucceedDisconnect += bind.SucceedDisconnectEvent;
FailedDisconnect += bind.FailedDisconnectEvent;
}
if (this is ILoginEvent)
{
ILoginEvent bind = (ILoginEvent)this;
BeforeLogin += bind.BeforeLoginEvent;
AfterLogin += bind.AfterLoginEvent;
SucceedLogin += bind.SucceedLoginEvent;
FailedLogin += bind.FailedLoginEvent;
}
if (this is ILogoutEvent)
{
ILogoutEvent bind = (ILogoutEvent)this;
BeforeLogout += bind.BeforeLogoutEvent;
AfterLogout += bind.AfterLogoutEvent;
SucceedLogout += bind.SucceedLogoutEvent;
FailedLogout += bind.FailedLogoutEvent;
}
if (this is IRegEvent)
{
IRegEvent bind = (IRegEvent)this;
BeforeReg += bind.BeforeRegEvent;
AfterReg += bind.AfterRegEvent;
SucceedReg += bind.SucceedRegEvent;
FailedReg += bind.FailedRegEvent;
}
if (this is IIntoRoomEvent)
{
IIntoRoomEvent bind = (IIntoRoomEvent)this;
BeforeIntoRoom += bind.BeforeIntoRoomEvent;
AfterIntoRoom += bind.AfterIntoRoomEvent;
SucceedIntoRoom += bind.SucceedIntoRoomEvent;
FailedIntoRoom += bind.FailedIntoRoomEvent;
}
if (this is ISendTalkEvent)
{
ISendTalkEvent bind = (ISendTalkEvent)this;
BeforeSendTalk += bind.BeforeSendTalkEvent;
AfterSendTalk += bind.AfterSendTalkEvent;
SucceedSendTalk += bind.SucceedSendTalkEvent;
FailedSendTalk += bind.FailedSendTalkEvent;
}
if (this is ICreateRoomEvent)
{
ICreateRoomEvent bind = (ICreateRoomEvent)this;
BeforeCreateRoom += bind.BeforeCreateRoomEvent;
AfterCreateRoom += bind.AfterCreateRoomEvent;
SucceedCreateRoom += bind.SucceedCreateRoomEvent;
FailedCreateRoom += bind.FailedCreateRoomEvent;
}
if (this is IQuitRoomEvent)
{
IQuitRoomEvent bind = (IQuitRoomEvent)this;
BeforeQuitRoom += bind.BeforeQuitRoomEvent;
AfterQuitRoom += bind.AfterQuitRoomEvent;
SucceedQuitRoom += bind.SucceedQuitRoomEvent;
FailedQuitRoom += bind.FailedQuitRoomEvent;
}
if (this is IChangeRoomSettingEvent)
{
IChangeRoomSettingEvent bind = (IChangeRoomSettingEvent)this;
BeforeChangeRoomSetting += bind.BeforeChangeRoomSettingEvent;
AfterChangeRoomSetting += bind.AfterChangeRoomSettingEvent;
SucceedChangeRoomSetting += bind.SucceedChangeRoomSettingEvent;
FailedChangeRoomSetting += bind.FailedChangeRoomSettingEvent;
}
if (this is IStartMatchEvent)
{
IStartMatchEvent bind = (IStartMatchEvent)this;
BeforeStartMatch += bind.BeforeStartMatchEvent;
AfterStartMatch += bind.AfterStartMatchEvent;
SucceedStartMatch += bind.SucceedStartMatchEvent;
FailedStartMatch += bind.FailedStartMatchEvent;
}
if (this is IStartGameEvent)
{
IStartGameEvent bind = (IStartGameEvent)this;
BeforeStartGame += bind.BeforeStartGameEvent;
AfterStartGame += bind.AfterStartGameEvent;
SucceedStartGame += bind.SucceedStartGameEvent;
FailedStartGame += bind.FailedStartGameEvent;
}
if (this is IChangeProfileEvent)
{
IChangeProfileEvent bind = (IChangeProfileEvent)this;
BeforeChangeProfile += bind.BeforeChangeProfileEvent;
AfterChangeProfile += bind.AfterChangeProfileEvent;
SucceedChangeProfile += bind.SucceedChangeProfileEvent;
FailedChangeProfile += bind.FailedChangeProfileEvent;
}
if (this is IChangeAccountSettingEvent)
{
IChangeAccountSettingEvent bind = (IChangeAccountSettingEvent)this;
BeforeChangeAccountSetting += bind.BeforeChangeAccountSettingEvent;
AfterChangeAccountSetting += bind.AfterChangeAccountSettingEvent;
SucceedChangeAccountSetting += bind.SucceedChangeAccountSettingEvent;
FailedChangeAccountSetting += bind.FailedChangeAccountSettingEvent;
}
if (this is IOpenInventoryEvent)
{
IOpenInventoryEvent bind = (IOpenInventoryEvent)this;
BeforeOpenInventory += bind.BeforeOpenInventoryEvent;
AfterOpenInventory += bind.AfterOpenInventoryEvent;
SucceedOpenInventory += bind.SucceedOpenInventoryEvent;
FailedOpenInventory += bind.FailedOpenInventoryEvent;
}
if (this is ISignInEvent)
{
ISignInEvent bind = (ISignInEvent)this;
BeforeSignIn += bind.BeforeSignInEvent;
AfterSignIn += bind.AfterSignInEvent;
SucceedSignIn += bind.SucceedSignInEvent;
FailedSignIn += bind.FailedSignInEvent;
}
if (this is IOpenStoreEvent)
{
IOpenStoreEvent bind = (IOpenStoreEvent)this;
BeforeOpenStore += bind.BeforeOpenStoreEvent;
AfterOpenStore += bind.AfterOpenStoreEvent;
SucceedOpenStore += bind.SucceedOpenStoreEvent;
FailedOpenStore += bind.FailedOpenStoreEvent;
}
if (this is IBuyItemEvent)
{
IBuyItemEvent bind = (IBuyItemEvent)this;
BeforeBuyItem += bind.BeforeBuyItemEvent;
AfterBuyItem += bind.AfterBuyItemEvent;
SucceedBuyItem += bind.SucceedBuyItemEvent;
FailedBuyItem += bind.FailedBuyItemEvent;
}
if (this is IShowRankingEvent)
{
IShowRankingEvent bind = (IShowRankingEvent)this;
BeforeShowRanking += bind.BeforeShowRankingEvent;
AfterShowRanking += bind.AfterShowRankingEvent;
SucceedShowRanking += bind.SucceedShowRankingEvent;
FailedShowRanking += bind.FailedShowRankingEvent;
}
if (this is IUseItemEvent)
{
IUseItemEvent bind = (IUseItemEvent)this;
BeforeUseItem += bind.BeforeUseItemEvent;
AfterUseItem += bind.AfterUseItemEvent;
SucceedUseItem += bind.SucceedUseItemEvent;
FailedUseItem += bind.FailedUseItemEvent;
}
if (this is IEndGameEvent)
{
IEndGameEvent bind = (IEndGameEvent)this;
BeforeEndGame += bind.BeforeEndGameEvent;
AfterEndGame += bind.AfterEndGameEvent;
SucceedEndGame += bind.SucceedEndGameEvent;
FailedEndGame += bind.FailedEndGameEvent;
}
}
public event IConnectEventHandler.BeforeEventHandler? BeforeConnect;
public event IConnectEventHandler.AfterEventHandler? AfterConnect;
public event IConnectEventHandler.SucceedEventHandler? SucceedConnect;
public event IConnectEventHandler.FailedEventHandler? FailedConnect;
public event IEventHandler.BeforeEventHandler? BeforeDisconnect;
public event IEventHandler.AfterEventHandler? AfterDisconnect;
public event IEventHandler.SucceedEventHandler? SucceedDisconnect;
public event IEventHandler.FailedEventHandler? FailedDisconnect;
public event ILoginEventHandler.BeforeEventHandler? BeforeLogin;
public event ILoginEventHandler.AfterEventHandler? AfterLogin;
public event ILoginEventHandler.SucceedEventHandler? SucceedLogin;
public event ILoginEventHandler.FailedEventHandler? FailedLogin;
public event IEventHandler.BeforeEventHandler? BeforeLogout;
public event IEventHandler.AfterEventHandler? AfterLogout;
public event IEventHandler.SucceedEventHandler? SucceedLogout;
public event IEventHandler.FailedEventHandler? FailedLogout;
public event IRegEventHandler.BeforeEventHandler? BeforeReg;
public event IRegEventHandler.AfterEventHandler? AfterReg;
public event IRegEventHandler.SucceedEventHandler? SucceedReg;
public event IRegEventHandler.FailedEventHandler? FailedReg;
public event IIntoRoomEventHandler.BeforeEventHandler? BeforeIntoRoom;
public event IIntoRoomEventHandler.AfterEventHandler? AfterIntoRoom;
public event IIntoRoomEventHandler.SucceedEventHandler? SucceedIntoRoom;
public event IIntoRoomEventHandler.FailedEventHandler? FailedIntoRoom;
public event ISendTalkEventHandler.BeforeEventHandler? BeforeSendTalk;
public event ISendTalkEventHandler.AfterEventHandler? AfterSendTalk;
public event ISendTalkEventHandler.SucceedEventHandler? SucceedSendTalk;
public event ISendTalkEventHandler.FailedEventHandler? FailedSendTalk;
public event ICreateRoomEventHandler.BeforeEventHandler? BeforeCreateRoom;
public event ICreateRoomEventHandler.AfterEventHandler? AfterCreateRoom;
public event ICreateRoomEventHandler.SucceedEventHandler? SucceedCreateRoom;
public event ICreateRoomEventHandler.FailedEventHandler? FailedCreateRoom;
public event IQuitRoomEventHandler.BeforeEventHandler? BeforeQuitRoom;
public event IQuitRoomEventHandler.AfterEventHandler? AfterQuitRoom;
public event IQuitRoomEventHandler.SucceedEventHandler? SucceedQuitRoom;
public event IQuitRoomEventHandler.FailedEventHandler? FailedQuitRoom;
public event IEventHandler.BeforeEventHandler? BeforeChangeRoomSetting;
public event IEventHandler.AfterEventHandler? AfterChangeRoomSetting;
public event IEventHandler.SucceedEventHandler? SucceedChangeRoomSetting;
public event IEventHandler.FailedEventHandler? FailedChangeRoomSetting;
public event IEventHandler.BeforeEventHandler? BeforeStartMatch;
public event IEventHandler.AfterEventHandler? AfterStartMatch;
public event IEventHandler.SucceedEventHandler? SucceedStartMatch;
public event IEventHandler.FailedEventHandler? FailedStartMatch;
public event IEventHandler.BeforeEventHandler? BeforeStartGame;
public event IEventHandler.AfterEventHandler? AfterStartGame;
public event IEventHandler.SucceedEventHandler? SucceedStartGame;
public event IEventHandler.FailedEventHandler? FailedStartGame;
public event IEventHandler.BeforeEventHandler? BeforeChangeProfile;
public event IEventHandler.AfterEventHandler? AfterChangeProfile;
public event IEventHandler.SucceedEventHandler? SucceedChangeProfile;
public event IEventHandler.FailedEventHandler? FailedChangeProfile;
public event IEventHandler.BeforeEventHandler? BeforeChangeAccountSetting;
public event IEventHandler.AfterEventHandler? AfterChangeAccountSetting;
public event IEventHandler.SucceedEventHandler? SucceedChangeAccountSetting;
public event IEventHandler.FailedEventHandler? FailedChangeAccountSetting;
public event IEventHandler.BeforeEventHandler? BeforeOpenInventory;
public event IEventHandler.AfterEventHandler? AfterOpenInventory;
public event IEventHandler.SucceedEventHandler? SucceedOpenInventory;
public event IEventHandler.FailedEventHandler? FailedOpenInventory;
public event IEventHandler.BeforeEventHandler? BeforeSignIn;
public event IEventHandler.AfterEventHandler? AfterSignIn;
public event IEventHandler.SucceedEventHandler? SucceedSignIn;
public event IEventHandler.FailedEventHandler? FailedSignIn;
public event IEventHandler.BeforeEventHandler? BeforeOpenStore;
public event IEventHandler.AfterEventHandler? AfterOpenStore;
public event IEventHandler.SucceedEventHandler? SucceedOpenStore;
public event IEventHandler.FailedEventHandler? FailedOpenStore;
public event IEventHandler.BeforeEventHandler? BeforeBuyItem;
public event IEventHandler.AfterEventHandler? AfterBuyItem;
public event IEventHandler.SucceedEventHandler? SucceedBuyItem;
public event IEventHandler.FailedEventHandler? FailedBuyItem;
public event IEventHandler.BeforeEventHandler? BeforeShowRanking;
public event IEventHandler.AfterEventHandler? AfterShowRanking;
public event IEventHandler.SucceedEventHandler? SucceedShowRanking;
public event IEventHandler.FailedEventHandler? FailedShowRanking;
public event IEventHandler.BeforeEventHandler? BeforeUseItem;
public event IEventHandler.AfterEventHandler? AfterUseItem;
public event IEventHandler.SucceedEventHandler? SucceedUseItem;
public event IEventHandler.FailedEventHandler? FailedUseItem;
public event IEventHandler.BeforeEventHandler? BeforeEndGame;
public event IEventHandler.AfterEventHandler? AfterEndGame;
public event IEventHandler.SucceedEventHandler? SucceedEndGame;
public event IEventHandler.FailedEventHandler? FailedEndGame;
public void OnBeforeConnectEvent(object sender, ConnectEventArgs e)
{
BeforeConnect?.Invoke(sender, e);
}
public void OnAfterConnectEvent(object sender, ConnectEventArgs e)
{
AfterConnect?.Invoke(sender, e);
}
public void OnSucceedConnectEvent(object sender, ConnectEventArgs e)
{
SucceedConnect?.Invoke(sender, e);
}
public void OnFailedConnectEvent(object sender, ConnectEventArgs e)
{
FailedConnect?.Invoke(sender, e);
}
public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e)
{
BeforeDisconnect?.Invoke(sender, e);
}
public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e)
{
AfterDisconnect?.Invoke(sender, e);
}
public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e)
{
SucceedDisconnect?.Invoke(sender, e);
}
public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e)
{
FailedDisconnect?.Invoke(sender, e);
}
public void OnBeforeLoginEvent(object sender, LoginEventArgs e)
{
BeforeLogin?.Invoke(sender, e);
}
public void OnAfterLoginEvent(object sender, LoginEventArgs e)
{
AfterLogin?.Invoke(sender, e);
}
public void OnSucceedLoginEvent(object sender, LoginEventArgs e)
{
SucceedLogin?.Invoke(sender, e);
}
public void OnFailedLoginEvent(object sender, LoginEventArgs e)
{
FailedLogin?.Invoke(sender, e);
}
public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e)
{
BeforeLogout?.Invoke(sender, e);
}
public void OnAfterLogoutEvent(object sender, GeneralEventArgs e)
{
AfterLogout?.Invoke(sender, e);
}
public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e)
{
SucceedLogout?.Invoke(sender, e);
}
public void OnFailedLogoutEvent(object sender, GeneralEventArgs e)
{
FailedLogout?.Invoke(sender, e);
}
public void OnBeforeRegEvent(object sender, RegisterEventArgs e)
{
BeforeReg?.Invoke(sender, e);
}
public void OnAfterRegEvent(object sender, RegisterEventArgs e)
{
AfterReg?.Invoke(sender, e);
}
public void OnSucceedRegEvent(object sender, RegisterEventArgs e)
{
SucceedReg?.Invoke(sender, e);
}
public void OnFailedRegEvent(object sender, RegisterEventArgs e)
{
FailedReg?.Invoke(sender, e);
}
public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e)
{
BeforeIntoRoom?.Invoke(sender, e);
}
public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e)
{
AfterIntoRoom?.Invoke(sender, e);
}
public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e)
{
SucceedIntoRoom?.Invoke(sender, e);
}
public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e)
{
FailedIntoRoom?.Invoke(sender, e);
}
public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e)
{
BeforeSendTalk?.Invoke(sender, e);
}
public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e)
{
AfterSendTalk?.Invoke(sender, e);
}
public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e)
{
SucceedSendTalk?.Invoke(sender, e);
}
public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e)
{
FailedSendTalk?.Invoke(sender, e);
}
public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e)
{
BeforeCreateRoom?.Invoke(sender, e);
}
public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e)
{
AfterCreateRoom?.Invoke(sender, e);
}
public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e)
{
SucceedCreateRoom?.Invoke(sender, e);
}
public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e)
{
FailedCreateRoom?.Invoke(sender, e);
}
public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e)
{
BeforeQuitRoom?.Invoke(sender, e);
}
public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e)
{
AfterQuitRoom?.Invoke(sender, e);
}
public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e)
{
SucceedQuitRoom?.Invoke(sender, e);
}
public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e)
{
FailedQuitRoom?.Invoke(sender, e);
}
public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
BeforeChangeRoomSetting?.Invoke(sender, e);
}
public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
AfterChangeRoomSetting?.Invoke(sender, e);
}
public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
SucceedChangeRoomSetting?.Invoke(sender, e);
}
public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
FailedChangeRoomSetting?.Invoke(sender, e);
}
public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e)
{
BeforeStartMatch?.Invoke(sender, e);
}
public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e)
{
AfterStartMatch?.Invoke(sender, e);
}
public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e)
{
SucceedStartMatch?.Invoke(sender, e);
}
public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e)
{
FailedStartMatch?.Invoke(sender, e);
}
public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e)
{
BeforeStartGame?.Invoke(sender, e);
}
public void OnAfterStartGameEvent(object sender, GeneralEventArgs e)
{
AfterStartGame?.Invoke(sender, e);
}
public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e)
{
SucceedStartGame?.Invoke(sender, e);
}
public void OnFailedStartGameEvent(object sender, GeneralEventArgs e)
{
FailedStartGame?.Invoke(sender, e);
}
public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e)
{
BeforeChangeProfile?.Invoke(sender, e);
}
public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e)
{
AfterChangeProfile?.Invoke(sender, e);
}
public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e)
{
SucceedChangeProfile?.Invoke(sender, e);
}
public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e)
{
FailedChangeProfile?.Invoke(sender, e);
}
public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
BeforeChangeAccountSetting?.Invoke(sender, e);
}
public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
AfterChangeAccountSetting?.Invoke(sender, e);
}
public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
SucceedChangeAccountSetting?.Invoke(sender, e);
}
public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
FailedChangeAccountSetting?.Invoke(sender, e);
}
public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e)
{
BeforeOpenInventory?.Invoke(sender, e);
}
public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e)
{
AfterOpenInventory?.Invoke(sender, e);
}
public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
SucceedOpenInventory?.Invoke(sender, e);
}
public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
FailedOpenInventory?.Invoke(sender, e);
}
public void OnBeforeSignInEvent(object sender, GeneralEventArgs e)
{
BeforeSignIn?.Invoke(sender, e);
}
public void OnAfterSignInEvent(object sender, GeneralEventArgs e)
{
AfterSignIn?.Invoke(sender, e);
}
public void OnSucceedSignInEvent(object sender, GeneralEventArgs e)
{
SucceedSignIn?.Invoke(sender, e);
}
public void OnFailedSignInEvent(object sender, GeneralEventArgs e)
{
FailedSignIn?.Invoke(sender, e);
}
public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e)
{
BeforeOpenStore?.Invoke(sender, e);
}
public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e)
{
AfterOpenStore?.Invoke(sender, e);
}
public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e)
{
SucceedOpenStore?.Invoke(sender, e);
}
public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e)
{
FailedOpenStore?.Invoke(sender, e);
}
public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e)
{
BeforeBuyItem?.Invoke(sender, e);
}
public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e)
{
AfterBuyItem?.Invoke(sender, e);
}
public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e)
{
SucceedBuyItem?.Invoke(sender, e);
}
public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e)
{
FailedBuyItem?.Invoke(sender, e);
}
public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e)
{
BeforeShowRanking?.Invoke(sender, e);
}
public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e)
{
AfterShowRanking?.Invoke(sender, e);
}
public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e)
{
SucceedShowRanking?.Invoke(sender, e);
}
public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e)
{
FailedShowRanking?.Invoke(sender, e);
}
public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e)
{
BeforeUseItem?.Invoke(sender, e);
}
public void OnAfterUseItemEvent(object sender, GeneralEventArgs e)
{
AfterUseItem?.Invoke(sender, e);
}
public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e)
{
SucceedUseItem?.Invoke(sender, e);
}
public void OnFailedUseItemEvent(object sender, GeneralEventArgs e)
{
FailedUseItem?.Invoke(sender, e);
}
public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e)
{
BeforeEndGame?.Invoke(sender, e);
}
public void OnAfterEndGameEvent(object sender, GeneralEventArgs e)
{
AfterEndGame?.Invoke(sender, e);
}
public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e)
{
SucceedEndGame?.Invoke(sender, e);
}
public void OnFailedEndGameEvent(object sender, GeneralEventArgs e)
{
FailedEndGame?.Invoke(sender, e);
}
}
}

View File

@ -3,10 +3,10 @@
public class GeneralEventArgs : EventArgs
{
public string EventMsg { get; set; } = "";
public object[] Parameters { get; set; } = Array.Empty<object>();
public Dictionary<string, object> Parameters { get; set; } = [];
public bool Cancel { get; set; } = false;
public GeneralEventArgs(string EventMsg, object[] Parameters)
public GeneralEventArgs(string EventMsg, Dictionary<string, object> Parameters)
{
this.EventMsg = EventMsg;
this.Parameters = Parameters;
@ -14,7 +14,11 @@
public GeneralEventArgs(params object[] Parameters)
{
this.Parameters = Parameters;
int count = 0;
foreach (object obj in Parameters)
{
this.Parameters[count++.ToString()] = obj;
}
}
}

View File

@ -81,16 +81,18 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
return $"{Command_Update} {TableName} {Command_Set} {Column_GameTime} = {Column_GameTime} + @GameTimeMinutes {Command_Where} {Column_Username} = @Username";
}
public static string Insert_Register(SQLHelper SQLHelper, string Username, string Password, string Email, string IP)
public static string Insert_Register(SQLHelper SQLHelper, string Username, string Password, string Email, string IP, string AutoKey = "")
{
DateTime Now = DateTime.Now;
SQLHelper.Parameters["@Username"] = Username;
SQLHelper.Parameters["@Nickname"] = Username;
SQLHelper.Parameters["@Password"] = Password;
SQLHelper.Parameters["@Email"] = Email;
SQLHelper.Parameters["@RegTime"] = Now;
SQLHelper.Parameters["@LastTime"] = Now;
SQLHelper.Parameters["@LastIP"] = IP;
return $"{Command_Insert} {Command_Into} {TableName} ({Column_Username}, {Column_Password}, {Column_Email}, {Column_RegTime}, {Column_LastTime}, {Column_LastIP}) {Command_Values} (@Username, @Password, @Email, @RegTime, @LastTime, @LastIP)";
if (AutoKey != "") SQLHelper.Parameters["@AutoKey"] = AutoKey;
return $"{Command_Insert} {Command_Into} {TableName} ({Column_Username}, {Column_Nickname}, {Column_Password}, {Column_Email}, {Column_RegTime}, {Column_LastTime}, {Column_LastIP}, {Column_AutoKey}) {Command_Values} (@Username, @Nickname, @Password, @Email, @RegTime, @LastTime, @LastIP, @AutoKey)";
}
}
}