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 = NFCKernel.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 NFIDENTID()); 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_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 = NFCKernel.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; } } }
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 = NFCKernel.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 NFIDENTID()); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetObject(PBToNF(xPropertyData.property_object_list[j].data)); } } }
private void ADD_ROW(NFIDENTID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct) { NFIObject go = NFCKernel.Instance.GetObject(self); 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] = NFIDataList.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] = NFIDataList.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] = NFIDataList.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] = NFIDataList.VARIANT_TYPE.VTYPE_OBJECT; recordVecData[addObjectStruct.col] = PBToNF(addObjectStruct.data); } } NFIDataList varListDesc = new NFCDataList(); NFIDataList varListData = new NFCDataList(); for (int m = 0; m < recordVecDesc.Count; m++) { if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m)) { NFIDataList.VARIANT_TYPE nType = (NFIDataList.VARIANT_TYPE)recordVecDesc[m]; switch (nType) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { varListDesc.AddInt(0); varListData.AddInt((Int64)recordVecData[m]); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { varListDesc.AddFloat(0.0f); varListData.AddFloat((float)recordVecData[m]); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { varListDesc.AddString(""); varListData.AddString((string)recordVecData[m]); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { varListDesc.AddObject(new NFIDENTID()); varListData.AddObject((NFIDENTID)recordVecData[m]); } break; default: break; } } else { //报错 //Debug.LogException(i); } } NFIRecord xRecord = xRecordManager.GetRecord(strRecordName); if (null == xRecord) { xRecord = xRecordManager.AddRecord(strRecordName, 512, varListDesc); } xRecord.AddRow(xAddStruct.row, varListData); }