public void EventCallBackHandler(int eventType, params object[] args) { try { switch (eventType) { case (int)KuaFuEventTypes.SpreadCount: { if (args.Length == 5) { int zoneID = (int)args[0]; int roleID = (int)args[1]; int countRole = (int)args[2]; int countVip = (int)args[3]; int countLevle = (int)args[4]; KFSpreadData data; //如果取到数据,证明已经注册说了 if (!_RoleId2KFSpreadDataDict.TryGetValue(roleID, out data)) { return; } lock (data) { data.CountRole = countRole; data.CountVip = countVip; data.CountLevel = countLevle; data.UpdateLogtime(); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifySpreadCountGameEvent(zoneID, roleID, countRole, countVip, countLevle), (int)_sceneType); } } } break; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
public void EventCallBackHandler(int eventType, params object[] args) { try { switch (eventType) { case (int)KuaFuEventTypes.NotifyWaitingRoleCount: { if (args.Length == 2) { int rid = (int)args[0]; int count = (int)args[1]; CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuFuBenRoleCountEvent(rid, count), SceneType); } } break; case (int)KuaFuEventTypes.RoleSignUp: case (int)KuaFuEventTypes.RoleStateChange: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); } } } break; case (int)KuaFuEventTypes.UpdateAndNotifyEnterGame: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); TianTiFuBenData TianTiFuBenData = GetKuaFuFuBenData(kuaFuRoleData.GameId); if (null != TianTiFuBenData && TianTiFuBenData.State == GameFuBenState.Start) { KuaFuServerLoginData kuaFuServerLoginData = new KuaFuServerLoginData() { RoleId = kuaFuRoleData.RoleId, GameType = kuaFuRoleData.GameType, GameId = kuaFuRoleData.GameId, EndTicks = kuaFuRoleData.StateEndTicks, }; kuaFuServerLoginData.ServerId = ClientInfo.ServerId; lock (Mutex) { KuaFuServerInfo kuaFuServerInfo; if (ServerIdServerInfoDict.TryGetValue(TianTiFuBenData.ServerId, out kuaFuServerInfo)) { kuaFuServerLoginData.ServerIp = kuaFuServerInfo.Ip; kuaFuServerLoginData.ServerPort = kuaFuServerInfo.Port; } } CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuNotifyEnterGameEvent(kuaFuServerLoginData), SceneType); } } } } break; case (int)KuaFuEventTypes.ZhengBaSupport: { ZhengBaSupportLogData data = args[0] as ZhengBaSupportLogData; if (null != data && data.FromServerId != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent(new KFZhengBaSupportEvent(data), (int)SceneUIClasses.KFZhengBa); } } break; case (int)KuaFuEventTypes.ZhengBaPkLog: { if (args.Length == 1) { ZhengBaPkLogData log = args[0] as ZhengBaPkLogData; if (log != null) { CoreInterface.GetEventSourceInterface().fireEvent(new KFZhengBaPkLogEvent(log), (int)SceneUIClasses.KFZhengBa); } } } break; case (int)KuaFuEventTypes.ZhengBaNtfEnter: { ZhengBaNtfEnterData data = args[0] as ZhengBaNtfEnterData; lock (Mutex) { KuaFuServerInfo kuaFuServerInfo; if (ServerIdServerInfoDict.TryGetValue(data.ToServerId, out kuaFuServerInfo)) { data.ToServerIp = kuaFuServerInfo.Ip; data.ToServerPort = kuaFuServerInfo.Port; } else { LogManager.WriteLog(LogTypes.Error, string.Format("KuaFuEventTypes.ZhengBaNtfEnter not find kfserver={0}", data.ToServerId)); } } CoreInterface.GetEventSourceInterface().fireEvent(new KFZhengBaNtfEnterEvent(data), (int)SceneUIClasses.KFZhengBa); } break; case (int)KuaFuEventTypes.ZhengBaMirrorFight: { ZhengBaMirrorFightData data = args[0] as ZhengBaMirrorFightData; CoreInterface.GetEventSourceInterface().fireEvent(new KFZhengBaMirrorFightEvent(data), (int)SceneUIClasses.KFZhengBa); } break; case (int)KuaFuEventTypes.ZhengBaButtetinJoin: { ZhengBaBulletinJoinData data = args[0] as ZhengBaBulletinJoinData; CoreInterface.GetEventSourceInterface().fireEvent(new KFZhengBaBulletinJoinEvent(data), (int)SceneUIClasses.KFZhengBa); } break; case (int)KuaFuEventTypes.CoupleArenaCanEnter: { CoreInterface.GetEventSourceInterface().fireEvent( new CoupleArenaCanEnterEvent(args[0] as CoupleArenaCanEnterData), (int)SceneUIClasses.CoupleArena); } break; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
public void EventCallBackHandler(int eventType, params object[] args) { try { switch (eventType) { case (int)KuaFuEventTypes.RoleSignUp: case (int)KuaFuEventTypes.RoleStateChange: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); } } } break; case (int)KuaFuEventTypes.UpdateAndNotifyEnterGame: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); YongZheZhanChangFuBenData fuBenData = GetKuaFuFuBenData(kuaFuRoleData.GameId); if (null != fuBenData && fuBenData.State == GameFuBenState.Start) { KuaFuServerLoginData kuaFuServerLoginData = new KuaFuServerLoginData() { RoleId = kuaFuRoleData.RoleId, GameType = kuaFuRoleData.GameType, GameId = kuaFuRoleData.GameId, EndTicks = kuaFuRoleData.StateEndTicks, }; kuaFuServerLoginData.ServerId = ClientInfo.ServerId; lock (Mutex) { KuaFuServerInfo kuaFuServerInfo; if (ServerIdServerInfoDict.TryGetValue(fuBenData.ServerId, out kuaFuServerInfo)) { kuaFuServerLoginData.ServerIp = kuaFuServerInfo.Ip; kuaFuServerLoginData.ServerPort = kuaFuServerInfo.Port; } } switch ((GameTypes)kuaFuRoleData.GameType) { case GameTypes.YongZheZhanChang: CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuNotifyEnterGameEvent(kuaFuServerLoginData), (int)SceneUIClasses.YongZheZhanChang); break; case GameTypes.KuaFuBoss: CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuNotifyEnterGameEvent(kuaFuServerLoginData), (int)SceneUIClasses.KuaFuBoss); break; case GameTypes.KingOfBattle: CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuNotifyEnterGameEvent(kuaFuServerLoginData), (int)SceneUIClasses.KingOfBattle); break; } } } } } break; case (int)KuaFuEventTypes.UpdateLhlyBhData: { if (args.Length == 1) { LangHunLingYuBangHuiDataEx data = args[0] as LangHunLingYuBangHuiDataEx; CoreInterface.GetEventSourceInterface().fireEvent(new NotifyLhlyBangHuiDataGameEvent(data), (int)SceneUIClasses.LangHunLingYu); } } break; case (int)KuaFuEventTypes.UpdateLhlyCityData: { if (args.Length == 1) { LangHunLingYuCityDataEx data = args[0] as LangHunLingYuCityDataEx; CoreInterface.GetEventSourceInterface().fireEvent(new NotifyLhlyCityDataGameEvent(data), (int)SceneUIClasses.LangHunLingYu); } } break; case (int)KuaFuEventTypes.UpdateLhlyOtherCityList: { if (args.Length == 1) { Dictionary <int, List <int> > data = args[0] as Dictionary <int, List <int> >; CoreInterface.GetEventSourceInterface().fireEvent(new NotifyLhlyOtherCityListGameEvent(data), (int)SceneUIClasses.LangHunLingYu); } } break; case (int)KuaFuEventTypes.UpdateLhlyCityOwnerList: { if (args.Length == 1) { List <LangHunLingYuKingHist> data = args[0] as List <LangHunLingYuKingHist>; CoreInterface.GetEventSourceInterface().fireEvent(new NotifyLhlyCityOwnerHistGameEvent(data), (int)SceneUIClasses.LangHunLingYu); } } break; case (int)KuaFuEventTypes.UpdateLhlyCityOwnerAdmire: { if (args.Length == 2) { int rid = (int)args[0]; int admirecount = (int)args[1]; CoreInterface.GetEventSourceInterface().fireEvent(new NotifyLhlyCityOwnerAdmireGameEvent(rid, admirecount), (int)SceneUIClasses.LangHunLingYu); } } break; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
public void EventCallBackHandler(int eventType, params object[] args) { try { lock (_Mutex) { List <AllyData> list = null; AllyData data = null; switch (eventType) { case (int)KuaFuEventTypes.AllyLog: { if (args.Length == 2) { List <AllyLogData> logList = (List <AllyLogData>)args[1]; _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyLogGameEvent(logList), (int)_sceneType); } } break; case (int)KuaFuEventTypes.Ally: { if (args.Length == 3) { int unionID = (int)args[0]; AllyData target = (AllyData)args[1]; bool isTipMsg = (bool)args[2]; if (!_allyDic.TryGetValue(unionID, out list)) { list = new List <AllyData>() { }; _allyDic.TryAdd(unionID, list); } AllyData oldData = GetAllyData(unionID, target.UnionID); if (oldData == null) { list.Add(target); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(unionID), (int)_sceneType); if (isTipMsg) { _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyTipGameEvent(unionID, (int)ActivityTipTypes.AllyMsg), (int)_sceneType); } } } } break; case (int)KuaFuEventTypes.KFAlly: { if (args.Length == 2) { AllyData unionData = (AllyData)args[0]; AllyData targetData = (AllyData)args[1]; if (!_allyDic.TryGetValue(unionData.UnionID, out list)) { list = new List <AllyData>() { }; _allyDic.TryAdd(unionData.UnionID, list); } AllyData oldData = GetAllyData(unionData.UnionID, targetData.UnionID); if (oldData == null) { list.Add(targetData); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(unionData.UnionID), (int)_sceneType); } // List <AllyData> list2 = null; if (!_allyDic.TryGetValue(targetData.UnionID, out list2)) { list2 = new List <AllyData>() { }; _allyDic.TryAdd(targetData.UnionID, list2); } oldData = GetAllyData(targetData.UnionID, unionData.UnionID); if (oldData == null) { list2.Add(unionData); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(targetData.UnionID), (int)_sceneType); } } } break; case (int)KuaFuEventTypes.AllyUnionUpdate: { if (args.Length == 2) { int unionID = (int)args[0]; AllyData targetData = (AllyData)args[1]; data = GetAllyData(unionID, targetData.UnionID); if (data != null && _allyDic.TryGetValue(unionID, out list)) { list.Remove(data); list.Add(targetData); } data = GetRequestData(unionID, targetData.UnionID); if (data != null && _requestDic.TryGetValue(unionID, out list)) { list.Remove(data); list.Add(data); } data = GetAcceptData(unionID, targetData.UnionID); if (data != null && _acceptDic.TryGetValue(unionID, out list)) { list.Remove(data); list.Add(data); } } } break; case (int)KuaFuEventTypes.AllyRemove: { if (args.Length == 2) { int unionID = (int)args[0]; int targetID = (int)args[1]; data = GetAllyData(unionID, targetID); if (data != null && _allyDic.TryGetValue(unionID, out list)) { list.Remove(data); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyTipGameEvent(unionID, (int)ActivityTipTypes.AllyMsg), (int)_sceneType); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(unionID), (int)_sceneType); } } } break; case (int)KuaFuEventTypes.KFAllyRemove: { if (args.Length == 2) { int unionID = (int)args[0]; int targetID = (int)args[1]; data = GetAllyData(unionID, targetID); if (data != null && _allyDic.TryGetValue(unionID, out list)) { list.Remove(data); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(unionID), (int)_sceneType); } AllyData data2 = GetAllyData(targetID, unionID); List <AllyData> list2 = null; if (data2 != null && _allyDic.TryGetValue(targetID, out list2)) { list2.Remove(data2); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyGameEvent(targetID), (int)_sceneType); } } } break; case (int)KuaFuEventTypes.AllyAccept: { if (args.Length == 2) { int unionID = (int)args[0]; AllyData target = (AllyData)args[1]; if (!_acceptDic.TryGetValue(unionID, out list)) { list = new List <AllyData>() { }; _acceptDic.TryAdd(unionID, list); } AllyData oldData = GetAcceptData(unionID, target.UnionID); if (oldData == null) { list.Add(target); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyTipGameEvent(unionID, (int)ActivityTipTypes.AllyAccept), (int)_sceneType); } } } break; case (int)KuaFuEventTypes.AllyAcceptRemove: { if (args.Length == 2) { int unionID = (int)args[0]; int targetID = (int)args[1]; data = GetAcceptData(unionID, targetID); if (data != null && _acceptDic.TryGetValue(unionID, out list)) { list.Remove(data); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyTipGameEvent(unionID, (int)ActivityTipTypes.AllyAccept), (int)_sceneType); } } } break; case (int)KuaFuEventTypes.AllyRequest: { if (args.Length == 2) { int unionID = (int)args[0]; AllyData target = (AllyData)args[1]; if (!_requestDic.TryGetValue(unionID, out list)) { list = new List <AllyData>() { }; _requestDic.TryAdd(unionID, list); } AllyData oldData = GetRequestData(unionID, target.UnionID); if (oldData == null) { list.Add(target); } } } break; case (int)KuaFuEventTypes.AllyRequestRemove: { if (args.Length == 2) { int unionID = (int)args[0]; int targetID = (int)args[1]; data = GetRequestData(unionID, targetID); if (data != null && _requestDic.TryGetValue(unionID, out list)) { list.Remove(data); _CoreInterface.GetEventSourceInterface().fireEvent(new KFNotifyAllyTipGameEvent(unionID, (int)ActivityTipTypes.AllyMsg), (int)_sceneType); } } } break; } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
public void EventCallBackHandler(int eventType, params object[] args) { try { switch (eventType) { case (int)KuaFuEventTypes.KFCopyTeamCreate: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomCreateEvent((CopyTeamCreateData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamJoin: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomJoinEvent((CopyTeamJoinData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamKickout: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomKickoutEvent((CopyTeamKickoutData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamLeave: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomLeaveEvent((CopyTeamLeaveData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamSetReady: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomReadyEvent((CopyTeamReadyData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamStart: // 只处理其他服异步转发的消息 { if (args != null && args.Length == 2 && (int)args[0] != ClientInfo.ServerId) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyRoomStartEvent((CopyTeamStartData)args[1]), SceneType); } } break; case (int)KuaFuEventTypes.KFCopyTeamDestroty: { if (args != null && args.Length == 1) { CoreInterface.GetEventSourceInterface().fireEvent( new KFCopyTeamDestroyEvent((CopyTeamDestroyData)args[0]), SceneType); } } break; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }
public void EventCallBackHandler(int eventType, params object[] args) { try { switch (eventType) { case (int)KuaFuEventTypes.NotifyWaitingRoleCount: { if (args.Length == 2) { int rid = (int)args[0]; int count = (int)args[1]; CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuFuBenRoleCountEvent(rid, count), SceneType); } } break; case (int)KuaFuEventTypes.RoleSignUp: case (int)KuaFuEventTypes.RoleStateChange: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); } } } break; case (int)KuaFuEventTypes.UpdateAndNotifyEnterGame: { if (args.Length == 1) { KuaFuRoleData kuaFuRoleData = args[0] as KuaFuRoleData; if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData, kuaFuRoleData.RoleId); HuanYingSiYuanFuBenData huanYingSiYuanFuBenData = GetKuaFuFuBenData(kuaFuRoleData.GameId); if (null != huanYingSiYuanFuBenData && huanYingSiYuanFuBenData.State == GameFuBenState.Start) { KuaFuServerLoginData kuaFuServerLoginData = new KuaFuServerLoginData() { RoleId = kuaFuRoleData.RoleId, GameType = kuaFuRoleData.GameType, GameId = kuaFuRoleData.GameId, EndTicks = kuaFuRoleData.StateEndTicks, }; kuaFuServerLoginData.ServerId = ClientInfo.ServerId; lock (Mutex) { KuaFuServerInfo kuaFuServerInfo; if (ServerIdServerInfoDict.TryGetValue(huanYingSiYuanFuBenData.ServerId, out kuaFuServerInfo)) { kuaFuServerLoginData.ServerIp = kuaFuServerInfo.Ip; kuaFuServerLoginData.ServerPort = kuaFuServerInfo.Port; } } CoreInterface.GetEventSourceInterface().fireEvent(new KuaFuNotifyEnterGameEvent(kuaFuServerLoginData), SceneType); } } } } break; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } }