GetRecord() public abstract method

public abstract GetRecord ( string strRecordName ) : NFIRecord
strRecordName string
return NFIRecord
Example #1
0
        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_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();
                        }
                    }
                }
            }
        }
Example #3
0
        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_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]);
                }
            }
        }
Example #5
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);
        }
Example #6
0
        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]);
            }
        }
Example #7
0
        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_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());
            }
        }
Example #9
0
        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_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);
        }
Example #11
0
        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_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));
            }
        }
Example #13
0
        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 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);
        }
Example #15
0
        private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct)
        {
            NFIObject        go             = NFCKernelModule.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] = NFDataList.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] = NFDataList.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] = NFDataList.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] = NFDataList.VARIANT_TYPE.VTYPE_OBJECT;
                    recordVecData[addObjectStruct.col] = NFNetController.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;

                    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);
        }