void SendMsg(TongJiEnum enumType, MsgData msg, int id = 0) { EventParameter par = EventParameter.Get(msg); par.intParameter = (int)enumType; par.intParameter1 = info.id; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_TongJiUpdate, par); //通知 通缉UI更新 OtherTaskData dt = new OtherTaskData(OtherTaskType.TongJi, info.id, info.state); EventParameter taskPar = EventParameter.Get(); taskPar.objParameter = dt; if (info.finishCount >= info.buyCount + 5) //全部完成没有任务了 { taskPar.intParameter = (int)OtherTaskState.remove; } else { taskPar.intParameter = (int)OtherTaskState.add; } if (enumType != TongJiEnum.getBoxReward) { CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_OtherQuestIdChange, taskPar); //通知 任务主界面 更新 } }
/// <summary> /// 使用物品回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnUseItem(MsgData data) { MsgData_sUseItemResult info = data as MsgData_sUseItemResult; if (info.Result == 0) { //LogMgr.LogError("物品使用成功 id:{0}", info.ID); LuaTable t = ConfigManager.Instance.BagItem.GetItemConfig(info.ID); if (t != null) { float cd = t.Get <int>("cd") * 0.001f; int groupcd = t.Get <int>("groupcd"); if (cd > 0) { m_UseTime[info.ID] = Time.realtimeSinceStartup + cd; } if (groupcd > 0) { m_CDGroupUseTime[groupcd] = Time.realtimeSinceStartup + cd; } } } EventParameter ep = EventParameter.Get(); ep.intParameter = info.Result; ep.intParameter1 = info.ID; ep.longParameter = info.Count; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_BAG_USE_ITEM, ep); }
public void OnCookieUpdate(MsgData msg) { MsgData_sCookieUpdate data = msg as MsgData_sCookieUpdate; expiredTime = data.ExpiredTime; cookie = data.Cookie; }
/// <summary> /// 收到重连消息 /// </summary> /// <param name="msg"></param> private void RespReconnect(MsgData msg) { MainPanelMgr.Instance.HideDialog("UIWaitDialog"); MsgData_sReconnect data = msg as MsgData_sReconnect; if (null == data) { return; } if (data.Result == 0)//重连成功 { UITips.ReconnectSwitchLine(); } else if (data.Result == 1)//认证失败 { UITips.ShowTipsDialog("提示", "认证失败,请重新登录", "确定", RequestToLogin, null, null); } else if (data.Result == 2)//重连失败 { UITips.ShowTipsDialog("提示", "您已经断开连接,请重新登录", "确定", RequestToLogin, null, null); } else if (data.Result == 3) { UITips.ShowTipsDialog("提示", "连接失败,请重新登录", "确定", RequestToLogin, null, null); } }
/// <summary> /// 玩家请求加入。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnJoinRequest(MsgData data) { MsgData_sTeamJoinRequest info = data as MsgData_sTeamJoinRequest; RequestJoinInfo joininfo = GetJoinRequestInfo(info.RoleID); if (joininfo != null) { //已经在请求列表中 return; } string netname = UiUtil.GetNetString(info.RoleName); int server; joininfo = new RequestJoinInfo(); joininfo.RoleID = info.RoleID; joininfo.Name = PlayerData.GetPlayerName(netname, out server); joininfo.Server = server; joininfo.Level = info.Level; joininfo.Power = info.Power; joininfo.Prof = info.Prof; mJoinRequestInfos.Add(joininfo); if (AutoAgree) { SendJoinApproveRequest(info.RoleID, 1); } else { EventParameter ep = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TEAM_JOIN_REQUEST, ep); } }
/// <summary> /// 更新物品。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnItemUpdate(MsgData data) { MsgData_sItemUpdate info = data as MsgData_sItemUpdate; BagInfo bag = GetBagInfo(info.Bag); if (bag != null) { ItemInfo iteminfo = bag.GetItemInfo(info.Pos); if (iteminfo == null) { return; } bool newuid = iteminfo.UID != info.UID; if (newuid) { mItems.Remove(iteminfo.UID); } bag.UpdateItem(info); if (newuid) { mItems.Add(info.UID, bag.GetItemInfo(info.Pos)); } TriggerEventItemUpdate(info.Bag, info.Pos); if (info.Bag == BagType.ITEM_BAG_TYPE_EQUIP) { ShowEquipChange(info.ID); } } else { LogMgr.ErrorLog("未知背包编号 id:{0}", info.Bag); } }
/// <summary> /// 初始化背包信息。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnBagInfo(MsgData data) { MsgData_sQueryItemResult info = data as MsgData_sQueryItemResult; BagInfo bag = GetBagInfo(info.Bag); if (bag != null) { //从mItems删除原来背包的东西 foreach (var kvp in bag.ItemInfos) { mItems.Remove(kvp.Value.UID); } bag.Init(info); //重新添加 foreach (var kvp in bag.ItemInfos) { mItems.Add(kvp.Value.UID, kvp.Value); } TriggerEventBagInfo(bag.BagType); } else { LogMgr.ErrorLog("未知背包编号 id:{0}", info.Bag); } }
/// <summary> /// 删除物品。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnItemDel(MsgData data) { MsgData_sItemDel info = data as MsgData_sItemDel; BagInfo bag = GetBagInfo(info.Bag); if (bag != null) { ItemInfo iteminfo = bag.GetItemInfo(info.Pos); if (mCacheAddUID == iteminfo.UID) { //抵消前一个Add mCacheAddUID = 0; } else { mItems.Remove(iteminfo.UID); } bag.DeleteItem(info.Pos); TriggerEventItemDel(1, info.Bag, info.Pos, iteminfo.UID); } else { LogMgr.ErrorLog("未知背包编号 id:{0}", info.Bag); } }
/// <summary> /// 添加物品。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnItemAdd(MsgData data) { MsgData_sItemAdd info = data as MsgData_sItemAdd; BagInfo bag = GetBagInfo(info.Bag); if (bag != null) { bag.AddItem(info); if (mItems.ContainsKey(info.UID)) { //额外多Add了一次,下次Del时抵消 mCacheAddUID = info.UID; mItems.Remove(mCacheAddUID); } mItems.Add(info.UID, bag.GetItemInfo(info.Pos)); TriggerEventItemAdd(info.Bag, info.Pos); if (info.Bag == BagType.ITEM_BAG_TYPE_EQUIP) { ShowEquipChange(info.ID); } } else { LogMgr.ErrorLog("未知背包编号 id:{0}", info.Bag); } }
public void OnChangeEnd(MsgData msg) { MsgData_sChangeEnd data = msg as MsgData_sChangeEnd; DoMorphingFinish(data.ID); }
/// <summary> /// 初始化数据。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnInitData(MsgData data) { MsgData_sRideInfo info = data as MsgData_sRideInfo; mStage = info.Stage; mStarProgress = info.StarProgress; mPillNum = info.PillNum; mPillNumPercent = info.PillNumPercent; mRideID = info.RideID; mRideState = info.RideState; mUpLevelNum = info.UpLevelNum; mFeatureRides.Clear(); for (int i = 0; i < info.FeatureRideCount; ++i) { MsgData_sFeatureRide fr = info.FeatureRideList[i]; FeatureRideInfo frinfo = new FeatureRideInfo(fr.RideID, fr.Time); mFeatureRides.Add(frinfo.RideID, frinfo); } TriggerEventRideInfo(); //临时缓存坐骑模型 if (mStage == 0) { LuaTable cfg = ConfigManager.Instance.Common.GetHorseConfig(1); int mid = cfg.Get <int>(string.Format("model{0}", PlayerData.Instance.Job)); MagicKeyDrag.AddCache(mid); } }
/// <summary> /// 好友添加申请。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnAddApply(MsgData data) { MsgData_sAddFriendApply info = data as MsgData_sAddFriendApply; if (IsFriend(info.RoleID) || IsInBlackList(info.RoleID)) //已经时好友或者被拉黑了则屏蔽 { return; } RoleSimpleInfo roleinfo = GetAddApplyInfo(info.RoleID); if (roleinfo == null) { int server; roleinfo = new RoleSimpleInfo(); roleinfo.ID = info.RoleID; roleinfo.Level = info.Level; roleinfo.Name = PlayerData.GetPlayerName(UiUtil.GetNetString(info.RoleName), out server); roleinfo.Server = server; mAddApplyList.Add(roleinfo); } EventParameter ep = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_FRIEND_REMOVE_RELATION, ep); }
void SendMsg(TitleEnum enumType, MsgData msg) { EventParameter par = EventParameter.Get(msg); par.intParameter = (int)enumType; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_CC_PlayerTitleUpdate, par); }
/// <summary> /// 收到系统公告。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnSystemNotice(MsgData data) { MsgData_sChatSysNotice info = data as MsgData_sChatSysNotice; string param = UiUtil.GetNetString(info.Param).Trim(); ShowSystemNotice(info.ID, param); }
/// <summary> /// 收到私聊消息。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnPrivateChatMessage(MsgData data) { MsgData_sPrivateChatNotice info = data as MsgData_sPrivateChatNotice; SendSetPrivateChatStateRequest(info.SenderID, 1); TriggerEventPrivateMessage(info.SenderID); }
private void OnArenaRecord(MsgData msg) { MsgData_sResArenaRecord data = msg as MsgData_sResArenaRecord; mRecords.Clear(); for (int i = 0; i < data.List.Count; i++) { ArenaRecord r = new ArenaRecord(); r.ID = data.List[i].ID; r.Time = data.List[i].Time; r.Name = data.List[i].Param.BytesToString(); r.Name = r.Name.Replace("\0", ""); mRecords.Add(r); } mRecords.Sort((a, b) => { if (a.Time > b.Time) { return(-1); } return(1); }); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SC_ARENA_RECORD, null); }
/// <summary> /// 更改坐骑。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnChangeRideID(MsgData data) { MsgData_sChangeRideId info = data as MsgData_sChangeRideId; mRideID = info.ID; mRideState = info.State; TriggerEventChangeID(info.ID, info.State); }
private void OnArenaInfo(MsgData msg) { MsgData_sResMeArenaInfo data = msg as MsgData_sResMeArenaInfo; mMeArenaInfo = data; mMeInfoTime = DateTime.Now; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SC_ARENA_INFO, null); }
/// <summary> /// 更新免费传送次数。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnTeleportFreeTime(MsgData data) { MsgData_sTeleportFreeTime info = data as MsgData_sTeleportFreeTime; mTeleportFreeTime = info.Time; EventParameter parameter = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_TELEPORT_FREE_TIME, parameter); }
/// <summary> /// 信息查询结果。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnInfoResult(MsgData data) { MsgData_sOtherHumanInfoRet info = data as MsgData_sOtherHumanInfoRet; EventParameter parameter = EventParameter.Get(); parameter.intParameter = info.Result; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OTHER_PLAYER_INFO, parameter); }
/// <summary> /// 技能移除。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnSkillRemove(MsgData data) { MsgData_sSkillRemove info = data as MsgData_sSkillRemove; int id = info.ID; int gid = ConfigManager.Instance.Skill.GetSkillGroup(id); mSkills.Remove(gid); TriggerEventSkillRemove(id); }
private void OnCrownResult(MsgData msg) { MsgData_sResCrownFightResult data = msg as MsgData_sResCrownFightResult; EventParameter param = EventParameter.Get(); param.intParameter = data.Result; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SC_CROWNRESULT, param); }
/// <summary> /// 批量出售物品回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnFastSellItem(MsgData data) { MsgData_sSellItemListResult info = data as MsgData_sSellItemListResult; EventParameter ep = EventParameter.Get(); ep.objParameter = info; CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_BAG_FAST_SELL, ep); }
/// <summary> /// 收到身上道具信息。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnBodyToolInfo(MsgData data) { MsgData_sOtherBodyTool info = data as MsgData_sOtherBodyTool; mBodyToolInfo = info; EventParameter parameter = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OTHER_PLAYER_BODY_TOOL, parameter); }
/// <summary> /// 收到坐骑信息。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnMountInfo(MsgData data) { MsgData_sOtherMountInfoRet info = data as MsgData_sOtherMountInfoRet; mMountInfo = info; EventParameter parameter = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OTHER_PLAYER_MOUNT, parameter); }
/// <summary> /// 收到详细信息。 /// </summary> /// <param name="data">网络消息数据。</param> public void OnDetailInfo(MsgData data) { MsgData_sOtherHumanXXInfoRet info = data as MsgData_sOtherHumanXXInfoRet; mDetailInfo = info; EventParameter parameter = EventParameter.Get(); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_OTHER_PLAYER_DETAIL, parameter); }
/// <summary> /// 背包整理回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnPackBag(MsgData data) { MsgData_sPackItemResult info = data as MsgData_sPackItemResult; LogMgr.Log("背包整理回复 bag:{0} result:{1}", info.BagType, info.Result); if (info.Result == 0) { //背包整理成功 } }
/// <summary> /// 丢弃物品回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnDiscardItem(MsgData data) { MsgData_sDiscardItemResult info = data as MsgData_sDiscardItemResult; LogMgr.Log("丢弃回复 bag:{0} pos:{1} result:{2}", info.Bag, info.Pos, info.Result); if (info.Result == 0) { //丢弃物品成功 } }
private void OnStoneInset(MsgData msg) { MsgData_sReqEquipGemInset data = msg as MsgData_sReqEquipGemInset; for (int i = 0; i < data.Data.Count; i++) { } CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_STONE_INSET, null); }
/// <summary> /// 拆分物品回复。 /// </summary> /// <param name="data">网络消息数据。</param> private void OnSplitItem(MsgData data) { MsgData_sSplitItemResult info = data as MsgData_sSplitItemResult; LogMgr.Log("拆分物品回复 result:{0}", info.Result); if (info.Result == 0) { //使用物品成功 } }