public static NFMsg.Ident NFToPB(NFrame.NFGUID xID) { NFMsg.Ident xIdent = new NFMsg.Ident(); xIdent.svrid = xID.nHead64; xIdent.index = xID.nData64; return xIdent; }
public void RequireRecordObject(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar) { NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject(); xData.property_list.Add(xRecordObject); xRecordObject.row = nRow; xRecordObject.col = nCol; xRecordObject.data = NFBinarySendLogic.NFToPB(newVar.ObjectVal()); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordObject>(stream, xData); Debug.Log("send upload record object"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, stream); }
public void RequireSwapRow(NFrame.NFGUID self, string strRecordName, int nOriginRow, int nTargetRow) { NFMsg.ObjectRecordSwap xData = new NFMsg.ObjectRecordSwap(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.origin_record_name = System.Text.Encoding.Default.GetBytes(strRecordName); xData.target_record_name = System.Text.Encoding.Default.GetBytes(strRecordName); xData.row_origin = nOriginRow; xData.row_target = nTargetRow; MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordSwap>(stream, xData); Debug.Log("send upload record swapRow"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_SWAP_ROW, stream); }
public void RequireRemoveRow(NFrame.NFGUID self, string strRecordName, int nRow) { NFMsg.ObjectRecordRemove xData = new NFMsg.ObjectRecordRemove(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); xData.remove_row.Add(nRow); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordRemove>(stream, xData); Debug.Log("send upload record removeRow"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_REMOVE_ROW, stream); }
public void RequireAddRow(NFrame.NFGUID self, string strRecordName, int nRow) { NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct(); xData.row_data.Add(xRecordAddRowStruct); xRecordAddRowStruct.row = nRow; NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); NFIDataList xRowData = xRecord.QueryRow(nRow); for(int i = 0;i<xRowData.Count();i++) { switch(xRowData.GetType(i)) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt(); xRecordInt.row = nRow; xRecordInt.col = i; xRecordInt.data = xRowData.IntVal(i); xRecordAddRowStruct.record_int_list.Add(xRecordInt); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat(); xRecordFloat.row = nRow; xRecordFloat.col = i; xRecordFloat.data = (float)xRowData.FloatVal(i); xRecordAddRowStruct.record_float_list.Add(xRecordFloat); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { NFMsg.RecordString xRecordString = new NFMsg.RecordString(); xRecordString.row = nRow; xRecordString.col = i; xRecordString.data = System.Text.Encoding.Default.GetBytes(xRowData.StringVal(i)); xRecordAddRowStruct.record_string_list.Add(xRecordString); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject(); xRecordObject.row = nRow; xRecordObject.col = i; xRecordObject.data = NFBinarySendLogic.NFToPB(xRowData.ObjectVal(i)); xRecordAddRowStruct.record_object_list.Add(xRecordObject); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.row = nRow; xRecordVector.col = i; xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector2Val(i)); xRecordAddRowStruct.record_vector2_list.Add(xRecordVector); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3(); xRecordVector.row = nRow; xRecordVector.col = i; xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector3Val(i)); xRecordAddRowStruct.record_vector3_list.Add(xRecordVector); } break; } } MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordAddRow>(stream, xData); Debug.Log("send upload record addRow"); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, stream); }
public void RequirePropertyVector3(NFrame.NFGUID objectID, string strPropertyName, NFIDataList.TData newVar) { NFMsg.ObjectPropertyVector3 xData = new NFMsg.ObjectPropertyVector3(); xData.player_id = NFBinarySendLogic.NFToPB(objectID); NFMsg.PropertyVector3 xProperty = new NFMsg.PropertyVector3(); xProperty.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName); xProperty.data = NFBinarySendLogic.NFToPB(newVar.Vector3Val()); xData.property_list.Add(xProperty); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectPropertyVector3>(stream, xData); NFStart.Instance.GetFocusSender().SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR3, stream); }
public void RequirePropertyObject(NFrame.NFGUID objectID, string strPropertyName, NFIDataList.TData newVar) { NFMsg.ObjectPropertyObject xData = new NFMsg.ObjectPropertyObject(); xData.player_id = NFBinarySendLogic.NFToPB(objectID); NFMsg.PropertyObject xPropertyObject = new NFMsg.PropertyObject(); xPropertyObject.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName); xPropertyObject.data = NFBinarySendLogic.NFToPB(newVar.ObjectVal()); xData.property_list.Add(xPropertyObject); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectPropertyObject>(stream, xData); Debug.Log("send upload Object"); NFStart.Instance.GetFocusSender().SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_OBJECT, stream); }
public void RequireDelRole(NFrame.NFGUID objectID, string strAccount, string strRoleName, int nGameID) { NFMsg.ReqDeleteRole xData = new NFMsg.ReqDeleteRole(); xData.name = UnicodeEncoding.Default.GetBytes(strRoleName); xData.account = UnicodeEncoding.Default.GetBytes(strAccount); xData.game_id = nGameID; MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqDeleteRole>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_DELETE_ROLE, stream); }
public void RequireCompeleteTask(NFrame.NFGUID objectID, string strTaskID) { NFMsg.ReqCompeleteTask xData = new NFMsg.ReqCompeleteTask(); xData.task_id = UnicodeEncoding.Default.GetBytes(strTaskID); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqCompeleteTask>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_COMPELETE_TASK, stream); }
public void RequireSwapScene(NFrame.NFGUID objectID, int nTransferType, int nSceneID, int nLineIndex) { NFMsg.ReqAckSwapScene xData = new NFMsg.ReqAckSwapScene(); xData.transfer_type = (NFMsg.ReqAckSwapScene.EGameSwapType)nTransferType; xData.scene_id = nSceneID; xData.line_id = nLineIndex; MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqAckSwapScene>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_SWAP_SCENE, stream); }
public void RequireChat(NFrame.NFGUID objectID, NFrame.NFGUID targetID, int nType, string strData) { NFMsg.ReqAckPlayerChat xData = new NFMsg.ReqAckPlayerChat(); xData.chat_id = NFToPB(targetID); xData.chat_name = UnicodeEncoding.Default.GetBytes(xNet.strRoleName); xData.chat_type = (NFMsg.ReqAckPlayerChat.EGameChatType)nType; xData.chat_info = UnicodeEncoding.Default.GetBytes(strData); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqAckPlayerChat>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_CHAT, stream); }
//有可能是他副本的NPC移动,因此增加64对象ID public void RequireUseSkill(NFrame.NFGUID objectID, string strKillID, NFrame.NFGUID 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); }
public void RequireMoveImmune(NFrame.NFGUID 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); }
public void RequireHeartBeat(NFrame.NFGUID objectID) { NFMsg.ReqHeartBeat xData = new NFMsg.ReqHeartBeat(); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqHeartBeat>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_STS_HEART_BEAT, stream); }
public void RequireEnterGameServer(NFrame.NFGUID 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); }
public void RequireRecordVector3(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar) { NFMsg.ObjectRecordVector3 xData = new NFMsg.ObjectRecordVector3(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3(); xRecordVector.row = nRow; xRecordVector.col = nCol; xRecordVector.data = NFBinarySendLogic.NFToPB(newVar.Vector3Val()); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordVector3>(stream, xData); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_VECTOR3, stream); }
public void RequirePickUpItem(NFrame.NFGUID objectID, NFrame.NFGUID nItemID) { NFMsg.ReqPickDropItem xData = new NFMsg.ReqPickDropItem(); xData.item_guid = NFToPB(nItemID); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ReqPickDropItem>(stream, xData); SendMsg(objectID, NFMsg.EGameMsgID.EGMI_REQ_PICK_ITEM, stream); }
public void SendMsg(NFrame.NFGUID 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); }