Exemplo n.º 1
0
        private void EGMI_ACK_OBJECT_ENTRY(int id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

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

            for (int i = 0; i < xData.ObjectList.Count; ++i)
            {
                NFMsg.PlayerEntryInfo xInfo = xData.ObjectList[i];

                NFVector3 vPos = new NFVector3(xInfo.X, xInfo.Y, xInfo.Z);

                NFDataList var = new NFDataList();
                var.AddString(NFrame.NPC.Position);
                var.AddVector3(vPos);

                NFGUID xObjectID    = mHelpModule.PBToNF(xInfo.ObjectGuid);
                string strClassName = xInfo.ClassId.ToStringUtf8();
                string strConfigID  = xInfo.ConfigId.ToStringUtf8();

                Debug.Log("new Object enter: " + strClassName + xObjectID.ToString() + " " + xInfo.X + " " + xInfo.Y + " " + xInfo.Z);

                ObjectDataBuff xDataBuff = new ObjectDataBuff();
                mxObjectDataBuff.Add(xObjectID, xDataBuff);

                /*
                 * NFIObject xGO = mKernelModule.CreateObject(xObjectID, xInfo.scene_id, 0, strClassName, strConfigID, var);
                 * if (null == xGO)
                 * {
                 *  Debug.LogError("ID conflict: " + xObjectID.ToString() + "  ConfigID: " + strClassName);
                 *  continue;
                 * }
                 */
            }
        }
Exemplo n.º 2
0
        private void EGMI_ACK_OBJECT_PROPERTY_ENTRY(int id, MemoryStream stream)
        {
            NFMsg.MsgBase xMsg = NFMsg.MsgBase.Parser.ParseFrom(stream);

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

            for (int i = 0; i < xData.MultiPlayerProperty.Count; i++)
            {
                NFMsg.ObjectPropertyList xPropertyData = xData.MultiPlayerProperty[i];
                NFGUID xObjectID = mHelpModule.PBToNF(xPropertyData.PlayerId);

                ObjectDataBuff xDataBuff;
                if (mxObjectDataBuff.TryGetValue(xObjectID, out xDataBuff))
                {
                    xDataBuff.xPropertyList = xPropertyData;
                    if (xObjectID.IsNull())
                    {
                        AttachObjectData(xObjectID);
                    }
                }
                else
                {
                    xDataBuff = new ObjectDataBuff();
                    xDataBuff.xPropertyList     = xPropertyData;
                    mxObjectDataBuff[xObjectID] = xDataBuff;
                    AttachObjectData(xObjectID);
                }
            }
        }
Exemplo n.º 3
0
        private void EGMI_ACK_OBJECT_ENTRY(NFMsg.MsgBase xMsg)
        {
            NFMsg.AckPlayerEntryList xData = new NFMsg.AckPlayerEntryList();
            xData = mxSerializer.Deserialize(new MemoryStream(xMsg.msg_data), null, typeof(NFMsg.AckPlayerEntryList)) as NFMsg.AckPlayerEntryList;

            for (int i = 0; i < xData.object_list.Count; ++i)
            {
                NFMsg.PlayerEntryInfo xInfo = xData.object_list[i];

                NFVector3 vPos = new NFVector3(xInfo.x, xInfo.y, xInfo.z);

                NFDataList var = new NFDataList();
                var.AddString("Position");
                var.AddVector3(vPos);

                NFGUID xObjectID    = NFNetController.PBToNF(xInfo.object_guid);
                string strClassName = System.Text.Encoding.Default.GetString(xInfo.class_id);
                string strConfigID  = System.Text.Encoding.Default.GetString(xInfo.config_id);

                Debug.Log("new " + strClassName + " Object: " + xObjectID.ToString() + " " + xInfo.x + " " + xInfo.y + " " + xInfo.z);

                ObjectDataBuff xDataBuff = new ObjectDataBuff();
                mxObjectDataBuff.Add(xObjectID, xDataBuff);

                /*
                 * NFIObject xGO = NFCKernelModule.Instance.CreateObject(xObjectID, xInfo.scene_id, 0, strClassName, strConfigID, var);
                 * if (null == xGO)
                 * {
                 *      Debug.LogError("ID conflict: " + xObjectID.ToString() + "  ConfigID: " + strClassName);
                 *      continue;
                 * }
                 */
            }
        }