public void RequireRecordVector2(NFGUID objectID, string strRecordName, int nRow, int nCol, NFDataList.TData newVar) { NFMsg.ObjectRecordVector2 xData = new NFMsg.ObjectRecordVector2(); xData.PlayerId = mHelpModule.NFToPB(objectID); xData.RecordName = ByteString.CopyFromUtf8(strRecordName); NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.Row = nRow; xRecordVector.Col = nCol; xRecordVector.Data = mHelpModule.NFToPB(newVar.Vector2Val()); mxBody.SetLength(0); xData.WriteTo(mxBody); SendMsg((int)NFMsg.EGameMsgID.AckRecordVector2, mxBody); }
public void RequireRecordVector2(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar) { NFMsg.ObjectRecordVector2 xData = new NFMsg.ObjectRecordVector2(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.row = nRow; xRecordVector.col = nCol; xRecordVector.data = NFBinarySendLogic.NFToPB(newVar.Vector2Val()); MemoryStream stream = new MemoryStream(); Serializer.Serialize <NFMsg.ObjectRecordVector2>(stream, xData); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_VECTOR2, stream); }
public void RequireRecordVector2(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFDataList.TData newVar) { NFMsg.ObjectRecordVector2 xData = new NFMsg.ObjectRecordVector2(); xData.player_id = NFNetController.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.row = nRow; xRecordVector.col = nCol; xRecordVector.data = NFNetController.NFToPB(newVar.Vector2Val()); mxBody.SetLength(0); mxSerializer.Serialize(mxBody, xData); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_VECTOR2, mxBody); }
private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = mKernelModule.GetObject(self); if (go == null) { return; } NFIRecordManager xRecordManager = go.GetRecordManager(); Hashtable recordVecDesc = new Hashtable(); Hashtable recordVecData = new Hashtable(); for (int k = 0; k < xAddStruct.record_int_list.Count; ++k) { NFMsg.RecordInt addIntStruct = (NFMsg.RecordInt)xAddStruct.record_int_list[k]; if (addIntStruct.col >= 0) { recordVecDesc[addIntStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_INT; recordVecData[addIntStruct.col] = addIntStruct.data; } } for (int k = 0; k < xAddStruct.record_float_list.Count; ++k) { NFMsg.RecordFloat addFloatStruct = (NFMsg.RecordFloat)xAddStruct.record_float_list[k]; if (addFloatStruct.col >= 0) { recordVecDesc[addFloatStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_FLOAT; recordVecData[addFloatStruct.col] = addFloatStruct.data; } } for (int k = 0; k < xAddStruct.record_string_list.Count; ++k) { NFMsg.RecordString addStringStruct = (NFMsg.RecordString)xAddStruct.record_string_list[k]; if (addStringStruct.col >= 0) { recordVecDesc[addStringStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_STRING; recordVecData[addStringStruct.col] = System.Text.Encoding.Default.GetString(addStringStruct.data); } } for (int k = 0; k < xAddStruct.record_object_list.Count; ++k) { NFMsg.RecordObject addObjectStruct = (NFMsg.RecordObject)xAddStruct.record_object_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_OBJECT; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } for (int k = 0; k < xAddStruct.record_vector2_list.Count; ++k) { NFMsg.RecordVector2 addObjectStruct = (NFMsg.RecordVector2)xAddStruct.record_vector2_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR2; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } for (int k = 0; k < xAddStruct.record_vector3_list.Count; ++k) { NFMsg.RecordVector3 addObjectStruct = (NFMsg.RecordVector3)xAddStruct.record_vector3_list[k]; if (addObjectStruct.col >= 0) { recordVecDesc[addObjectStruct.col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR3; recordVecData[addObjectStruct.col] = mHelpModule.PBToNF(addObjectStruct.data); } } NFDataList varListDesc = new NFDataList(); NFDataList varListData = new NFDataList(); for (int m = 0; m < recordVecDesc.Count; m++) { if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m)) { NFDataList.VARIANT_TYPE nType = (NFDataList.VARIANT_TYPE)recordVecDesc[m]; switch (nType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { varListDesc.AddInt(0); varListData.AddInt((Int64)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { varListDesc.AddFloat(0.0f); varListData.AddFloat((float)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { varListDesc.AddString(""); varListData.AddString((string)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { varListDesc.AddObject(new NFGUID()); varListData.AddObject((NFGUID)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { varListDesc.AddVector2(new NFVector2()); varListData.AddVector2((NFVector2)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { varListDesc.AddVector3(new NFVector3()); varListData.AddVector3((NFVector3)recordVecData[m]); } break; default: break; } } else { //���� //Debug.LogException(i); } } NFIRecord xRecord = xRecordManager.GetRecord(strRecordName); if (null == xRecord) { string strClassName = mKernelModule.QueryPropertyString(self, NFrame.IObject.ClassName); NFIClass xLogicClass = mClassModule.GetElement(strClassName); NFIRecord xStaticRecord = xLogicClass.GetRecordManager().GetRecord(strRecordName); xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc, xStaticRecord.GetTagData()); } xRecord.AddRow(xAddStruct.row, varListData); }
public void RequireAddRow(NFGUID objectID, string strRecordName, int nRow) { NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow(); xData.PlayerId = mHelpModule.NFToPB(objectID); xData.RecordName = ByteString.CopyFromUtf8(strRecordName); NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct(); xData.RowData.Add(xRecordAddRowStruct); xRecordAddRowStruct.Row = nRow; NFIObject xObject = mKernelModule.GetObject(objectID); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); NFDataList xRowData = xRecord.QueryRow(nRow); for (int i = 0; i < xRowData.Count(); i++) { switch (xRowData.GetType(i)) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt(); xRecordInt.Row = nRow; xRecordInt.Col = i; xRecordInt.Data = xRowData.IntVal(i); xRecordAddRowStruct.RecordIntList.Add(xRecordInt); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat(); xRecordFloat.Row = nRow; xRecordFloat.Col = i; xRecordFloat.Data = (float)xRowData.FloatVal(i); xRecordAddRowStruct.RecordFloatList.Add(xRecordFloat); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFMsg.RecordString xRecordString = new NFMsg.RecordString(); xRecordString.Row = nRow; xRecordString.Col = i; xRecordString.Data = ByteString.CopyFromUtf8(xRowData.StringVal(i)); xRecordAddRowStruct.RecordStringList.Add(xRecordString); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject(); xRecordObject.Row = nRow; xRecordObject.Col = i; xRecordObject.Data = mHelpModule.NFToPB(xRowData.ObjectVal(i)); xRecordAddRowStruct.RecordObjectList.Add(xRecordObject); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.Row = nRow; xRecordVector.Col = i; xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector2Val(i)); xRecordAddRowStruct.RecordVector2List.Add(xRecordVector); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3(); xRecordVector.Row = nRow; xRecordVector.Col = i; xRecordVector.Data = mHelpModule.NFToPB(xRowData.Vector3Val(i)); xRecordAddRowStruct.RecordVector3List.Add(xRecordVector); } break; } } mxBody.SetLength(0); xData.WriteTo(mxBody); Debug.Log("send upload record addRow"); SendMsg((int)NFMsg.EGameMsgID.AckAddRow, mxBody); }
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 RequireRecordVector2(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar) { NFMsg.ObjectRecordVector2 xData = new NFMsg.ObjectRecordVector2(); xData.player_id = NFBinarySendLogic.NFToPB(self); xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName); NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2(); xRecordVector.row = nRow; xRecordVector.col = nCol; xRecordVector.data = NFBinarySendLogic.NFToPB(newVar.Vector2Val()); MemoryStream stream = new MemoryStream(); Serializer.Serialize<NFMsg.ObjectRecordVector2>(stream, xData); SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_VECTOR2, 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); }
private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = mKernelModule.GetObject(self); if (go == null) { Debug.LogError("error id" + self); return; } NFIRecordManager xRecordManager = go.GetRecordManager(); Hashtable recordVecDesc = new Hashtable(); Hashtable recordVecData = new Hashtable(); for (int k = 0; k < xAddStruct.RecordIntList.Count; ++k) { NFMsg.RecordInt addIntStruct = (NFMsg.RecordInt)xAddStruct.RecordIntList[k]; if (addIntStruct.Col >= 0) { recordVecDesc[addIntStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_INT; recordVecData[addIntStruct.Col] = addIntStruct.Data; } } for (int k = 0; k < xAddStruct.RecordFloatList.Count; ++k) { NFMsg.RecordFloat addFloatStruct = (NFMsg.RecordFloat)xAddStruct.RecordFloatList[k]; if (addFloatStruct.Col >= 0) { recordVecDesc[addFloatStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_FLOAT; recordVecData[addFloatStruct.Col] = addFloatStruct.Data; } } for (int k = 0; k < xAddStruct.RecordStringList.Count; ++k) { NFMsg.RecordString addStringStruct = (NFMsg.RecordString)xAddStruct.RecordStringList[k]; if (addStringStruct.Col >= 0) { recordVecDesc[addStringStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_STRING; if (addStringStruct.Data != null) { recordVecData[addStringStruct.Col] = addStringStruct.Data.ToStringUtf8(); } else { recordVecData[addStringStruct.Col] = ""; } } } for (int k = 0; k < xAddStruct.RecordObjectList.Count; ++k) { NFMsg.RecordObject addObjectStruct = (NFMsg.RecordObject)xAddStruct.RecordObjectList[k]; if (addObjectStruct.Col >= 0) { recordVecDesc[addObjectStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_OBJECT; recordVecData[addObjectStruct.Col] = mHelpModule.PBToNF(addObjectStruct.Data); } } for (int k = 0; k < xAddStruct.RecordVector2List.Count; ++k) { NFMsg.RecordVector2 addObjectStruct = (NFMsg.RecordVector2)xAddStruct.RecordVector2List[k]; if (addObjectStruct.Col >= 0) { recordVecDesc[addObjectStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR2; recordVecData[addObjectStruct.Col] = mHelpModule.PBToNF(addObjectStruct.Data); } } for (int k = 0; k < xAddStruct.RecordVector3List.Count; ++k) { NFMsg.RecordVector3 addObjectStruct = (NFMsg.RecordVector3)xAddStruct.RecordVector3List[k]; if (addObjectStruct.Col >= 0) { recordVecDesc[addObjectStruct.Col] = NFDataList.VARIANT_TYPE.VTYPE_VECTOR3; recordVecData[addObjectStruct.Col] = mHelpModule.PBToNF(addObjectStruct.Data); } } NFDataList varListDesc = new NFDataList(); NFDataList varListData = new NFDataList(); for (int m = 0; m < recordVecDesc.Count; m++) { if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m)) { NFDataList.VARIANT_TYPE nType = (NFDataList.VARIANT_TYPE)recordVecDesc[m]; switch (nType) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { varListDesc.AddInt(0); varListData.AddInt((Int64)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { varListDesc.AddFloat(0.0f); varListData.AddFloat((float)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { varListDesc.AddString(""); varListData.AddString((string)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { varListDesc.AddObject(new NFGUID()); varListData.AddObject((NFGUID)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { varListDesc.AddVector2(new NFVector2()); varListData.AddVector2((NFVector2)recordVecData[m]); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { varListDesc.AddVector3(new NFVector3()); varListData.AddVector3((NFVector3)recordVecData[m]); } break; default: break; } } else { //���� //Debug.LogException(i); } } NFIRecord xRecord = xRecordManager.GetRecord(strRecordName); if (null == xRecord) { Debug.Log("Empty record:" + strRecordName); string strClassName = mKernelModule.QueryPropertyString(self, NFrame.IObject.ClassName); NFIClass xLogicClass = mClassModule.GetElement(strClassName); NFIRecord xStaticRecord = xLogicClass.GetRecordManager().GetRecord(strRecordName); xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc, xStaticRecord.GetTagData()); } if (self.IsNull()) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < varListData.Count(); ++i) { stringBuilder.Append(varListData.GetData(i).ToString()); stringBuilder.Append(";"); } Debug.Log(strRecordName + " add row:" + stringBuilder.ToString()); } xRecord.AddRow(xAddStruct.Row, varListData); }