private void EGMI_ACK_OBJECT_ENTRY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckPlayerEntryList xData = new NFMsg.AckPlayerEntryList(); xData = Serializer.Deserialize<NFMsg.AckPlayerEntryList>(new MemoryStream(xMsg.msg_data)); for (int i = 0; i < xData.object_list.Count; ++i) { NFMsg.PlayerEntryInfo xInfo = xData.object_list[i]; NFIDataList var = new NFCDataList(); var.AddString("X"); var.AddFloat(xInfo.x); var.AddString("Y"); var.AddFloat(xInfo.y); var.AddString("Z"); var.AddFloat(xInfo.z); NFIObject xGO = NFCKernelModule.Instance.CreateObject(PBToNF(xInfo.object_guid), xInfo.scene_id, 0, System.Text.Encoding.Default.GetString(xInfo.class_id), System.Text.Encoding.Default.GetString(xInfo.config_id), var); if (null == xGO) { Debug.LogError("ID冲突: " + xInfo.object_guid + " ConfigID:" + System.Text.Encoding.Default.GetString(xInfo.config_id)); continue; } } }
public void RequireEnterGameServer(NFCoreEx.NFIDENTID objectID, string strAccount, string strRoleName, int nServerID) { NFMsg.ReqEnterGameServer xData = new NFMsg.ReqEnterGameServer(); xData.name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(strAccount); xData.game_id = nServerID; xData.id = NFToPB(objectID); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqEnterGameServer>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_ENTER_GAME, stream); if (NFStart.Instance.bDebugMode) { //EGMI_ACK_OBJECT_ENTRY //property //EGMI_ACK_SWAP_SCENE //EGMI_ACK_OBJECT_ENTRY //property float fX = 0.0f; float fY = 0.0f; float fZ = 0.0f; NFIElement xElement = NFCElementManager.Instance.GetElement("1"); if (null != xElement) { string strRelivePos = xElement.QueryString("RelivePos"); string[] sArray = strRelivePos.Split(';'); if (sArray.Length > 0) { sArray = sArray[0].Split(','); } if (sArray.Length == 3) { fX = float.Parse(sArray[0]); fY = float.Parse(sArray[1]); fZ = float.Parse(sArray[2]); } } ///////////////////////////////////////////// //mainplayer NFMsg.AckPlayerEntryList xAckMainBodyData = new NFMsg.AckPlayerEntryList(); NFMsg.PlayerEntryInfo xInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xID = new NFMsg.Ident(); xInfo.object_guid = xID; xInfo.x = fX; xInfo.y = fY; xInfo.z = fZ; xInfo.career_type = 1; xInfo.player_state = 1; xInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xInfo.scene_id = 1; xInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckMainBodyData.object_list.Add(xInfo); MemoryStream xAckMianPlayerBodyStream = new MemoryStream(); Serializer.Serialize<NFMsg.AckPlayerEntryList>(xAckMianPlayerBodyStream, xAckMainBodyData); NFMsg.MsgBase xAckMianPlayerData = new NFMsg.MsgBase(); xAckMianPlayerData.player_id = xID; xAckMianPlayerData.msg_data = xAckMianPlayerBodyStream.ToArray(); MemoryStream xAckAllStream = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckAllStream, xAckMianPlayerData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray()); ///////////////////////////////////////////// //property NFMsg.ObjectPropertyInt propertyData = new NFMsg.ObjectPropertyInt(); PropertyInt xPropertyInt = new PropertyInt(); xPropertyInt.property_name = UnicodeEncoding.Default.GetBytes("MOVE_SPEED"); xPropertyInt.data = 50000; propertyData.property_list.Add(xPropertyInt); propertyData.player_id = xID; MemoryStream xAckPropertyIntStream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectPropertyInt>(xAckPropertyIntStream, propertyData); NFMsg.MsgBase xPropertyIntMsg = new NFMsg.MsgBase(); xPropertyIntMsg.player_id = xID; xPropertyIntMsg.msg_data = xAckPropertyIntStream.ToArray(); MemoryStream xAckPropertyIntAllStream = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckPropertyIntAllStream, xPropertyIntMsg); MsgHead xAckPropertyhead = new MsgHead(); xAckPropertyhead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_INT; xAckPropertyhead.unDataLen = (UInt32)xAckPropertyIntAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xAckPropertyhead, xAckPropertyIntAllStream.ToArray()); ///////////////////////////////////////////// xNet.mPlayerState = NFNet.PLAYER_STATE.E_PLAYER_GAMEING; //NFCRenderInterface.Instance.LoadScene(1, fX, fY, fZ); ///////////////////////////////////////////// //npc NFMsg.AckPlayerEntryList xAckNPCBodyData = new NFMsg.AckPlayerEntryList(); for (int i = 0; i < 5; ++i) { NFMsg.PlayerEntryInfo xNPCInfo = new NFMsg.PlayerEntryInfo(); NFMsg.Ident xNPCID = new NFMsg.Ident(); xNPCID.index = i + 10000; xNPCInfo.object_guid = xNPCID; xNPCInfo.x = fX + i; xNPCInfo.y = fY; xNPCInfo.z = fZ + i; xNPCInfo.career_type = 1; xNPCInfo.player_state = 1; xNPCInfo.config_id = UnicodeEncoding.Default.GetBytes(""); xNPCInfo.scene_id = 1; xNPCInfo.class_id = UnicodeEncoding.Default.GetBytes("Player"); xAckNPCBodyData.object_list.Add(xNPCInfo); } MemoryStream xAckNPCBodyStream = new MemoryStream(); Serializer.Serialize<NFMsg.AckPlayerEntryList>(xAckNPCBodyStream, xAckNPCBodyData); NFMsg.MsgBase xAckNPCrData = new NFMsg.MsgBase(); xAckNPCrData.player_id = xID; xAckNPCrData.msg_data = xAckNPCBodyStream.ToArray(); MemoryStream xAckAllNPCStream = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckAllNPCStream, xAckNPCrData); MsgHead xNPCHead = new MsgHead(); xNPCHead.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_OBJECT_ENTRY; xNPCHead.unDataLen = (UInt32)xAckAllNPCStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(xNPCHead, xAckAllNPCStream.ToArray()); ////////////////////////////////////////////// } }
private void EGMI_ACK_SWAP_SCENE(MsgHead head, MemoryStream stream) { mNet.mPlayerState = NFNet.PLAYER_STATE.E_PLAYER_GAMEING; NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ReqAckSwapScene xData = new NFMsg.ReqAckSwapScene(); xData = Serializer.Deserialize<NFMsg.ReqAckSwapScene>(new MemoryStream(xMsg.msg_data)); //NFCRenderInterface.Instance.LoadScene(xData.scene_id, xData.x, xData.y, xData.z); }
private void EGMI_ACK_REMOVE_ROW(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ObjectRecordRemove recordData = new NFMsg.ObjectRecordRemove(); recordData = Serializer.Deserialize<NFMsg.ObjectRecordRemove>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(recordData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(recordData.record_name)); for (int i = 0; i < recordData.remove_row.Count; i++) { record.Remove(recordData.remove_row[i]); } }
private void EGMI_ACK_OBJECT_PROPERTY_ENTRY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.MultiObjectPropertyList xMultiObjectPropertyList = new NFMsg.MultiObjectPropertyList(); xMultiObjectPropertyList = Serializer.Deserialize<NFMsg.MultiObjectPropertyList>(new MemoryStream(xMsg.msg_data)); for (int i = 0; i < xMultiObjectPropertyList.multi_player_property.Count; i++) { NFMsg.ObjectPropertyList xPropertyData = xMultiObjectPropertyList.multi_player_property[i]; NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(xPropertyData.player_id)); NFIPropertyManager xPropertyManager = go.GetPropertyManager(); for (int j = 0; j < xPropertyData.property_int_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_int_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddInt(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetInt(xPropertyData.property_int_list[j].data); } for (int j = 0; j < xPropertyData.property_float_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_float_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddFloat(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetFloat(xPropertyData.property_float_list[j].data); } for (int j = 0; j < xPropertyData.property_string_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddString(""); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetString(System.Text.Encoding.Default.GetString(xPropertyData.property_string_list[j].data)); } for (int j = 0; j < xPropertyData.property_object_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xPropertyData.property_object_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFIDataList varList = new NFCDataList(); varList.AddObject(new NFGUID()); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetObject(PBToNF(xPropertyData.property_object_list[j].data)); } } }
private void EGMI_ACK_PROPERTY_OBJECT(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ObjectPropertyObject propertyData = new NFMsg.ObjectPropertyObject(); propertyData = Serializer.Deserialize<NFMsg.ObjectPropertyObject>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(propertyData.player_id)); for(int i = 0; i < propertyData.property_list.Count; i++) { NFIPropertyManager propertyManager = go.GetPropertyManager(); NFIProperty property = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name)); if (null == property) { NFIDataList varList = new NFCDataList(); varList.AddObject(new NFGUID()); property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name), varList); } property.SetObject(PBToNF(propertyData.property_list[i].data)); } }
private void EGMI_ACK_SWAP_ROW(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ObjectRecordSwap recordData = new NFMsg.ObjectRecordSwap(); recordData = Serializer.Deserialize<NFMsg.ObjectRecordSwap>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(recordData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(recordData.origin_record_name)); //目前认为在同一张表中交换吧 record.SwapRow(recordData.row_origin, recordData.row_target); }
public void SendMsg(NFCoreEx.NFIDENTID xID, NFMsg.EGameMsgID unMsgID, MemoryStream stream) { if (NFStart.Instance.bDebugMode) { return; } NFMsg.MsgBase xData = new NFMsg.MsgBase(); xData.player_id = NFToPB(xID); xData.msg_data = stream.ToArray(); MemoryStream body = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(body, xData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)unMsgID; head.unDataLen = (UInt32)body.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; byte[] bodyByte = body.ToArray(); byte[] headByte = StructureTransform.StructureToByteArrayEndian(head); byte[] sendBytes = new byte[head.unDataLen]; headByte.CopyTo(sendBytes, 0); bodyByte.CopyTo(sendBytes, headByte.Length); xNet.mxClient.SendBytes(sendBytes); string strTime = DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second; string strData = "S***:" + strTime + " MsgID:" + head.unMsgID + " Len:" + head.unDataLen; xNet.mxListener.aMsgList.Add(strData); }
private void EGMI_ACK_LOGIN(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckEventResult xData = new NFMsg.AckEventResult(); xData = Serializer.Deserialize<NFMsg.AckEventResult>(new MemoryStream(xMsg.msg_data)); if (EGameEventCode.EGEC_ACCOUNT_SUCCESS == xData.event_code) { Debug.Log("Login SUCCESS"); mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_PLAYER_LOGIN; Debug.Log("QueryWorldList"); mNet.mxSendLogic.RequireWorldList(); } else { Debug.Log("Login Faild,Code: " + xData.event_code); } }
private void EGMI_ACK_SELECT_SERVER(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckEventResult xData = new NFMsg.AckEventResult(); xData = Serializer.Deserialize<NFMsg.AckEventResult>(new MemoryStream(xMsg.msg_data)); if (xData.event_code == EGameEventCode.EGEC_SELECTSERVER_SUCCESS) { //�����ɫ�б� mNet.mxSendLogic.RequireRoleList(mNet.strAccount, mNet.nServerID); } }
private void EGMI_ACK_WORLD_LIST(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckServerList xData = new NFMsg.AckServerList(); xData = Serializer.Deserialize<NFMsg.AckServerList>(new MemoryStream(xMsg.msg_data)); if (ReqServerListType.RSLT_WORLD_SERVER == xData.type) { for(int i = 0; i < xData.info.Count; ++i) { ServerInfo info = xData.info[i]; aWorldList.Add(info); } } else if (ReqServerListType.RSLT_GAMES_ERVER == xData.type) { for (int i = 0; i < xData.info.Count; ++i) { ServerInfo info = xData.info[i]; aServerList.Add(info); } } }
private void EGMI_ACK_CONNECT_KEY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckEventResult xData = new NFMsg.AckEventResult(); xData = Serializer.Deserialize<NFMsg.AckEventResult>(new MemoryStream(xMsg.msg_data)); if (xData.event_code == EGameEventCode.EGEC_VERIFY_KEY_SUCCESS) { //��֤�ɹ� mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_VERIFY; //mNet.nMainRoleID = PBToNF(xData.event_object); //���������ڵķ������б� mNet.mxSendLogic.RequireServerList(); } }
//有可能是他副本的NPC移动,因此增加64对象ID public void RequireUseSkill(NFCoreEx.NFIDENTID objectID, string strKillID, NFCoreEx.NFIDENTID nTargetID, float fNowX, float fNowZ, float fTarX, float fTarZ) { NFMsg.Position xNowPos = new NFMsg.Position(); NFMsg.Position xTarPos = new NFMsg.Position(); xNowPos.x = fNowX; xNowPos.y = 0.0f; xNowPos.z = fNowZ; xTarPos.x = fTarX; xTarPos.y = 0.0f; xTarPos.z = fTarZ; NFMsg.ReqAckUseSkill xData = new NFMsg.ReqAckUseSkill(); xData.user = NFToPB(objectID); xData.skill_id = System.Text.Encoding.Default.GetBytes(strKillID); xData.tar_pos = xTarPos; xData.now_pos = xNowPos; NFMsg.EffectData xEffData = new NFMsg.EffectData(); xEffData.effect_ident = (NFToPB(nTargetID)); xEffData.effect_value = 0; xEffData.effect_rlt = 0; xData.effect_data.Add(xEffData); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqAckUseSkill>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_SKILL_OBJECTX, stream); ///////////////////////////////////////////// if (NFStart.Instance.bDebugMode) { NFMsg.MsgBase xAckData = new NFMsg.MsgBase(); xAckData.player_id = NFToPB(objectID); xAckData.msg_data = stream.ToArray(); MemoryStream xAckBody = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckBody, xAckData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_SKILL_OBJECTX; head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray()); } }
public void RequireMoveImmune(NFCoreEx.NFIDENTID objectID, float fX, float fZ) { NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove(); xData.mover = NFToPB(objectID); xData.moveType = 0; NFMsg.Position xTargetPos = new NFMsg.Position(); xTargetPos.x = fX; xTargetPos.z = fZ; xData.target_pos.Add(xTargetPos); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqAckPlayerMove>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_MOVE_IMMUNE, stream); if (NFStart.Instance.bDebugMode) { NFMsg.MsgBase xAckData = new NFMsg.MsgBase(); xAckData.player_id = xData.mover; xAckData.msg_data = stream.ToArray(); MemoryStream xAckBody = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckBody, xAckData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_MOVE_IMMUNE; head.unDataLen = (UInt32)xAckBody.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckBody.ToArray()); } }
private void EGMI_ACK_OBJECT_LEAVE(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckPlayerLeaveList xData = new NFMsg.AckPlayerLeaveList(); xData = Serializer.Deserialize<NFMsg.AckPlayerLeaveList>(new MemoryStream(xMsg.msg_data)); for (int i = 0; i < xData.object_list.Count; ++i) { NFCKernelModule.Instance.DestroyObject(PBToNF(xData.object_list[i])); } }
private void EGMI_ACK_WORLD_LIST(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckServerList xData = new NFMsg.AckServerList(); xData = Serializer.Deserialize<NFMsg.AckServerList>(new MemoryStream(xMsg.msg_data)); if (ReqServerListType.RSLT_WORLD_SERVER == xData.type) { for(int i = 0; i < xData.info.Count; ++i) { ServerInfo info = xData.info[i]; Debug.Log("WorldList ServerId: " + info.server_id + " Name: " + System.Text.Encoding.Default.GetString(info.name) + " Status: " + info.status); aWorldList.Add(info); } } else if (ReqServerListType.RSLT_GAMES_ERVER == xData.type) { for (int i = 0; i < xData.info.Count; ++i) { ServerInfo info = xData.info[i]; Debug.Log("GameList ServerId: " + info.server_id + " Name: " + System.Text.Encoding.Default.GetString(info.name) + " Status: " + info.status); aServerList.Add(info); } } }
private void EGMI_ACK_MOVE_IMMUNE(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ReqAckPlayerMove xData = new NFMsg.ReqAckPlayerMove(); xData = Serializer.Deserialize<NFMsg.ReqAckPlayerMove>(new MemoryStream(xMsg.msg_data)); if (xData.target_pos.Count <= 0) { return; } //其实就是jump float fSpeed = NFCKernelModule.Instance.QueryPropertyInt(PBToNF(xData.mover), "MOVE_SPEED") / 10000.0f; fSpeed *= 1.5f; //NFCRenderInterface.Instance.MoveImmuneBySpeed(PBToNF(xData.mover), new Vector3(xData.target_pos[0].x, xData.target_pos[0].y, xData.target_pos[0].z), fSpeed, true); }
private void EGMI_ACK_CONNECT_WORLD(MsgHead head, MemoryStream stream) { mNet.mxClient.Disconnect(); mNet.mxListener.FinalLog(); NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckConnectWorldResult xData = new NFMsg.AckConnectWorldResult(); xData = Serializer.Deserialize<NFMsg.AckConnectWorldResult>(new MemoryStream(xMsg.msg_data)); /// mNet.mPlayerState = NFNet.PLAYER_STATE.E_WAITING_PLAYER_TO_GATE; mNet.strKey = System.Text.Encoding.Default.GetString(xData.world_key); mNet.strWorldIP = System.Text.Encoding.Default.GetString(xData.world_ip); mNet.nWorldPort = xData.world_port; Debug.Log("SelectWorld SUCCESS ProxyIpPort: " + mNet.strWorldIP + ":" + mNet.nWorldPort + " Key: " + mNet.strKey); }
private void EGMI_ACK_RECORD_OBJECT(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ObjectRecordObject recordData = new NFMsg.ObjectRecordObject(); recordData = Serializer.Deserialize<NFMsg.ObjectRecordObject>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(recordData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(recordData.record_name)); for (int i = 0; i < recordData.property_list.Count; i++) { record.SetObject(recordData.property_list[i].row, recordData.property_list[i].col, PBToNF(recordData.property_list[i].data)); } }
private void EGMI_ACK_CONNECT_KEY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckEventResult xData = new NFMsg.AckEventResult(); xData = Serializer.Deserialize<NFMsg.AckEventResult>(new MemoryStream(xMsg.msg_data)); if (xData.event_code == EGameEventCode.EGEC_VERIFY_KEY_SUCCESS) { Debug.Log("VerifyKey SUCCESS"); //验证成功 mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_VERIFY; //mNet.nMainRoleID = PBToNF(xData.event_object); Debug.Log("QueryGameList"); //申请世界内的服务器列表 mNet.mxSendLogic.RequireServerList(); } else { Debug.Log("VerifyKey Failed"); } }
private void EGMI_ACK_ADD_ROW(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ObjectRecordAddRow recordData = new NFMsg.ObjectRecordAddRow(); recordData = Serializer.Deserialize<NFMsg.ObjectRecordAddRow>(new MemoryStream(xMsg.msg_data)); NFIObject go = NFCKernelModule.Instance.GetObject(PBToNF(recordData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); for (int i = 0; i < recordData.row_data.Count; i++) { ADD_ROW(PBToNF(recordData.player_id), System.Text.Encoding.Default.GetString(recordData.record_name), recordData.row_data[i]); } }
private void EGMI_ACK_SELECT_SERVER(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckEventResult xData = new NFMsg.AckEventResult(); xData = Serializer.Deserialize<NFMsg.AckEventResult>(new MemoryStream(xMsg.msg_data)); if (xData.event_code == EGameEventCode.EGEC_SELECTSERVER_SUCCESS) { Debug.Log("SelectGame SUCCESS "); Debug.Log("QueryRoleList"); //申请角色列表 mNet.mxSendLogic.RequireRoleList(mNet.strAccount, mNet.nServerID); } else { Debug.Log("SelectGame Failed "); } }
private void EGMI_ACK_OBJECT_RECORD_ENTRY(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.MultiObjectRecordList xMultiObjectRecordData = new NFMsg.MultiObjectRecordList(); xMultiObjectRecordData = Serializer.Deserialize<NFMsg.MultiObjectRecordList>(new MemoryStream(xMsg.msg_data)); for (int i = 0; i < xMultiObjectRecordData.multi_player_record.Count; i++) { NFMsg.ObjectRecordList xObjectRecordList = xMultiObjectRecordData.multi_player_record[i]; for (int j = 0; j < xObjectRecordList.record_list.Count; j++) { NFMsg.ObjectRecordBase xObjectRecordBase = xObjectRecordList.record_list[j]; for (int k = 0; k < xObjectRecordBase.row_struct.Count; ++k ) { NFMsg.RecordAddRowStruct xAddRowStruct = xObjectRecordBase.row_struct[k]; ADD_ROW(PBToNF(xObjectRecordList.player_id), System.Text.Encoding.Default.GetString(xObjectRecordBase.record_name), xAddRowStruct); } } } }
private void EGMI_ACK_ROLE_LIST(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.AckRoleLiteInfoList xData = new NFMsg.AckRoleLiteInfoList(); xData = Serializer.Deserialize<NFMsg.AckRoleLiteInfoList>(new MemoryStream(xMsg.msg_data)); Debug.Log("QueryRoleList SUCCESS"); aCharList.Clear(); for (int i = 0; i < xData.char_data.Count; ++i) { NFMsg.RoleLiteInfo info = xData.char_data[i]; aCharList.Add(info); } if (NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST != mNet.mPlayerState) { //NFCRenderInterface.Instance.LoadScene("SelectScene"); } mNet.mPlayerState = NFNet.PLAYER_STATE.E_HAS_PLAYER_ROLELIST; }
private void EGMI_ACK_CHAT(MsgHead head, MemoryStream stream) { NFMsg.MsgBase xMsg = new NFMsg.MsgBase(); xMsg = Serializer.Deserialize<NFMsg.MsgBase>(stream); NFMsg.ReqAckPlayerChat xReqAckChat = new NFMsg.ReqAckPlayerChat(); xReqAckChat = Serializer.Deserialize<NFMsg.ReqAckPlayerChat>(new MemoryStream(xMsg.msg_data)); aChatMsgList.Add(PBToNF(xReqAckChat.chat_id).ToString() + ":" + System.Text.Encoding.Default.GetString(xReqAckChat.chat_info)); }
public void RequireCreateRole(string strAccount, string strRoleName, int byCareer, int bySex, int nGameID) { if (strRoleName.Length >= 20 || strRoleName.Length < 1) { return; } NFMsg.ReqCreateRole xData = new NFMsg.ReqCreateRole(); xData.career = byCareer; xData.sex = bySex; xData.noob_name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(strAccount); xData.race = 0; xData.game_id = nGameID; MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqCreateRole>(stream, xData); SendMsg(new NFCoreEx.NFIDENTID(), NFMsg.EGameMsgID.EGMI_REQ_CREATE_ROLE, stream); if (NFStart.Instance.bDebugMode) { NFMsg.AckRoleLiteInfoList xAckBodyData = new NFMsg.AckRoleLiteInfoList(); NFMsg.RoleLiteInfo info = new NFMsg.RoleLiteInfo(); info.career = byCareer; info.sex = bySex; info.noob_name = xData.noob_name; info.race = xData.race; info.noob_name = xData.noob_name; info.id = new NFMsg.Ident(); info.game_id = 1; info.role_level = 1; info.view_record = xData.account = UnicodeEncoding.Default.GetBytes(""); info.delete_time = 1; info.reg_time = 1; info.last_offline_time = 1; info.last_offline_ip = 1; xAckBodyData.char_data.Add(info); MemoryStream xAckBodyStream = new MemoryStream(); Serializer.Serialize<NFMsg.AckRoleLiteInfoList>(xAckBodyStream, xAckBodyData); NFMsg.MsgBase xAckData = new NFMsg.MsgBase(); xAckData.player_id = info.id; xAckData.msg_data = xAckBodyStream.ToArray(); MemoryStream xAckAllStream = new MemoryStream(); Serializer.Serialize<NFMsg.MsgBase>(xAckAllStream, xAckData); MsgHead head = new MsgHead(); head.unMsgID = (UInt16)NFMsg.EGameMsgID.EGMI_ACK_ROLE_LIST; head.unDataLen = (UInt32)xAckAllStream.Length + (UInt32)ConstDefine.NF_PACKET_HEAD_SIZE; xNet.mxBinMsgEvent.OnMessageEvent(head, xAckAllStream.ToArray()); } }