/// <summary> /// 收到好友上下线信息 /// </summary> /// <param name="data"></param> private void ReceiveFriendOnline_7_9(INetData data) { RelationPushOnlineMsg_7_9 msg = new RelationPushOnlineMsg_7_9(); msg.read(data.GetMemoryStream()); Singleton <FriendMode> .Instance.SetFriendOlineInfo(msg.roleId, msg.isOnline); }
/// <summary> /// 获取好友数量信息 /// </summary> /// <param name="data"></param> private void ReceiveFriendNumInfo_7_17(INetData data) { RelationFriendsCountMsg_7_17 msg = new RelationFriendsCountMsg_7_17(); msg.read(data.GetMemoryStream()); Singleton <FriendMode> .Instance.SetFriendNumInfo(msg.nowCount, msg.maxCount); }
/// <summary> /// 收到邀请回复信息 /// </summary> /// <param name="data"></param> private void ReceiveAskReplyInfo_7_5(INetData data) { RelationPushAnswerMsg_7_5 msg = new RelationPushAnswerMsg_7_5(); msg.read(data.GetMemoryStream()); string action; if (msg.answer == 0) { action = LanguageManager.GetWord("FriendControl.Reject"); } else { //对方同意加好友 action = LanguageManager.GetWord("FriendControl.Accept"); PRelationInfo info = new PRelationInfo(); info.roleId = msg.roleId; info.sex = msg.sex; info.name = msg.name; info.job = msg.job; info.lvl = msg.lvl; info.vip = msg.vip; info.isOnline = 1; info.intimate = 0; Singleton <FriendMode> .Instance.AddFriend(info); } MessageManager.Show(msg.name + action + LanguageManager.GetWord("FriendControl.FriendAsk")); }
/// <summary> /// 好友删除 /// </summary> /// <param name="data"></param> private void ReceiveFriendDeleted_7_8(INetData data) { RelationPushDelMsg_7_8 msg = new RelationPushDelMsg_7_8(); msg.read(data.GetMemoryStream()); Singleton <FriendMode> .Instance.DeleteFriend(msg.roleId); }
/**切换场景请求返回**/ private void Fun_4_1(INetData data) { var mapSwitchMsg = new MapSwitchMsg_4_1(); mapSwitchMsg.read(data.GetMemoryStream()); if (mapSwitchMsg.code == 0) { Log.debug(this, "-Fun_4_1 切换场景请求通过"); Singleton <MapMode> .Instance.ApplySceneInfo(); if (MeVo.instance.mapId == MapTypeConst.GoldHit_MAP) //若为击石成金副本 { Singleton <GoldHitControl> .Instance.OpenMainView(); } } else { Log.info(this, "进入场景失败,关闭进度条"); // Singleton<StartLoadingView>.Instance.CloseView(); ErrorCodeManager.ShowError(mapSwitchMsg.code); if (mapSwitchMsg.code == 404) { //Log.info(this, "该场景不可进入,切换到主城"); //Singleton<MapMode>.Instance.changeScene(MapTypeConst.MajorCity, false, 5, 1.8f); } } }
/// <summary> /// 服务器发送副本阶段信息 /// </summary> /// <param name="data">Data.</param> private void Fun_4_14(INetData data) { // Log.info (this, "-Fun_4_14()"); var mapPhaseMsg = new MapPhaseMsg_4_14(); mapPhaseMsg.read(data.GetMemoryStream()); Log.info(this, "-Fun_4_14() 进入新阶段为:" + mapPhaseMsg.phase); UnityEngine.Debug.Log("****服务器发送副本阶段信息 Fun_4_14()"); MapMode.NEXT_MAP_PHASE = mapPhaseMsg.phase; MapMode.IsTriggered = false; Log.info(this, "-Fun_4_14()暂停刷怪标识开启"); MapMode.WaitRefreshMonster = true; Singleton <MapMode> .Instance.StopLeftTime(); AppMap.Instance.me.Controller.ContCutMgr.PauseAttack(); if (CanPlayCopyStory(AppMap.Instance.mapParser.MapId)) { if (Singleton <StoryControl> .Instance.PlayEndStageStory(curMapId, (uint)(mapPhaseMsg.phase - 1), EndStage)) { MapMode.InStageEndStory = true; endStageStoryPlaying = true; PreSortStoryPlay(); } else { EndStage(); } } else { EndStageStoryEnd(); } }
/**业务处理**/ private void DoHandler() { if (netDataList.Count < 1) { return; } int handlerNum = gameCMDNum; //每帧业务处理个数 while (handlerNum > 0 && netDataList.Count > 0) { INetData data = netDataList[0]; netDataList.Remove(data); string cmd = data.GetCMD(); //NetDebug.AddConsole(cmd); if (handlerList.ContainsKey(cmd)) { //handlerList[cmd](data); } else { //Log.info(this, "-doHandler() 未注册CMD:" + data.GetCMD()); } handlerNum--; } }
//接收到宠物列表信息 private void ReceivePetList(INetData data) { PetListMsg_21_1 msg = new PetListMsg_21_1(); msg.read(data.GetMemoryStream()); Singleton <PetMode> .Instance.SetPetList(msg.pet); }
private void ReceivePetSkillPointInfo(INetData data) { PetSkillPointInfoMsg_21_7 msg = new PetSkillPointInfoMsg_21_7(); msg.read(data.GetMemoryStream()); Singleton <PetMode> .Instance.SetSkillPointInfo(msg); }
private void Fun_28_1(INetData data) { MedalMaxIdMsg_28_1 message = new MedalMaxIdMsg_28_1(); message.read(data.GetMemoryStream()); MedalMode.Instance.UpdateMdealInfo(message.id); }
//当前的协助玩家 private void Fun_26_7(INetData data) { WoodsAssistInfoMsg_26_7 assistInfoMsg = new WoodsAssistInfoMsg_26_7(); assistInfoMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.AssistId = assistInfoMsg.assistId; }
//私聊请求聊天返回 private void Fun_10_2(INetData data) { ChatPrivateChatMsg_10_2 privateChatReqMsg_10_2 = new ChatPrivateChatMsg_10_2(); privateChatReqMsg_10_2.read(data.GetMemoryStream()); if (privateChatReqMsg_10_2.code != 0) { ErrorCodeManager.ShowError(privateChatReqMsg_10_2.code); return; } // Singleton<ChatMode>.Instance.ReciveNameSL = privateChatReqMsg_10_2.roleName; ChatVo newMSg = new ChatVo(); newMSg.chatType = 7; newMSg.senderId = MeVo.instance.Id; newMSg.serverId = (ushort)MeVo.instance.serverId; newMSg.senderName = MeVo.instance.Name; newMSg.senderSex = MeVo.instance.sex; newMSg.senderJob = MeVo.instance.job; newMSg.senderLvl = (byte)MeVo.instance.Level; newMSg.senderVip = MeVo.instance.vip; newMSg.content = Singleton <ChatView> .Instance.sendMessage.content; // updateChatVO.goods = Singleton<ChatMode>.Instance.goods.Count > 0?Singleton<ChatMode>.Instance.goods[0]:null; newMSg.nationId = MeVo.instance.nation; Singleton <ChatMode> .Instance.AddChatMsg(newMSg); Singleton <ChatMode> .Instance.UpdateMainChatContent(newMSg.senderName, newMSg.chatType, newMSg.content); Singleton <ChatView> .Instance.msgInput.value = ""; }
//完成冒险 private void Fun_26_21(INetData data) { WoodsFinishAdvenMsg_26_21 finishAdvenMsg = new WoodsFinishAdvenMsg_26_21(); finishAdvenMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.SetAdventFinished(finishAdvenMsg.repu, finishAdvenMsg.gold); }
private void Fun_29_3(INetData data) { GiftSignInfoMsg_29_3 giftSignMsg_29_3 = new GiftSignInfoMsg_29_3(); giftSignMsg_29_3.read(data.GetMemoryStream()); Singleton <LoginAwardMode> .Instance.UpdateSignInfo(giftSignMsg_29_3); }
//剩余冒险次数 private void Fun_26_3(INetData data) { WoodsRemainAdvenTimesMsg_26_3 remainAdvenTimesMsg = new WoodsRemainAdvenTimesMsg_26_3(); remainAdvenTimesMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.AdventRemainTimes = remainAdvenTimesMsg.times; }
//打劫cd private void Fun_26_4(INetData data) { WoodsRobCdMsg_26_4 robCdMsg = new WoodsRobCdMsg_26_4(); robCdMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.RobCDTime = robCdMsg.time; }
//每个冒险玩家的信息 private void Fun_26_0(INetData data) { WoodsPanalInfoMsg_26_0 panelInfoMsg = new WoodsPanalInfoMsg_26_0(); panelInfoMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.PlayerList = panelInfoMsg.players; }
//剩余打劫次数 private void Fun_26_1(INetData data) { WoodsRemainRobTiemsMsg_26_1 remainRobTimsMsg = new WoodsRemainRobTiemsMsg_26_1(); remainRobTimsMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.RobRemainTimes = remainRobTimsMsg.times; }
//当前品质和刷新次数 private void Fun_26_6(INetData data) { WoodsGradeInfoMsg_26_6 gradeInfoMsg = new WoodsGradeInfoMsg_26_6(); gradeInfoMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.SetGradeAndRefreshTimes(gradeInfoMsg.grade, gradeInfoMsg.refreshTimes); }
//推送邀请请求 private void Fun_26_23(INetData data) { WoodsPushInviteMsg_26_23 pushInviteMsg = new WoodsPushInviteMsg_26_23(); pushInviteMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.SetInviteInfo(pushInviteMsg.id, pushInviteMsg.name, pushInviteMsg.grade); }
//剩余协助次数(给好友广播) private void Fun_26_19(INetData data) { WoodsFriendRemainInfoMsg_26_19 friendRemainInfoMsg = new WoodsFriendRemainInfoMsg_26_19(); friendRemainInfoMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.UpdateFriendAssistRemain(friendRemainInfoMsg.remainInfo); }
private void Fun_14_1(INetData data) { SmeltStrenMsg_14_1 message = new SmeltStrenMsg_14_1(); message.read(data.GetMemoryStream()); if (message.code == 0) { if (message.result == 0) { MessageManager.Show("强化成功"); } else { MessageManager.Show("强化失败"); } Singleton <Equip1Mode> .Instance.UpdateEquipStren(message.result); } else { ErrorCodeManager.ShowError(message.code); //失败直接请求 } Log.info(this, "Fun_14_1"); }
//更新玩家被打劫的次数 private void Fun_26_10(INetData data) { WoodsUpdateRobTimesMsg_26_10 updateRobTimesMsg = new WoodsUpdateRobTimesMsg_26_10(); updateRobTimesMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.SetPlayerRobbedTimes(updateRobTimesMsg.playerId, updateRobTimesMsg.robTimes); }
//好友剩余协助次数列表 private void Fun_26_18(INetData data) { WoodsFriendsInfoMsg_26_18 friendsInfoMsg = new WoodsFriendsInfoMsg_26_18(); friendsInfoMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.FriendList = friendsInfoMsg.friendList; }
//增加冒险玩家 private void Fun_26_9(INetData data) { WoodsInsertPlayerMsg_26_9 insertPlayerMsg = new WoodsInsertPlayerMsg_26_9(); insertPlayerMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.AddPlayers(insertPlayerMsg.playerList); }
//删除冒险玩家信息 private void Fun_26_8(INetData data) { WoodsClearPlayersMsg_26_8 clearPlayersMsg = new WoodsClearPlayersMsg_26_8(); clearPlayersMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.DelPlayer(clearPlayersMsg.playerId); }
private void ReceivePetUpdate(INetData data) { PetItemUpdateMsg_21_6 msg = new PetItemUpdateMsg_21_6(); msg.read(data.GetMemoryStream()); Singleton <PetMode> .Instance.UpdatePet(msg.id, msg.info); }
void OnLoginReturn(INetData receiveData) { var msg = new LoginLoginMsg_1_1(); msg.read(receiveData.GetMemoryStream()); //msg.loginInfo.icon }
/// <summary> /// 玩家基础属性更新 /// </summary> private void Fun_3_4(INetData data) { Log.info(this, "-Fun_3_4()玩家基础属性更新"); var roleBaseAttrMsg = new RoleAttrMsg_3_4(); roleBaseAttrMsg.read(data.GetMemoryStream()); PBaseAttr baseAttr = roleBaseAttrMsg.attr; MeVo.instance.Str = baseAttr.str; MeVo.instance.Agi = baseAttr.agi; MeVo.instance.Phy = baseAttr.phy; MeVo.instance.Wit = baseAttr.wit; MeVo.instance.CurHp = baseAttr.hpCur; MeVo.instance.Hp = baseAttr.hpFull; MeVo.instance.CurMp = baseAttr.mpCur; MeVo.instance.Mp = baseAttr.mpFull; MeVo.instance.AttPMin = baseAttr.attPMin; MeVo.instance.AttPMax = baseAttr.attPMax; MeVo.instance.AttMMin = baseAttr.attMMin; MeVo.instance.AttMMax = baseAttr.attMMax; MeVo.instance.DefP = baseAttr.defP; MeVo.instance.DefM = baseAttr.defM; MeVo.instance.Hit = baseAttr.hit; MeVo.instance.Dodge = (int)baseAttr.dodge; MeVo.instance.Crit = baseAttr.crit; MeVo.instance.CritRatio = baseAttr.critRatio; MeVo.instance.Flex = baseAttr.flex; MeVo.instance.HurtRe = baseAttr.hurtRe; MeVo.instance.Speed = baseAttr.speed; MeVo.instance.Luck = baseAttr.luck; MeVo.instance.fightPoint = baseAttr.fightPoint; Singleton <RoleMode> .Instance.UpdateAttr(); }
//推送邀请应答 private void Fun_26_22(INetData data) { WoodsPushReplyInviteMsg_26_22 pushReplyInviteMsg = new WoodsPushReplyInviteMsg_26_22(); pushReplyInviteMsg.read(data.GetMemoryStream()); Singleton <GoldSilverIslandMode> .Instance.FriendReply = pushReplyInviteMsg.result; }
public static void SendData(string recipient, INetData data) { SendData(new string[] { recipient }, data); }
public void ReceiveNetData(INetData data) { Debug.Log("ReceiveNetData:" + data.Cmd()); string cmd = data.Cmd(); if(cmd==Cmd.C_1_0) { netCallbackDic[cmd](data); } else { netdataList.Add(data); } }
public static void SendData(string[] recipients, INetData data) { MemoryStream serializationStream = new MemoryStream(); try { new BinaryFormatter().Serialize(serializationStream, data); byte[] inArray = serializationStream.ToArray(); serializationStream.Close(); serializationStream = null; string[] chunks = NetUtil.GetChunks(Convert.ToBase64String(inArray, Base64FormattingOptions.None), 0x7d0); for (int i = 0; i < chunks.Length; i++) { EventLog.WriteLine("Sending chunk {0} of {1}", new object[] { i + 1, chunks.Length }); SendCustomCommand(recipients, CustomCommands.NetData, new object[] { data.GetHashCode(), i, chunks.Length, chunks[i] }); } } finally { if (serializationStream != null) { serializationStream.Close(); serializationStream = null; } } }