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 OnClassPlayerEventHandler(NFGUID self, int nContainerID, int nGroupID, NFIObject.CLASS_EVENT_TYPE eType, string strClassName, string strConfigIndex) { if (eType == NFIObject.CLASS_EVENT_TYPE.OBJECT_CREATE_FINISH) { NFIClass classObject = mClassModule.GetElement(strClassName); NFIPropertyManager propertyManager = classObject.GetPropertyManager(); NFIRecordManager recordManager = classObject.GetRecordManager(); NFDataList propertyList = propertyManager.GetPropertyList(); NFDataList recordList = recordManager.GetRecordList(); for (int i = 0; i < propertyList.Count(); ++i) { NFIProperty propertyObject = propertyManager.GetProperty(propertyList.StringVal(i)); if (propertyObject.GetUpload()) { mKernelModule.RegisterPropertyCallback(self, propertyObject.GetKey(), OnPropertyDataHandler); } } for (int i = 0; i < recordList.Count(); ++i) { NFIRecord recordObject = recordManager.GetRecord(recordList.StringVal(i)); if (recordObject.GetUpload()) { mKernelModule.RegisterRecordCallback(self, recordObject.GetName(), RecordEventHandler); } } } }
void InitRecord(NFGUID self, string strClassName) { NFIClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFDataList xDataList = xLogicClass.GetRecordManager().GetRecordList(); for (int i = 0; i < xDataList.Count(); ++i) { string strRecordyName = xDataList.StringVal(i); NFIRecord xRecord = xLogicClass.GetRecordManager().GetRecord(strRecordyName); NFIObject xObject = GetObject(self); NFIRecordManager xRecordManager = xObject.GetRecordManager(); NFIRecord record = xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData()); if (record != null) { record.SetUpload(xRecord.GetUpload()); } } }
public void OnRecordHandler(NFGUID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFDataList.TData oldVar, NFDataList.TData newVar) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); if (!xRecord.GetUpload()) { return; } switch (eType) { case NFIRecord.eRecordOptype.Add: { NFNetController.Instance.mxNetSender.RequireAddRow(self, strRecordName, nRow); } break; case NFIRecord.eRecordOptype.Del: { NFNetController.Instance.mxNetSender.RequireRemoveRow(self, strRecordName, nRow); } break; case NFIRecord.eRecordOptype.Swap: { NFNetController.Instance.mxNetSender.RequireSwapRow(self, strRecordName, nRow, nCol); } break; case NFIRecord.eRecordOptype.Update: { switch (oldVar.GetType()) { case NFDataList.VARIANT_TYPE.VTYPE_INT: { NFNetController.Instance.mxNetSender.RequireRecordInt(self, strRecordName, nRow, nCol, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFNetController.Instance.mxNetSender.RequireRecordFloat(self, strRecordName, nRow, nCol, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_STRING: { NFNetController.Instance.mxNetSender.RequireRecordString(self, strRecordName, nRow, nCol, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFNetController.Instance.mxNetSender.RequireRecordObject(self, strRecordName, nRow, nCol, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFNetController.Instance.mxNetSender.RequireRecordVector2(self, strRecordName, nRow, nCol, newVar); } break; case NFDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFNetController.Instance.mxNetSender.RequireRecordVector3(self, strRecordName, nRow, nCol, newVar); } break; } } break; } }