public abstract GetPropertyManager ( ) : |
||
return |
private void EGMI_ACK_PROPERTY_FLOAT(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectPropertyFloat xData = NFMsg.ObjectPropertyFloat.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { return; } NFIPropertyManager propertyManager = go.GetPropertyManager(); for (int i = 0; i < xData.PropertyList.Count; i++) { string name = xData.PropertyList[i].PropertyName.ToStringUtf8(); float data = xData.PropertyList[i].Data; NFIProperty property = propertyManager.GetProperty(name); if (null == property) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_FLOAT); property = propertyManager.AddProperty(name, var); } property.SetFloat(data); } }
private void EGMI_ACK_PROPERTY_VECTOR3(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectPropertyVector3 xData = NFMsg.ObjectPropertyVector3.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { Debug.LogError("error id" + xData.PlayerId); return; } NFIPropertyManager propertyManager = go.GetPropertyManager(); for (int i = 0; i < xData.PropertyList.Count; i++) { string name = xData.PropertyList[i].PropertyName.ToStringUtf8(); NFMsg.Vector3 data = xData.PropertyList[i].Data; NFIProperty property = propertyManager.GetProperty(name); if (null == property) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR3); property = propertyManager.AddProperty(name, var); } property.SetVector3(mHelpModule.PBToNF(data)); } }
public void OnClassHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); NFDataList xPropertyNameList = xPropertyManager.GetPropertyList(); for (int i = 0; i < xPropertyNameList.Count(); i++) { string strPropertyName = xPropertyNameList.StringVal(i); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (xProperty.GetUpload()) { xProperty.RegisterCallback(OnPropertyHandler); } } NFIRecordManager xRecordManager = xObject.GetRecordManager(); NFDataList xRecordNameList = xRecordManager.GetRecordList(); for (int i = 0; i < xRecordNameList.Count(); i++) { string strRecodeName = xRecordNameList.StringVal(i); NFIRecord xRecord = xRecordManager.GetRecord(strRecodeName); if (xRecord.GetUpload()) { xRecord.RegisterCallback(OnRecordHandler); } } } }
private void EGMI_ACK_PROPERTY_OBJECT(UInt16 id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectPropertyObject xData = NFMsg.ObjectPropertyObject.Parser.ParseFrom(xMsg.msg_data); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.player_id)); if (go == null) { Debug.LogError("error id" + xData.player_id); return; } NFIPropertyManager propertyManager = go.GetPropertyManager(); for (int i = 0; i < xData.property_list.Count; i++) { string name = xData.property_list[i].property_name.ToStringUtf8(); NFMsg.Ident data = xData.property_list[i].data; NFIProperty property = propertyManager.GetProperty(name); if (null == property) { NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_OBJECT); property = propertyManager.AddProperty(name, var); } property.SetObject(mHelpModule.PBToNF(data)); } }
private void EGMI_ACK_PROPERTY_VECTOR3(NFMsg.MsgBase xMsg) { NFMsg.ObjectPropertyVector3 xData = new NFMsg.ObjectPropertyVector3(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ObjectPropertyVector3)) as NFMsg.ObjectPropertyVector3; NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xData.player_id)); if (go == null) { return; } for (int i = 0; i < xData.property_list.Count; i++) { NFIPropertyManager propertyManager = go.GetPropertyManager(); NFIProperty property = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(xData.property_list[i].property_name)); if (null == property) { NFDataList varList = new NFDataList(); varList.AddVector3(new NFVector3()); property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(xData.property_list[i].property_name), varList); } property.SetVector3(NFNetController.PBToNF(xData.property_list[i].data)); } }
public override void RegisterPropertyCallback(NFGUID self, string strPropertyName, NFIProperty.PropertyEventHandler handler) { NFIObject xGameObject = GetObject(self); if (null != xGameObject) { xGameObject.GetPropertyManager().RegisterCallback(strPropertyName, handler); } }
public void OnPropertyHandler(NFGUID self, string strPropertyName, NFDataList.TData oldVar, NFDataList.TData newVar) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIProperty xProperty = xObject.GetPropertyManager().GetProperty(strPropertyName); if (!xProperty.GetUpload()) { return; } switch (oldVar.GetType()) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { NFNetController.Instance.mxNetSender.RequirePropertyInt(self, strPropertyName, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFNetController.Instance.mxNetSender.RequirePropertyFloat(self, strPropertyName, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFNetController.Instance.mxNetSender.RequirePropertyString(self, strPropertyName, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFNetController.Instance.mxNetSender.RequirePropertyObject(self, strPropertyName, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFNetController.Instance.mxNetSender.RequirePropertyVector2(self, strPropertyName, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFNetController.Instance.mxNetSender.RequirePropertyVector3(self, strPropertyName, newVar); } break; } }
void InitProperty(NFGUID self, string strClassName) { NFILogicClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFIDataList xDataList = xLogicClass.GetPropertyManager().GetPropertyList(); for (int i = 0; i < xDataList.Count(); ++i) { string strPropertyName = xDataList.StringVal(i); NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(strPropertyName); NFIObject xObject = GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); xPropertyManager.AddProperty(strPropertyName, xProperty.GetData()); } }
private void EGMI_ACK_PROPERTY_CLEAR(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectPropertyVector3 xData = NFMsg.ObjectPropertyVector3.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { Debug.LogError("error id" + xData.PlayerId); return; } NFIPropertyManager propertyManager = go.GetPropertyManager(); //propertyManager. }
void InitProperty(NFGUID self, string strClassName) { NFIClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFDataList xDataList = xLogicClass.GetPropertyManager().GetPropertyList(); for (int i = 0; i < xDataList.Count(); ++i) { string strPropertyName = xDataList.StringVal(i); NFIProperty xProperty = xLogicClass.GetPropertyManager().GetProperty(strPropertyName); NFIObject xObject = GetObject(self); NFIPropertyManager xPropertyManager = xObject.GetPropertyManager(); NFIProperty property = xPropertyManager.AddProperty(strPropertyName, xProperty.GetData()); //if property==null ,means this property alreay exist in manager if (property != null) { property.SetUpload(xProperty.GetUpload()); } } }
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; } } }
public static void Main() { NFIKernelModule kernel = NFCKernelModule.Instance; Console.WriteLine("****************NFDataList******************"); NFDataList var = new NFDataList(); for (int i = 0; i < 9; i += 3) { var.AddInt(i); var.AddFloat((float)i + 1); var.AddString((i + 2).ToString()); } for (int i = 0; i < 9; i += 3) { Int64 n = var.IntVal(i); double f = var.FloatVal(i + 1); string str = var.StringVal(i + 2); Console.WriteLine(n); Console.WriteLine(f); Console.WriteLine(str); } Console.WriteLine("***************NFProperty*******************"); NFGUID ident = new NFGUID(0, 1); NFIObject gameObject = kernel.CreateObject(ident, 0, 0, "", "", new NFDataList()); NFDataList valueProperty = new NFDataList(); valueProperty.AddInt(112221); gameObject.GetPropertyManager().AddProperty("111", valueProperty); Console.WriteLine(gameObject.QueryPropertyInt("111")); Console.WriteLine("***************NFRecord*******************"); NFDataList valueRecord = new NFDataList(); valueRecord.AddInt(0); valueRecord.AddFloat(0); valueRecord.AddString(""); valueRecord.AddObject(ident); gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord); kernel.SetRecordInt(ident, "testRecord", 0, 0, 112221); kernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f); kernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221"); kernel.SetRecordObject(ident, "testRecord", 0, 3, ident); Console.WriteLine(gameObject.QueryRecordInt("testRecord", 0, 0)); Console.WriteLine(gameObject.QueryRecordFloat("testRecord", 0, 1)); Console.WriteLine(gameObject.QueryRecordString("testRecord", 0, 2)); Console.WriteLine(gameObject.QueryRecordObject("testRecord", 0, 3)); Console.WriteLine(" "); Console.WriteLine("***************PropertyNFEvent*******************"); //挂属性回调,挂表回调 kernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler); kernel.SetPropertyInt(ident, "111", 2456); Console.WriteLine(" "); Console.WriteLine("***************RecordNFEvent*******************"); kernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler); kernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111); Console.WriteLine(" "); Console.WriteLine("***************ClassNFEvent*******************"); kernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler); kernel.CreateObject(new NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFDataList()); kernel.DestroyObject(new NFGUID(0, 2)); Console.WriteLine(" "); Console.WriteLine("***************NFHeartBeat*******************"); kernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1); while (true) { System.Threading.Thread.Sleep(1000); kernel.Execute(1.0f); } }
private void AttachObjectData(NFGUID self) { ObjectDataBuff xDataBuff; if (mxObjectDataBuff.TryGetValue(self, out xDataBuff)) { ////////////////record for (int j = 0; j < xDataBuff.xRecordList.record_list.Count; j++) { NFMsg.ObjectRecordBase xObjectRecordBase = xDataBuff.xRecordList.record_list[j]; string srRecordName = System.Text.Encoding.Default.GetString(xObjectRecordBase.record_name); for (int k = 0; k < xObjectRecordBase.row_struct.Count; ++k) { NFMsg.RecordAddRowStruct xAddRowStruct = xObjectRecordBase.row_struct[k]; ADD_ROW(self, System.Text.Encoding.Default.GetString(xObjectRecordBase.record_name), xAddRowStruct); } } ////////////////property NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xDataBuff.xPropertyList.player_id)); NFIPropertyManager xPropertyManager = go.GetPropertyManager(); for (int j = 0; j < xDataBuff.xPropertyList.property_int_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_int_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddInt(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetInt(xDataBuff.xPropertyList.property_int_list[j].data); } for (int j = 0; j < xDataBuff.xPropertyList.property_float_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_float_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddFloat(0); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetFloat(xDataBuff.xPropertyList.property_float_list[j].data); } for (int j = 0; j < xDataBuff.xPropertyList.property_string_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_string_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddString(""); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetString(System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_string_list[j].data)); } for (int j = 0; j < xDataBuff.xPropertyList.property_object_list.Count; j++) { string strPropertyName = System.Text.Encoding.Default.GetString(xDataBuff.xPropertyList.property_object_list[j].property_name); NFIProperty xProperty = xPropertyManager.GetProperty(strPropertyName); if (null == xProperty) { NFDataList varList = new NFDataList(); varList.AddObject(new NFGUID()); xProperty = xPropertyManager.AddProperty(strPropertyName, varList); } xProperty.SetObject(NFNetController.PBToNF(xDataBuff.xPropertyList.property_object_list[j].data)); } } }
public void MainU3D() { Debug.Log("****************NFIDataList******************"); NFIDataList var = new NFCDataList(); for (int i = 0; i < 9; i += 3) { var.AddInt(i); var.AddFloat((float)i + 1); var.AddString((i + 2).ToString()); } for (int i = 0; i < 9; i += 3) { Int64 n = var.IntVal(i); double f = var.FloatVal(i + 1); string str = var.StringVal(i + 2); Debug.Log(n); Debug.Log(f); Debug.Log(str); } Debug.Log("***************NFProperty*******************"); NFGUID ident = new NFGUID(0, 1); NFIObject gameObject = xKernel.CreateObject(ident, 0, 0, "", "", new NFCDataList()); NFIDataList valueProperty = new NFCDataList(); valueProperty.AddInt(112221); gameObject.GetPropertyManager().AddProperty("111", valueProperty); Debug.Log(gameObject.QueryPropertyInt("111")); Debug.Log("***************NFRecord*******************"); NFIDataList valueRecord = new NFCDataList(); valueRecord.AddInt(0); valueRecord.AddFloat(0); valueRecord.AddString(""); valueRecord.AddObject(ident); gameObject.GetRecordManager().AddRecord("testRecord", 10, valueRecord); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 112221); xKernel.SetRecordFloat(ident, "testRecord", 0, 1, 1122210.0f); xKernel.SetRecordString(ident, "testRecord", 0, 2, ";;;;;;112221"); xKernel.SetRecordObject(ident, "testRecord", 0, 3, ident); Debug.Log(gameObject.QueryRecordInt("testRecord", 0, 0)); Debug.Log(gameObject.QueryRecordFloat("testRecord", 0, 1)); Debug.Log(gameObject.QueryRecordString("testRecord", 0, 2)); Debug.Log(gameObject.QueryRecordObject("testRecord", 0, 3)); Debug.Log(" "); Debug.Log("***************PropertyNFEvent*******************"); //挂属性回调,挂表回调 xKernel.RegisterPropertyCallback(ident, "111", OnPropertydHandler); xKernel.SetPropertyInt(ident, "111", 2456); Debug.Log(" "); Debug.Log("***************RecordNFEvent*******************"); xKernel.RegisterRecordCallback(ident, "testRecord", OnRecordEventHandler); xKernel.SetRecordInt(ident, "testRecord", 0, 0, 1111111); Debug.Log(" "); Debug.Log("***************ClassNFEvent*******************"); xKernel.RegisterClassCallBack("CLASSAAAAA", OnClassHandler); xKernel.CreateObject(new NFGUID(0, 2), 0, 0, "CLASSAAAAA", "CONFIGINDEX", new NFCDataList()); xKernel.DestroyObject(new NFGUID(0, 2)); Debug.Log(" "); Debug.Log("***************NFHeartBeat*******************"); xKernel.AddHeartBeat(new NFGUID(0, 1), "TestHeartBeat", HeartBeatEventHandler, 5.0f, 1); }