Inheritance: global::ProtoBuf.IExtensible
Esempio n. 1
0
        private void EGMI_ACK_PROPERTY_VECTOR2(NFMsg.MsgBase xMsg)
        {
            NFMsg.ObjectPropertyVector2 xData = new NFMsg.ObjectPropertyVector2();
            xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.ObjectPropertyVector2)) as NFMsg.ObjectPropertyVector2;

            NFIObject go = NFCKernelModule.Instance.GetObject(NFNetController.PBToNF(xData.player_id));

            if (go == null)
            {
                return;
            }

            for (int i = 0; i < xData.property_list.Count; i++)
            {
                NFIPropertyManager propertyManager = go.GetPropertyManager();
                NFIProperty        property        = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(xData.property_list[i].property_name));
                if (null == property)
                {
                    NFDataList varList = new NFDataList();
                    varList.AddVector2(new NFVector2());

                    property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(xData.property_list[i].property_name), varList);
                }

                property.SetVector2(NFNetController.PBToNF(xData.property_list[i].data));
            }
        }
        private void EGMI_ACK_PROPERTY_VECTOR2(int id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ObjectPropertyVector2 xData = NFMsg.ObjectPropertyVector2.Parser.ParseFrom(xMsg.MsgData);

            NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(xData.PlayerId));

            if (go == null)
            {
                Debug.LogError("error id" + xData.PlayerId);
                return;
            }

            NFIPropertyManager propertyManager = go.GetPropertyManager();

            for (int i = 0; i < xData.PropertyList.Count; i++)
            {
                string        name = xData.PropertyList[i].PropertyName.ToStringUtf8();
                NFMsg.Vector2 data = xData.PropertyList[i].Data;

                NFIProperty property = propertyManager.GetProperty(name);
                if (null == property)
                {
                    NFDataList.TData var = new NFDataList.TData(NFDataList.VARIANT_TYPE.VTYPE_VECTOR2);
                    property = propertyManager.AddProperty(name, var);
                }

                property.SetVector2(mHelpModule.PBToNF(data));
            }
        }
Esempio n. 3
0
        private void OnPropertyVector2(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = new NFMsg.MsgBase();
            xMsg = Serializer.Deserialize <NFMsg.MsgBase>(stream);

            NFMsg.ObjectPropertyVector2 propertyData = new NFMsg.ObjectPropertyVector2();
            propertyData = Serializer.Deserialize <NFMsg.ObjectPropertyVector2>(new MemoryStream(xMsg.msg_data));

            NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(propertyData.player_id));

            for (int i = 0; i < propertyData.property_list.Count; i++)
            {
                NFIPropertyManager propertyManager = go.GetPropertyManager();
                NFIProperty        property        = propertyManager.GetProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name));
                if (null == property)
                {
                    NFDataList varList = new NFDataList();
                    varList.AddVector2(new NFVector2());

                    property = propertyManager.AddProperty(System.Text.Encoding.Default.GetString(propertyData.property_list[i].property_name), varList);
                }

                property.SetVector2(mHelpModule.PBToNF(propertyData.property_list[i].data));
            }
        }
Esempio n. 4
0
        public void RequirePropertyVector2(NFGUID objectID, string strPropertyName, NFVector2 newVar)
        {
            NFMsg.ObjectPropertyVector2 xData = new NFMsg.ObjectPropertyVector2();
            xData.PlayerId = mHelpModule.NFToPB(objectID);

            NFMsg.PropertyVector2 xProperty = new NFMsg.PropertyVector2();
            xProperty.PropertyName = ByteString.CopyFromUtf8(strPropertyName);
            xProperty.Data         = mHelpModule.NFToPB(newVar);
            xData.PropertyList.Add(xProperty);

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


            SendMsg((int)NFMsg.EGameMsgID.AckPropertyVector2, mxBody);
        }
    public void RequirePropertyVector2(NFrame.NFGUID objectID, string strPropertyName, NFIDataList.TData newVar)
    {
        NFMsg.ObjectPropertyVector2 xData = new NFMsg.ObjectPropertyVector2();
        xData.player_id = NFBinarySendLogic.NFToPB(objectID);

        NFMsg.PropertyVector2 xProperty = new NFMsg.PropertyVector2();
        xProperty.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName);
        xProperty.data          = NFBinarySendLogic.NFToPB(newVar.Vector2Val());
        xData.property_list.Add(xProperty);

        MemoryStream stream = new MemoryStream();

        Serializer.Serialize <NFMsg.ObjectPropertyVector2>(stream, xData);

        NFStart.Instance.GetFocusSender().SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR2, stream);
    }
Esempio n. 6
0
        public void RequirePropertyVector2(NFrame.NFGUID objectID, string strPropertyName, NFDataList.TData newVar)
        {
            NFMsg.ObjectPropertyVector2 xData = new NFMsg.ObjectPropertyVector2();
            xData.player_id = NFNetController.NFToPB(objectID);

            NFMsg.PropertyVector2 xProperty = new NFMsg.PropertyVector2();
            xProperty.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName);
            xProperty.data          = NFNetController.NFToPB(newVar.Vector2Val());
            xData.property_list.Add(xProperty);

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


            NFNetController.Instance.mxNetSender.SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR2, mxBody);
        }
Esempio n. 7
0
        private void OnPropertyVector2(UInt16 id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

            NFMsg.ObjectPropertyVector2 propertyData = NFMsg.ObjectPropertyVector2.Parser.ParseFrom(xMsg.msg_data);

            NFIObject go = mKernelModule.GetObject(mHelpModule.PBToNF(propertyData.player_id));

            for (int i = 0; i < propertyData.property_list.Count; i++)
            {
                NFIPropertyManager propertyManager = go.GetPropertyManager();
                NFIProperty        property        = propertyManager.GetProperty(propertyData.property_list[i].property_name.ToStringUtf8());
                if (null == property)
                {
                    NFDataList varList = new NFDataList();
                    varList.AddVector2(new NFVector2());

                    property = propertyManager.AddProperty(propertyData.property_list[i].property_name.ToStringUtf8(), varList);
                }

                property.SetVector2(mHelpModule.PBToNF(propertyData.property_list[i].data));
            }
        }
Esempio n. 8
0
    public void RequirePropertyVector2(NFrame.NFGUID objectID, string strPropertyName, NFIDataList.TData newVar)
    {
        NFMsg.ObjectPropertyVector2 xData = new NFMsg.ObjectPropertyVector2();
        xData.player_id = NFBinarySendLogic.NFToPB(objectID);

        NFMsg.PropertyVector2 xProperty = new NFMsg.PropertyVector2();
        xProperty.property_name = System.Text.Encoding.Default.GetBytes(strPropertyName);
        xProperty.data = NFBinarySendLogic.NFToPB(newVar.Vector2Val());
        xData.property_list.Add(xProperty);

        MemoryStream stream = new MemoryStream();
        Serializer.Serialize<NFMsg.ObjectPropertyVector2>(stream, xData);

        NFStart.Instance.GetFocusSender().SendMsg(objectID, NFMsg.EGameMsgID.EGMI_ACK_PROPERTY_VECTOR2, stream);
    }