Esempio n. 1
0
    public bool OnPlayerMove(NFIDataList valueList)
    {
        NFGUID tar = valueList.ObjectVal(0);


        if (tar == NFCPlayerLogic.Instance().mRoleID)
        {
            return(true);
        }

        OtherPlayer player = transform.Find(tar.ToString()).GetComponent <OtherPlayer>();

        double    fSpeed = valueList.FloatVal(1);
        NFVector3 pos    = valueList.Vector3Val(2);

        player.MoveTo(new Vector3(pos.X(), pos.Y(), pos.Z()));

        return(true);
    }
    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);
    }