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); } } } }
private void EGMI_ACK_RECORD_CLEAR(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 objectRecordList = xData.MultiPlayerRecord[i]; for (int j = 0; j < objectRecordList.RecordList.Count; ++j) { NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(objectRecordList.PlayerId)); if (go == null) { Debug.LogError("error id" + objectRecordList.PlayerId); return; } NFMsg.ObjectRecordBase objectRecordBase = objectRecordList.RecordList[j]; string recordName = objectRecordBase.RecordName.ToStringUtf8(); NFIRecordManager recordManager = go.GetRecordManager(); if (recordManager != null) { NFIRecord record = recordManager.GetRecord(recordName); if (record != null) { record.Clear(); } } } } }
private void EGMI_ACK_REMOVE_ROW(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordRemove xData = NFMsg.ObjectRecordRemove.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { Debug.LogError("error id" + xData.PlayerId); return; } NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.RecordName.ToStringUtf8()); if (record != null) { for (int i = 0; i < xData.RemoveRow.Count; i++) { record.Remove(xData.RemoveRow[i]); } } }
public override void RegisterCallback(string strRecordName, NFIRecord.RecordEventHandler handler) { if (mhtRecord.ContainsKey(strRecordName)) { NFIRecord record = (NFIRecord)mhtRecord[strRecordName]; record.RegisterCallback(handler); } }
public override bool FindRecord(string strRecordName) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(true); } return(false); }
public override Int64 QueryRecordInt(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryInt(nRow, nCol)); } return(0); }
private void EGMI_ACK_SWAP_ROW(NFMsg.MsgBase xMsg) { NFMsg.ObjectRecordSwap xData = new NFMsg.ObjectRecordSwap(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ObjectRecordSwap)) as NFMsg.ObjectRecordSwap; NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(xData.origin_record_name)); record.SwapRow(xData.row_origin, xData.row_target); }
public override float QueryRecordFloat(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryFloat(nRow, nCol)); } return(0.0f); }
public override double QueryRecordDouble(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryDouble(nRow, nCol)); } return(0.0); }
public override string QueryRecordString(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryString(nRow, nCol)); } return(NFIDataList.NULL_STRING); }
public override NFGUID QueryRecordObject(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryObject(nRow, nCol)); } return(null); }
public override NFIRecord GetRecord(string strPropertyName) { NFIRecord record = null; if (mhtRecord.ContainsKey(strPropertyName)) { record = (NFIRecord)mhtRecord[strPropertyName]; } return(record); }
public override NFVector3 QueryRecordVector3(string strRecordName, int nRow, int nCol) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { return(record.QueryVector3(nRow, nCol)); } return(null); }
public override bool SetRecordFloat(string strRecordName, int nRow, int nCol, double fValue) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { record.SetFloat(nRow, nCol, fValue); return(true); } return(false); }
public override bool SetRecordObject(string strRecordName, int nRow, int nCol, NFGUID obj) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { record.SetObject(nRow, nCol, obj); return(true); } return(false); }
public override bool SetRecordString(string strRecordName, int nRow, int nCol, string strValue) { NFIRecord record = mRecordManager.GetRecord(strRecordName); if (null != record) { record.SetString(nRow, nCol, strValue); return(true); } return(false); }
private void EGMI_ACK_RECORD_OBJECT(NFMsg.MsgBase xMsg) { NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ObjectRecordObject)) as NFMsg.ObjectRecordObject; NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(xData.record_name)); for (int i = 0; i < xData.property_list.Count; i++) { record.SetObject(xData.property_list[i].row, xData.property_list[i].col, NFNetController.PBToNF(xData.property_list[i].data)); } }
private void EGMI_ACK_REMOVE_ROW(NFMsg.MsgBase xMsg) { NFMsg.ObjectRecordRemove xData = new NFMsg.ObjectRecordRemove(); xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ObjectRecordRemove)) as NFMsg.ObjectRecordRemove; NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(System.Text.Encoding.Default.GetString(xData.record_name)); for (int i = 0; i < xData.remove_row.Count; i++) { record.Remove(xData.remove_row[i]); } }
private void EGMI_ACK_RECORD_STRING(UInt16 id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordString xData = NFMsg.ObjectRecordString.Parser.ParseFrom(xMsg.msg_data); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.player_id)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.record_name.ToStringUtf8()); for (int i = 0; i < xData.property_list.Count; i++) { record.SetString(xData.property_list[i].row, xData.property_list[i].col, xData.property_list[i].data.ToStringUtf8()); } }
private void EGMI_ACK_RECORD_STRING(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordString xData = NFMsg.ObjectRecordString.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.RecordName.ToStringUtf8()); for (int i = 0; i < xData.PropertyList.Count; i++) { record.SetString(xData.PropertyList[i].Row, xData.PropertyList[i].Col, xData.PropertyList[i].Data.ToStringUtf8()); } }
void InitRecord(NFGUID self, string strClassName) { NFILogicClass xLogicClass = mxLogicClassModule.GetElement(strClassName); NFIDataList 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(); xRecordManager.AddRecord(strRecordyName, xRecord.GetRows(), xRecord.GetColsData()); } }
static void OnRecordEventHandler(NFGUID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFIDataList.TData oldVar, NFIDataList.TData newVar) { Debug.Log(self); Debug.Log(" "); Debug.Log(strRecordName); Debug.Log(" "); Debug.Log(eType.ToString()); Debug.Log(" "); Debug.Log(nRow); Debug.Log(" "); Debug.Log(nCol); Debug.Log(" "); Debug.Log(oldVar.IntVal()); Debug.Log(" "); Debug.Log(newVar.IntVal()); Debug.Log(" "); }
static void OnRecordEventHandler(NFGUID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFIDataList.TData oldVar, NFIDataList.TData newVar) { Console.Write(self); Console.Write(" "); Console.Write(strRecordName); Console.Write(" "); Console.Write(eType.ToString()); Console.Write(" "); Console.Write(nRow); Console.Write(" "); Console.Write(nCol); Console.Write(" "); Console.Write(oldVar.IntVal()); Console.Write(" "); Console.Write(oldVar.IntVal()); Console.WriteLine(" "); }
private void EGMI_ACK_SWAP_ROW(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordSwap xData = NFMsg.ObjectRecordSwap.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { Debug.LogError("error id" + xData.PlayerId); return; } NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.OriginRecordName.ToStringUtf8()); record.SwapRow(xData.RowOrigin, xData.RowTarget); }
private void EGMI_ACK_SWAP_ROW(UInt16 id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordSwap xData = NFMsg.ObjectRecordSwap.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; } NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.origin_record_name.ToStringUtf8()); record.SwapRow(xData.row_origin, xData.row_target); }
private void EGMI_ACK_RECORD_FLOAT(UInt16 id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordFloat xData = NFMsg.ObjectRecordFloat.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; } NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.record_name.ToStringUtf8()); for (int i = 0; i < xData.property_list.Count; i++) { record.SetFloat(xData.property_list[i].row, xData.property_list[i].col, (float)xData.property_list[i].data); } }
private void EGMI_ACK_RECORD_OBJECT(int id, MemoryStream stream) { NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream); NFMsg.ObjectRecordObject xData = NFMsg.ObjectRecordObject.Parser.ParseFrom(xMsg.MsgData); NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId)); if (go == null) { Debug.LogError("error id" + xData.PlayerId); return; } NFIRecordManager recordManager = go.GetRecordManager(); NFIRecord record = recordManager.GetRecord(xData.RecordName.ToStringUtf8()); for (int i = 0; i < xData.PropertyList.Count; i++) { record.SetObject(xData.PropertyList[i].Row, xData.PropertyList[i].Col, mHelpModule.PBToNF(xData.PropertyList[i].Data)); } }
public override void Shut() { NFIDataList xRecordList = mRecordManager.GetRecordList(); if (null != xRecordList) { for (int i = 0; i < xRecordList.Count(); ++i) { string strRecordName = xRecordList.StringVal(i); NFIRecord xRecord = mRecordManager.GetRecord(strRecordName); if (null != xRecord) { xRecord.Clear(); } } } mRecordManager = null; mPropertyManager = null; mHeartManager = null; return; }
///////////////////////////////////////////////////////////////// private void OnBuildRecordEventHandler(NFGUID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFIDataList oldVar, NFIDataList newVar) { }
public void OnRecordHandler(NFGUID self, string strRecordName, NFIRecord.eRecordOptype eType, int nRow, int nCol, NFIDataList.TData oldVar, NFIDataList.TData newVar) { NFIObject xObject = NFCKernelModule.Instance.GetObject(self); NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName); if (!xRecord.GetUpload()) { return; } switch(eType) { case NFIRecord.eRecordOptype.Add: { NFStart.Instance.GetFocusSender().RequireAddRow(self, strRecordName, nRow); } break; case NFIRecord.eRecordOptype.Del: { NFStart.Instance.GetFocusSender().RequireRemoveRow(self, strRecordName, nRow); } break; case NFIRecord.eRecordOptype.Swap: { NFStart.Instance.GetFocusSender().RequireSwapRow(self, strRecordName, nRow, nCol); } break; case NFIRecord.eRecordOptype.Update: { switch(oldVar.GetType()) { case NFIDataList.VARIANT_TYPE.VTYPE_INT: { NFStart.Instance.GetFocusSender().RequireRecordInt(self, strRecordName, nRow, nCol, newVar); } break; case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT: { NFStart.Instance.GetFocusSender().RequireRecordFloat(self, strRecordName, nRow, nCol, newVar); } break; case NFIDataList.VARIANT_TYPE.VTYPE_STRING: { NFStart.Instance.GetFocusSender().RequireRecordString(self, strRecordName, nRow, nCol, newVar); } break; case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT: { NFStart.Instance.GetFocusSender().RequireRecordObject(self, strRecordName, nRow, nCol, newVar); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2: { NFStart.Instance.GetFocusSender().RequireRecordVector2(self, strRecordName, nRow, nCol, newVar); } break; case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3: { NFStart.Instance.GetFocusSender().RequireRecordVector3(self, strRecordName, nRow, nCol, newVar); } break; } } break; } }
public abstract void RegisterRecordCallback(NFIDENTID self, string strRecordName, NFIRecord.RecordEventHandler handler);
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); }
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()); } xRecord.AddRow(xAddStruct.Row, varListData); }
public override void RegisterRecordCallback(NFGUID self, string strRecordName, NFIRecord.RecordEventHandler handler) { NFIObject xGameObject = GetObject(self); if (null != xGameObject) { xGameObject.GetRecordManager().RegisterCallback(strRecordName, handler); } }
private void LoadLogicClassRecord(string strName) { NFIClass xLogicClass = GetElement(strName); if (null != xLogicClass) { string strLogicPath = mstrPath + xLogicClass.GetPath(); XmlDocument xmldoc = new XmlDocument(); if (mbEncrypt) { /////////////////////////////////////////////////////////////////////////////////////// StreamReader cepherReader = new StreamReader(strLogicPath);; string strContent = cepherReader.ReadToEnd(); cepherReader.Close(); byte[] data = Convert.FromBase64String(strContent); string res = System.Text.ASCIIEncoding.Default.GetString(data); xmldoc.LoadXml(res); ///////////////////////////////////////////////////////////////// } else { xmldoc.Load(strLogicPath); } XmlNode xRoot = xmldoc.SelectSingleNode("XML"); XmlNode xNodePropertys = xRoot.SelectSingleNode("Records"); if (null != xNodePropertys) { XmlNodeList xNodeList = xNodePropertys.SelectNodes("Record"); if (null != xNodeList) { for (int i = 0; i < xNodeList.Count; ++i) { XmlNode xRecordNode = xNodeList.Item(i); string strID = xRecordNode.Attributes["Id"].Value; string strRow = xRecordNode.Attributes["Row"].Value; string strUpload = xRecordNode.Attributes["Upload"].Value; bool bUpload = strUpload.Equals("1"); NFDataList xValue = new NFDataList(); XmlNodeList xTagNodeList = xRecordNode.SelectNodes("Col"); for (int j = 0; j < xTagNodeList.Count; ++j) { XmlNode xColTagNode = xTagNodeList.Item(j); XmlAttribute strTagID = xColTagNode.Attributes["Tag"]; XmlAttribute strTagType = xColTagNode.Attributes["Type"]; switch (strTagType.Value) { case "int": { xValue.AddInt(0); } break; case "float": { xValue.AddFloat(0.0); } break; case "string": { xValue.AddString(""); } break; case "object": { xValue.AddObject(new NFGUID(0, 0)); } break; case "vector2": { xValue.AddVector2(NFVector2.Zero()); } break; case "vector3": { xValue.AddVector3(NFVector3.Zero()); } break; default: break; } } NFIRecord xRecord = xLogicClass.GetRecordManager().AddRecord(strID, int.Parse(strRow), xValue); xRecord.SetUpload(bUpload); } } } } }
public abstract void RegisterCallback(string strRecordName, NFIRecord.RecordEventHandler handler);