Inheritance: global::ProtoBuf.IExtensible
Exemplo n.º 1
0
    public void RequireRecordObject(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar)
    {
        NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject();
        xData.player_id   = NFBinarySendLogic.NFToPB(self);
        xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

        NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
        xData.property_list.Add(xRecordObject);
        xRecordObject.row  = nRow;
        xRecordObject.col  = nCol;
        xRecordObject.data = NFBinarySendLogic.NFToPB(newVar.ObjectVal());

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ObjectRecordObject>(stream, xData);
        Debug.Log("send upload record object");
        SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, stream);
    }
Exemplo n.º 2
0
        public void RequireRecordObject(NFGUID objectID, string strRecordName, int nRow, int nCol, NFDataList.TData newVar)
        {
            NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject();
            xData.PlayerId   = mHelpModule.NFToPB(objectID);
            xData.RecordName = ByteString.CopyFromUtf8(strRecordName);

            NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
            xData.PropertyList.Add(xRecordObject);
            xRecordObject.Row  = nRow;
            xRecordObject.Col  = nCol;
            xRecordObject.Data = mHelpModule.NFToPB(newVar.ObjectVal());

            mxBody.SetLength(0);
            xData.WriteTo(mxBody);

            Debug.Log("send upload record object");
            SendMsg((int)NFMsg.EGameMsgID.AckRecordObject, mxBody);
        }
Exemplo n.º 3
0
        public void RequireRecordObject(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFDataList.TData newVar)
        {
            NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject();
            xData.player_id   = NFNetController.NFToPB(self);
            xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

            NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
            xData.property_list.Add(xRecordObject);
            xRecordObject.row  = nRow;
            xRecordObject.col  = nCol;
            xRecordObject.data = NFNetController.NFToPB(newVar.ObjectVal());

            mxBody.SetLength(0);
            mxSerializer.Serialize(mxBody, xData);

            Debug.Log("send upload record object");
            SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, mxBody);
        }
Exemplo n.º 4
0
        private void ADD_ROW(NFGUID self, string strRecordName, NFMsg.RecordAddRowStruct xAddStruct)
        {
            NFIObject go = mKernelModule.GetObject(self);

            if (go == null)
            {
                return;
            }
            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] = mHelpModule.PBToNF(addObjectStruct.data);
                }
            }

            for (int k = 0; k < xAddStruct.record_vector2_list.Count; ++k)
            {
                NFMsg.RecordVector2 addObjectStruct = (NFMsg.RecordVector2)xAddStruct.record_vector2_list[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.record_vector3_list.Count; ++k)
            {
                NFMsg.RecordVector3 addObjectStruct = (NFMsg.RecordVector3)xAddStruct.record_vector3_list[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)
            {
                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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
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] = NFIDataList.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] = NFIDataList.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] = NFIDataList.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] = NFIDataList.VARIANT_TYPE.VTYPE_OBJECT;
                    recordVecData[addObjectStruct.col] = PBToNF(addObjectStruct.data);
                }
            }

            NFIDataList varListDesc = new NFCDataList();
            NFIDataList varListData = new NFCDataList();

            for (int m = 0; m < recordVecDesc.Count; m++)
            {
                if (recordVecDesc.ContainsKey(m) && recordVecData.ContainsKey(m))
                {
                    NFIDataList.VARIANT_TYPE nType = (NFIDataList.VARIANT_TYPE)recordVecDesc[m];
                    switch (nType)
                    {
                    case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                    {
                        varListDesc.AddInt(0);
                        varListData.AddInt((Int64)recordVecData[m]);
                    }

                    break;

                    case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                    {
                        varListDesc.AddFloat(0.0f);
                        varListData.AddFloat((float)recordVecData[m]);
                    }
                    break;

                    case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                    {
                        varListDesc.AddString("");
                        varListData.AddString((string)recordVecData[m]);
                    }
                    break;

                    case NFIDataList.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);
        }
Exemplo n.º 7
0
    public void RequireAddRow(NFrame.NFGUID self, string strRecordName, int nRow)
    {
        NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow();
        xData.player_id   = NFBinarySendLogic.NFToPB(self);
        xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

        NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct();
        xData.row_data.Add(xRecordAddRowStruct);
        xRecordAddRowStruct.row = nRow;

        NFIObject   xObject  = NFCKernelModule.Instance.GetObject(self);
        NFIRecord   xRecord  = xObject.GetRecordManager().GetRecord(strRecordName);
        NFIDataList xRowData = xRecord.QueryRow(nRow);

        for (int i = 0; i < xRowData.Count(); i++)
        {
            switch (xRowData.GetType(i))
            {
            case NFIDataList.VARIANT_TYPE.VTYPE_INT:
            {
                NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt();
                xRecordInt.row  = nRow;
                xRecordInt.col  = i;
                xRecordInt.data = xRowData.IntVal(i);
                xRecordAddRowStruct.record_int_list.Add(xRecordInt);
            }
            break;

            case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
            {
                NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat();
                xRecordFloat.row  = nRow;
                xRecordFloat.col  = i;
                xRecordFloat.data = (float)xRowData.FloatVal(i);
                xRecordAddRowStruct.record_float_list.Add(xRecordFloat);
            }
            break;

            case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
            {
                NFMsg.RecordString xRecordString = new NFMsg.RecordString();
                xRecordString.row  = nRow;
                xRecordString.col  = i;
                xRecordString.data = System.Text.Encoding.Default.GetBytes(xRowData.StringVal(i));
                xRecordAddRowStruct.record_string_list.Add(xRecordString);
            }
            break;

            case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
            {
                NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
                xRecordObject.row  = nRow;
                xRecordObject.col  = i;
                xRecordObject.data = NFBinarySendLogic.NFToPB(xRowData.ObjectVal(i));
                xRecordAddRowStruct.record_object_list.Add(xRecordObject);
            }
            break;

            case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2:
            {
                NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2();
                xRecordVector.row  = nRow;
                xRecordVector.col  = i;
                xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector2Val(i));
                xRecordAddRowStruct.record_vector2_list.Add(xRecordVector);
            }
            break;

            case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3:
            {
                NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3();
                xRecordVector.row  = nRow;
                xRecordVector.col  = i;
                xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector3Val(i));
                xRecordAddRowStruct.record_vector3_list.Add(xRecordVector);
            }
            break;
            }
        }

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ObjectRecordAddRow>(stream, xData);
        Debug.Log("send upload record addRow");
        SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, stream);
    }
Exemplo n.º 8
0
    public void RequireRecordObject(NFrame.NFGUID self, string strRecordName, int nRow, int nCol, NFIDataList.TData newVar)
    {
        NFMsg.ObjectRecordObject xData = new NFMsg.ObjectRecordObject();
        xData.player_id = NFBinarySendLogic.NFToPB(self);
        xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

        NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
        xData.property_list.Add(xRecordObject);
        xRecordObject.row = nRow;
        xRecordObject.col = nCol;
        xRecordObject.data = NFBinarySendLogic.NFToPB(newVar.ObjectVal());

        MemoryStream stream = new MemoryStream();
        Serializer.Serialize<NFMsg.ObjectRecordObject>(stream, xData);
        Debug.Log("send upload record object");
        SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_RECORD_OBJECT, stream);
    }
Exemplo n.º 9
0
    public void RequireAddRow(NFrame.NFGUID self, string strRecordName, int nRow)
    {
        NFMsg.ObjectRecordAddRow xData = new NFMsg.ObjectRecordAddRow();
        xData.player_id = NFBinarySendLogic.NFToPB(self);
        xData.record_name = System.Text.Encoding.Default.GetBytes(strRecordName);

        NFMsg.RecordAddRowStruct xRecordAddRowStruct = new NFMsg.RecordAddRowStruct();
        xData.row_data.Add(xRecordAddRowStruct);
        xRecordAddRowStruct.row = nRow;

        NFIObject xObject = NFCKernelModule.Instance.GetObject(self);
        NFIRecord xRecord = xObject.GetRecordManager().GetRecord(strRecordName);
        NFIDataList xRowData = xRecord.QueryRow(nRow);
        for(int i = 0;i<xRowData.Count();i++)
        {
            switch(xRowData.GetType(i))
            {
                case NFIDataList.VARIANT_TYPE.VTYPE_INT:
                    {
                        NFMsg.RecordInt xRecordInt = new NFMsg.RecordInt();
                        xRecordInt.row = nRow;
                        xRecordInt.col = i;
                        xRecordInt.data = xRowData.IntVal(i);
                        xRecordAddRowStruct.record_int_list.Add(xRecordInt);
                    }
                    break;
                case NFIDataList.VARIANT_TYPE.VTYPE_FLOAT:
                    {
                        NFMsg.RecordFloat xRecordFloat = new NFMsg.RecordFloat();
                        xRecordFloat.row = nRow;
                        xRecordFloat.col = i;
                        xRecordFloat.data = (float)xRowData.FloatVal(i);
                        xRecordAddRowStruct.record_float_list.Add(xRecordFloat);
                    }
                    break;
                case NFIDataList.VARIANT_TYPE.VTYPE_STRING:
                    {
                        NFMsg.RecordString xRecordString = new NFMsg.RecordString();
                        xRecordString.row = nRow;
                        xRecordString.col = i;
                        xRecordString.data = System.Text.Encoding.Default.GetBytes(xRowData.StringVal(i));
                        xRecordAddRowStruct.record_string_list.Add(xRecordString);
                    }
                    break;
                case NFIDataList.VARIANT_TYPE.VTYPE_OBJECT:
                    {
                        NFMsg.RecordObject xRecordObject = new NFMsg.RecordObject();
                        xRecordObject.row = nRow;
                        xRecordObject.col = i;
                        xRecordObject.data = NFBinarySendLogic.NFToPB(xRowData.ObjectVal(i));
                        xRecordAddRowStruct.record_object_list.Add(xRecordObject);
                    }
                    break;
                case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR2:
                    {
                        NFMsg.RecordVector2 xRecordVector = new NFMsg.RecordVector2();
                        xRecordVector.row = nRow;
                        xRecordVector.col = i;
                        xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector2Val(i));
                        xRecordAddRowStruct.record_vector2_list.Add(xRecordVector);
                    }
                    break;
                case NFIDataList.VARIANT_TYPE.VTYPE_VECTOR3:
                    {
                        NFMsg.RecordVector3 xRecordVector = new NFMsg.RecordVector3();
                        xRecordVector.row = nRow;
                        xRecordVector.col = i;
                        xRecordVector.data = NFBinarySendLogic.NFToPB(xRowData.Vector3Val(i));
                        xRecordAddRowStruct.record_vector3_list.Add(xRecordVector);
                    }
                    break;

            }
        }

        MemoryStream stream = new MemoryStream();
        Serializer.Serialize<NFMsg.ObjectRecordAddRow>(stream, xData);
        Debug.Log("send upload record addRow");
        SendMsg(self, NFMsg.EGameMsgID.EGMI_ACK_ADD_ROW, stream);
    }
Exemplo n.º 10
0
        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());
            }

            if (self.IsNull())
            {
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < varListData.Count(); ++i)
                {
                    stringBuilder.Append(varListData.GetData(i).ToString());
                    stringBuilder.Append(";");
                }

                Debug.Log(strRecordName + " add row:" + stringBuilder.ToString());
            }

            xRecord.AddRow(xAddStruct.Row, varListData);
        }