You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

343 lines
13 KiB

using System;
using System.Collections.Generic;
using ProtoCSStruct;
using Sog;
namespace Game
{
public class EventHandlerMgr : BaseReloadableService
{
public override int GetServiceType()
{
return GameServiceType.EventHandlerMgr;
}
public override void Dispose()
{
//清空所有事件
TriggerPlayerOnline = null;
TriggerPlayerOffline = null;
TriggerPlayerDisconnected = null;
TriggerPlayerReOnline = null;
TriggerPlayerBorn = null;
TriggerNewDayStart = null;
TriggerDailyStatisticsChanged = null;
TriggerTotalStatisticsChanged = null;
TriggerReloadConfig = null;
TriggerPlayerPaySuccess = null;
TriggerPlayerAddLevel = null;
TriggerTaskexHandoverComplete = null;
}
/// <summary>
/// 上线,第一次
/// </summary>
/// <param name="player"></param>
public delegate void PlayerOnlineEvent(PlayerOnGame player);
public PlayerOnlineEvent TriggerPlayerOnline;
/// <summary>
/// 上线之后同步协议用
/// </summary>
/// <param name="player"></param>
public delegate void PlayerOnlineAfterEvent(PlayerOnGame player);
public PlayerOnlineAfterEvent TriggerPlayerOnlineAfter;
/// <summary>
/// 断线了,这个在Offline之前有可能触发
/// </summary>
/// <param name="player"></param>
public delegate void PlayerDisconnectedEvent(PlayerOnGame player);
public PlayerDisconnectedEvent TriggerPlayerDisconnected;
/// <summary>
/// 下线,断线后一段时间,可配置,一般是5分钟
/// </summary>
/// <param name="player"></param>
public delegate void PlayerOfflineEvent(PlayerOnGame player);
public PlayerOfflineEvent TriggerPlayerOffline;
/// <summary>
/// 重新上线
/// </summary>
/// <param name="player"></param>
public delegate void PlayerReOnlineEvent(PlayerOnGame player);
public PlayerReOnlineEvent TriggerPlayerReOnline;
/// <summary>
/// 出生
/// </summary>
public delegate void PlayerBornEvent(PlayerOnGame player);
public PlayerBornEvent TriggerPlayerBorn;
/// <summary>
/// 新的一天开始
/// </summary>
/// <param name="player"></param>
public delegate void NewDayStartEvent(PlayerOnGame player, bool notifyClient);
public NewDayStartEvent TriggerNewDayStart;
/// <summary>
/// 每日统计数据改变
/// </summary>
/// <param name="player"></param>
public delegate void DailyStatisticsChangedEvent(PlayerOnGame player, int statid, long newValue, long change);
public DailyStatisticsChangedEvent TriggerDailyStatisticsChanged;
/// <summary>
/// 总共统计数据改变
/// </summary>
/// <param name="player"></param>
public delegate void TotalStatisticsChangedEvent(PlayerOnGame player, int statid, long newValue, long change);
public TotalStatisticsChangedEvent TriggerTotalStatisticsChanged;
/// <summary>
/// 服务器配置被重新加载
/// </summary>
/// <param name="player"></param>
public delegate void ReloadConfigEvent(string excelConfigFile);
public ReloadConfigEvent TriggerReloadConfig;
/// <summary>
/// 充值成功,payDiamond表示充值的钻石(原价,附送的不算)
/// </summary>
public delegate void PlayerPaySuccessEvent(PlayerOnGame player, int itemId,
uint payDiamond, uint addDiamond, uint money, bool isPlayerFirstPay, long payTime3rd, ref CSPayGoogleSuccessRes csRes);
public PlayerPaySuccessEvent TriggerPlayerPaySuccess;
/// <summary>
/// 升玩家等级
/// </summary>
/// <param name="player"></param>
public delegate void PlayerAddLevel(PlayerOnGame player);
public PlayerAddLevel TriggerPlayerAddLevel;
public delegate void Addhero(PlayerOnGame player, int nHereDescID, int nNewStarLev, string reason);
public Addhero TriggerAddhero;
/// <summary>
/// 任务交付成功后
/// </summary>
/// <param name="player"></param>
/// <param name="desc"></param>
public delegate void TaskexHandoverComplete(PlayerOnGame player, QuestEXDesc desc);
public TaskexHandoverComplete TriggerTaskexHandoverComplete;
public delegate void OnDataVersionChange(PlayerOnGame player);
public OnDataVersionChange TriggerDataVersionChange;
public delegate void OnHeroPowerChanged(PlayerOnGame player, long power);
public OnHeroPowerChanged TriggerHeroPowerChanged;
// 赠送好友礼物
public delegate void OnSendFriendGift(PlayerOnGame player, int num);
public OnSendFriendGift TriggerSendFriendGift;
public delegate void ClientUseGM(PlayerOnGame player);
public ClientUseGM OnClientUseGM;
public delegate void OnSystemUnlock(PlayerOnGame player, int id);
public OnSystemUnlock TriggerSystemUnlock;
/// <summary>
/// 收集角色属性
/// </summary>
/// <param name="player"></param>
/// <param name="roleProp"></param>
public delegate void GetPlayerModuleProps(ref DBRoleData roleDat, RoleProp roleProp);
public GetPlayerModuleProps TriggerGetPlayerModuleProps;
public void RegisterAllEventHandler()
{
//online
// 修改状态作为第一个online事件
TriggerPlayerOnline += GameServerUtils.GetPlayerDataSvc().OnPlayerOnline;
TriggerPlayerOnline += PatchSvc.PatchAll;
TriggerPlayerOnline += SystemUnlockEvent.OnRoleEnter;
TriggerPlayerOnline += MailSvc.OnPlayerOnline;
TriggerPlayerOnline += PayCommSvc.OnPlayerOnline;
TriggerPlayerOnline += ClientBitFlagSvc.OnPlayerOnline;
TriggerPlayerOnline += PlayerTickSvc.OnPlayerOnline;
TriggerPlayerOnline += MarketShopEvent.OnPlayerOnline;
TriggerPlayerOnline += TaskEXEvent.TriggerPlayerLogin;
TriggerPlayerOnline += PlayerDataSvc.WritePlayerServer;
TriggerPlayerOnline += StatisticsOp.OnPlayerOnline;
TriggerPlayerOnline += LoginHandler.OnPlayerOnlineSyncPlayerInfoToOpSvr;
TriggerPlayerOnline += EquipmentSvc.OnPlayerOnline;
TriggerPlayerOnline += PlayerDataSvc.OnRoleEnter;
TriggerPlayerOnline += ChapterSvc.OnEnter;
TriggerPlayerOnline += WxFriendRankSvc.OnPlayerOnLine;
TriggerPlayerOnline += SkinSvc.OnPlayerOnline;
TriggerPlayerOnline += PopPackageSvc.OnRoleEnter;
// 运营日志上报放到最后一个事件, 其他事件加到该事件前面
TriggerPlayerOnline += OperationLogSvc.OnPlayerOnline;
TriggerPlayerOnline += ReturnSvc.OnPlayerOnline;
//reonline
TriggerPlayerReOnline += GameServerUtils.GetPlayerDataSvc().OnPlayerReOnline;
TriggerPlayerReOnline += PatchSvc.PatchAll;
TriggerPlayerReOnline += TaskEXEvent.TriggerPlayerLogin;
TriggerPlayerReOnline += SystemUnlockEvent.OnRoleEnter;
TriggerPlayerReOnline += BeginnerGuideEvent.OnRoleEnter;
TriggerPlayerReOnline += PlayerDataSvc.OnRoleEnter;
TriggerPlayerReOnline += ActivityTick.OnRoleEnter;
TriggerPlayerReOnline += ChapterSvc.OnReEnter;
TriggerPlayerReOnline += RecruitSvc.OnEnter;
TriggerPlayerReOnline += FistPaymentEvent.OnEnter;
TriggerPlayerReOnline += WingSvc.OnEnter;
TriggerPlayerReOnline += PopPackageSvc.OnRoleEnter;
//offline
TriggerPlayerOffline += GameServerUtils.GetPlayerDataSvc().OnPlayerOffline;
TriggerPlayerOffline += ChapterSvc.OnOffline;
//TriggerPlayerOnlineAfter
TriggerPlayerOnlineAfter += SystemUnlockEvent.OnRoleEnter;
TriggerPlayerOnlineAfter += BeginnerGuideEvent.OnRoleEnter;
TriggerPlayerOnlineAfter += HomeAdEvent.OnRoleEnter;
TriggerPlayerOnlineAfter += ActivityTick.OnRoleEnter;
TriggerPlayerOnlineAfter += RecruitSvc.OnEnter;
TriggerPlayerOnlineAfter += FistPaymentEvent.OnEnter;
TriggerPlayerOnlineAfter += WingSvc.OnEnter;
TriggerPlayerOnlineAfter += FreeRewardSvc.OnEnter;
TriggerPlayerOnlineAfter += PopPackageSvc.OnRoleEnter;
//born
TriggerPlayerBorn += TaskEXEvent.TiggerPlayerBornEvent; // 要保证任务的出生委托最先执行
TriggerPlayerBorn += GameServerUtils.GetPlayerDataSvc().OnPlayerBorn;
TriggerPlayerBorn += IconFrameSvc.TiggerPlayerBornEvent;
TriggerPlayerBorn += SystemUnlockEvent.OnPlayerBorn;
TriggerPlayerBorn += FistPaymentEvent.OnPlayerBorn;
TriggerPlayerBorn += ChapterSvc.OnPlayerBorn;
TriggerPlayerBorn += WingSvc.OnPlayerBorn;
TriggerPlayerBorn += CBattleSvc.OnBurn;
TriggerPlayerBorn += TalentSvc.OnPlayerBorn;
TriggerPlayerBorn += PlayerPresetSvc.PlayerBorn;
TriggerPlayerBorn += FreeRewardSvc.PlayerBorn;
//newday
TriggerNewDayStart += HomeAdEvent.OnNewDay;
TriggerNewDayStart += TaskEXSvc.OnNewDay;
TriggerNewDayStart += PayCommSvc.OnNewDayStart;
TriggerNewDayStart += TaskEXEvent.TiggerNewDayStart;
TriggerNewDayStart += HomeAdEvent.OnNewDayStart;
TriggerNewDayStart += MarketShopSvc.OnNewDayStart;
TriggerNewDayStart += PlayerDataSvc.OnNewDay;
TriggerNewDayStart += SystemUnlockEvent.OnNewDay;
TriggerNewDayStart += CBattleSvc.OnNewDay;
TriggerNewDayStart += FreeRewardSvc.OnNewDay;
TriggerNewDayStart += PopPackageSvc.OnNewDayStart;
//TriggerFocusfacebook
//TriggerDailyStatisticsChanged
TriggerDailyStatisticsChanged += FriendSvc.OnDailyStatisticsChanged;
//TriggerTotalStatisticsChanged
TriggerTotalStatisticsChanged += PayCommSvc.OnTotalStatisticsChanged;
//TriggerPlayerSuccess
TriggerPlayerPaySuccess += TaskEXEvent.TriggerPaySuccess;
TriggerPlayerPaySuccess += HomeAdEvent.OnBuySuccess;
TriggerPlayerPaySuccess += MonthlyCardSvc.OnBuySuccess;
TriggerPlayerPaySuccess += PlayerDataSvc.OnBuySuccess;
TriggerPlayerPaySuccess += BattlePassSvc.OnBuySuccess;
TriggerPlayerPaySuccess += SignSvc.OnBuySuccess;
TriggerPlayerPaySuccess += FistPaymentEvent.OnBuySuccess;
//升级
TriggerPlayerAddLevel += GameServerUtils.GetPlayerDataSvc().OnPlayerAddLevel;
TriggerPlayerAddLevel += SystemUnlockEvent.OnLevelChange;
TriggerPlayerAddLevel += PayCommSvc.OnPlayerLevelUp;
TriggerPlayerAddLevel += MarketShopEvent.OnPlayerLevelUp;
TriggerPlayerAddLevel += PlayerNotify.NotifyWorldPlayerRolebaseChangeUpdate; //通知union
TriggerPlayerAddLevel += LevelSvc.OnLevelUp;
//vip等级
//英雄强化
//任务事件
//副本事件(主要是首次通关)
TriggerAddhero += PayCommSvc.OnAddHero;
TriggerTaskexHandoverComplete += SystemUnlockEvent.OnMissionComplete;
//使用GM
OnClientUseGM += SystemUnlockEvent.OnUseGM;
TriggerSystemUnlock += MarketShopEvent.OnSystemUnlock;
TriggerSystemUnlock += PlayerDataSvc.OnSystemUnlock;
TriggerSystemUnlock += ActivityTick.OnSystemUnlock;
TriggerSystemUnlock += WingSvc.OnSystemUnlock;
//注意先后顺序
TriggerDataVersionChange += PlayerDataVersionUpdate.UpdateVersionAll;
//收集属性
TriggerGetPlayerModuleProps += EquipmentSvc.CollectEquipProp;
TriggerGetPlayerModuleProps += LevelSvc.CalcLevelProps;
TriggerGetPlayerModuleProps += SkinSvc.CalcSkinProps;
TriggerGetPlayerModuleProps += GemSvc.CollectGemProp;
TriggerGetPlayerModuleProps += GmCmdSvc.CollectGmProp;
TriggerGetPlayerModuleProps += MonthlyCardSvc.CollectMonthlyProp;
TriggerGetPlayerModuleProps += WingSvc.CollectWingProp;
TriggerGetPlayerModuleProps += TalentPeakSvc.CollectProp;
}
}
}