private void EGMI_ACK_DATA_FINISHED(NFMsg.MsgBase xMsg) { NFMsg.AckPlayerEntryList xData = new NFMsg.AckPlayerEntryList(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.AckPlayerEntryList)) as NFMsg.AckPlayerEntryList; for (int i = 0; i < xData.object_list.Count; ++i) { NFMsg.PlayerEntryInfo xInfo = xData.object_list [i]; NFVector3 vPos = new NFVector3(xInfo.x, xInfo.y, xInfo.z); NFDataList var = new NFDataList(); var.AddString("Position"); var.AddVector3(vPos); NFGUID xObjectID = NFNetController.PBToNF(xInfo.object_guid); string strClassName = System.Text.Encoding.Default.GetString(xInfo.class_id); string strConfigID = System.Text.Encoding.Default.GetString(xInfo.config_id); Debug.Log("new " + strClassName + " Object: " + xObjectID.ToString() + " " + xInfo.x + " " + xInfo.y + " " + xInfo.z); ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(xObjectID, out xDataBuff)) { NFIObject xGO = NFCKernelModule.Instance.CreateObject(xObjectID, xInfo.scene_id, 0, strClassName, strConfigID, var); if (null == xGO) { Debug.LogError("ID conflict: " + xObjectID.ToString() + " ConfigID: " + strClassName); continue; } } } }
private void EGMI_ACK_DATA_FINISHED(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.AckPlayerEntryList xData = NFMsg.AckPlayerEntryList.Parser.ParseFrom(xMsg.MsgData); for (int i = 0; i < xData.ObjectList.Count; ++i) { NFMsg.PlayerEntryInfo xInfo = xData.ObjectList[i]; NFVector3 vPos = new NFVector3(xInfo.X, xInfo.Y, xInfo.Z); NFDataList var = new NFDataList(); var.AddString("Position"); var.AddVector3(vPos); NFGUID xObjectID = mHelpModule.PBToNF(xInfo.ObjectGuid); string strClassName = xInfo.ClassId.ToStringUtf8(); string strConfigID = xInfo.ConfigId.ToStringUtf8(); Debug.Log("create Object: " + strClassName + " " + xObjectID.ToString() + " " + strConfigID + " (" + xInfo.X + "," + xInfo.Y + "," + xInfo.Z + ")"); ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(xObjectID, out xDataBuff)) { NFIObject xGO = mKernelModule.CreateObject(xObjectID, xInfo.SceneId, 0, strClassName, strConfigID, var); if (null == xGO) { Debug.LogError("ID conflict: " + xObjectID.ToString() + " ConfigID: " + strClassName); continue; } } } }
private void EGMI_ACK_OBJECT_ENTRY(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.AckPlayerEntryList xData = NFMsg.AckPlayerEntryList.Parser.ParseFrom(xMsg.MsgData); for (int i = 0; i < xData.ObjectList.Count; ++i) { NFMsg.PlayerEntryInfo xInfo = xData.ObjectList[i]; NFVector3 vPos = new NFVector3(xInfo.X, xInfo.Y, xInfo.Z); NFDataList var = new NFDataList(); var.AddString(NFrame.NPC.Position); var.AddVector3(vPos); NFGUID xObjectID = mHelpModule.PBToNF(xInfo.ObjectGuid); string strClassName = xInfo.ClassId.ToStringUtf8(); string strConfigID = xInfo.ConfigId.ToStringUtf8(); Debug.Log("new Object enter: " + strClassName + xObjectID.ToString() + " " + xInfo.X + " " + xInfo.Y + " " + xInfo.Z); ObjectDataBuff xDataBuff = new ObjectDataBuff(); mxObjectDataBuff.Add(xObjectID, xDataBuff); /* * NFIObject xGO = mKernelModule.CreateObject(xObjectID, xInfo.scene_id, 0, strClassName, strConfigID, var); * if (null == xGO) * { * Debug.LogError("ID conflict: " + xObjectID.ToString() + " ConfigID: " + strClassName); * continue; * } */ } }
private void EGMI_ACK_OBJECT_ENTRY(NFMsg.MsgBase xMsg) { NFMsg.AckPlayerEntryList xData = new NFMsg.AckPlayerEntryList(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.AckPlayerEntryList)) as NFMsg.AckPlayerEntryList; for (int i = 0; i < xData.object_list.Count; ++i) { NFMsg.PlayerEntryInfo xInfo = xData.object_list[i]; NFVector3 vPos = new NFVector3(xInfo.x, xInfo.y, xInfo.z); NFDataList var = new NFDataList(); var.AddString(NFrame.NPC.Position); var.AddVector3(vPos); NFGUID xObjectID = NFNetController.PBToNF(xInfo.object_guid); string strClassName = System.Text.Encoding.Default.GetString(xInfo.class_id); string strConfigID = System.Text.Encoding.Default.GetString(xInfo.config_id); Debug.Log("new Object enter: " + strClassName + xObjectID.ToString() + " " + xInfo.x + " " + xInfo.y + " " + xInfo.z); ObjectDataBuff xDataBuff = new ObjectDataBuff(); mxObjectDataBuff.Add(xObjectID, xDataBuff); /* * NFIObject xGO = NFCKernelModule.Instance.CreateObject(xObjectID, xInfo.scene_id, 0, strClassName, strConfigID, var); * if (null == xGO) * { * Debug.LogError("ID conflict: " + xObjectID.ToString() + " ConfigID: " + strClassName); * continue; * } */ } }
private void EGMI_ACK_OBJECT_PROPERTY_ENTRY(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.MultiObjectPropertyList xData = NFMsg.MultiObjectPropertyList.Parser.ParseFrom(xMsg.MsgData); for (int i = 0; i < xData.MultiPlayerProperty.Count; i++) { NFMsg.ObjectPropertyList xPropertyData = xData.MultiPlayerProperty[i]; NFGUID xObjectID = mHelpModule.PBToNF(xPropertyData.PlayerId); Debug.Log("new property enter Object: " + xObjectID.ToString()); ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(xObjectID, out xDataBuff)) { xDataBuff.xPropertyList = xPropertyData; if (xObjectID.IsNull()) { AttachObjectData(xObjectID); } } else { xDataBuff = new ObjectDataBuff(); xDataBuff.xPropertyList = xPropertyData; mxObjectDataBuff[xObjectID] = xDataBuff; AttachObjectData(xObjectID); } } }
public GameObject CreateObject(NFrame.NFGUID ident, string strPrefabName, Vector3 vec, string strTag) { if (!mhtObject.ContainsKey(ident)) { try { GameObject xGameObject = GameObject.Instantiate(Resources.Load(strPrefabName)) as GameObject; mhtObject.Add(ident, xGameObject); GameObject.DontDestroyOnLoad(xGameObject); xGameObject.transform.position = vec; return(xGameObject); } catch { Debug.LogError("Load Prefab Failed " + ident.ToString() + " " + strPrefabName); } } return(null); }
private void EGMI_ACK_OBJECT_RECORD_ENTRY(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.MultiObjectRecordList xData = NFMsg.MultiObjectRecordList.Parser.ParseFrom(xMsg.MsgData); for (int i = 0; i < xData.MultiPlayerRecord.Count; i++) { NFMsg.ObjectRecordList xObjectRecordList = xData.MultiPlayerRecord[i]; NFGUID xObjectID = mHelpModule.PBToNF(xObjectRecordList.PlayerId); Debug.Log("new record enter Object: " + xObjectID.ToString()); ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(xObjectID, out xDataBuff)) { xDataBuff.xRecordList = xObjectRecordList; if (xObjectID.IsNull()) { AttachObjectData(xObjectID); } } } }
public void SetObjectID(NFrame.NFGUID xID) { mxID = xID; ObjectID = mxID.ToString(); }
private void AttachObjectData(NFGUID self) { Debug.Log("AttachObjectData : " + self.ToString()); ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(self, out xDataBuff)) { ////////////////record if (xDataBuff.xRecordList != null) { for (int j = 0; j < xDataBuff.xRecordList.RecordList.Count; j++) { NFMsg.ObjectRecordBase xObjectRecordBase = xDataBuff.xRecordList.RecordList[j]; string srRecordName = xObjectRecordBase.RecordName.ToStringUtf8(); for (int k = 0; k < xObjectRecordBase.RowStruct.Count; ++k) { NFMsg.RecordAddRowStruct xAddRowStruct = xObjectRecordBase.RowStruct[k]; ADD_ROW(self, xObjectRecordBase.RecordName.ToStringUtf8(), xAddRowStruct); } } xDataBuff.xRecordList = null; } ////////////////property if (xDataBuff.xPropertyList != null) { /// NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xDataBuff.xPropertyList.PlayerId)); NFIPropertyManager xPropertyManager = go.GetPropertyManager(); for (int j = 0; j < xDataBuff.xPropertyList.PropertyIntList.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyIntList[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_INT); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } //string className = mKernelModule.QueryPropertyString(self, NFrame.IObject.ClassName); //Debug.LogError (self.ToString() + " " + className + " " + strPropertyName + " : " + xDataBuff.xPropertyList.property_int_list[j].Data); xProperty.SetInt(xDataBuff.xPropertyList.PropertyIntList[j].Data); } for (int j = 0; j < xDataBuff.xPropertyList.PropertyFloatList.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyFloatList[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } xProperty.SetFloat(xDataBuff.xPropertyList.PropertyFloatList[j].Data); } for (int j = 0; j < xDataBuff.xPropertyList.PropertyStringList.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyStringList[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_STRING); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } //string className = mKernelModule.QueryPropertyString(self, NFrame.IObject.ClassName); //Debug.LogError(self.ToString() + " " + className + " " + strPropertyName + " : " + xDataBuff.xPropertyList.property_string_list[j].Data.ToStringUtf8()); xProperty.SetString(xDataBuff.xPropertyList.PropertyStringList[j].Data.ToStringUtf8()); } for (int j = 0; j < xDataBuff.xPropertyList.PropertyObjectList.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyObjectList[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } xProperty.SetObject(mHelpModule.PBToNF(xDataBuff.xPropertyList.PropertyObjectList[j].Data)); } for (int j = 0; j < xDataBuff.xPropertyList.PropertyVector2List.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyVector2List[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } xProperty.SetVector2(mHelpModule.PBToNF(xDataBuff.xPropertyList.PropertyVector2List[j].Data)); } for (int j = 0; j < xDataBuff.xPropertyList.PropertyVector3List.Count; j++) { string strPropertyName = xDataBuff.xPropertyList.PropertyVector3List[j].PropertyName.ToStringUtf8(); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3); xProperty = xPropertyManager.AddProperty(strPropertyName, var); } xProperty.SetVector3(mHelpModule.PBToNF(xDataBuff.xPropertyList.PropertyVector3List[j].Data)); } xDataBuff.xPropertyList = null; } } }