当前位置: 首页>>代码示例>>C#>>正文


C# Simulator.SendPacket方法代码示例

本文整理汇总了C#中libsecondlife.Simulator.SendPacket方法的典型用法代码示例。如果您正苦于以下问题:C# Simulator.SendPacket方法的具体用法?C# Simulator.SendPacket怎么用?C# Simulator.SendPacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libsecondlife.Simulator的用法示例。


在下文中一共展示了Simulator.SendPacket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendPacket

 /// <summary>
 /// Send a raw byte array as a packet to the specified simulator
 /// </summary>
 /// <param name="payload">Byte array containing a packet</param>
 /// <param name="simulator">Simulator to send the packet to</param>
 /// <param name="setSequence">Whether to set the second, third, and fourth
 /// bytes of the payload to the current sequence number</param>
 public void SendPacket(byte[] payload, Simulator simulator, bool setSequence)
 {
     if (simulator != null)
         simulator.SendPacket(payload, setSequence);
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:12,代码来源:NetworkManager.cs

示例2: SendPacket

 /// <summary>
 /// 
 /// </summary>
 /// <param name="packet"></param>
 /// <param name="simulator"></param>
 public void SendPacket(Packet packet, Simulator simulator)
 {
     if (simulator.Connected)
     {
         simulator.SendPacket(packet, true);
     }
 }
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:12,代码来源:NetworkManager.cs

示例3: ParcelPropertiesHandler

        private void ParcelPropertiesHandler(Packet packet, Simulator simulator)
        {
            ParcelPropertiesPacket properties = (ParcelPropertiesPacket)packet;

            byte[] Bitmap = properties.ParcelData.Bitmap;
            int LocalID = properties.ParcelData.LocalID;

            // Mark this area as downloaded
            int x, y, index, subindex;
            byte val;

            for (x = 0; x < 64; x++)
            {
                for (y = 0; y < 64; y++)
                {
                    if (simulator.Region.ParcelMarked[y, x] == 0)
                    {
                        index = ((x * 64) + y);
                        subindex = index % 8;
                        index /= 8;

                        val = Bitmap[index];

                        simulator.Region.ParcelMarked[y, x] = ((val >> subindex) & 1) == 1 ? LocalID : 0;
                    }
                }
            }

            // Fire off the next request, if we are downloading the whole sim
            bool hasTriggered = false;
            if (simulator.Region.ParcelDownloading)
            {
                for (x = 0; x < 64; x++)
                {
                    for (y = 0; y < 64; y++)
                    {
                        if (simulator.Region.ParcelMarked[x, y] == 0)
                        {
                            ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket();
                            tPacket.AgentData.AgentID = Client.Network.AgentID;
                            tPacket.AgentData.SessionID = Client.Network.SessionID;
                            tPacket.ParcelData.SequenceID = -10000;
                            tPacket.ParcelData.West = (x * 4.0f);
                            tPacket.ParcelData.South = (y * 4.0f);
                            tPacket.ParcelData.East = (x * 4.0f) + 4.0f;
                            tPacket.ParcelData.North = (y * 4.0f) + 4.0f;

                            simulator.SendPacket((Packet)tPacket, true);

                            hasTriggered = true;

                            goto exit;
                        }
                    }
                }
            exit:
                ;
            }

            // This map is complete, fire callback
            if (!hasTriggered)
            {
                simulator.Region.FilledParcels();
            }

            Parcel parcel = null;

            lock (simulator.Region.Parcels)
            {
                if (!simulator.Region.Parcels.ContainsKey(LocalID))
                {
                    simulator.Region.Parcels[LocalID] = new Parcel(simulator);
                }

                parcel = simulator.Region.Parcels[LocalID];
            }

            // Save this parcels data
            // TODO: Lots of values are not being stored, Parcel needs to be expanded to take all the data.
            // August2006:  God help me should I have to type this out again... argh.
            // October2006: I really shouldnt have typed that.
            parcel.RequestResult       = properties.ParcelData.RequestResult;
            parcel.SequenceID          = properties.ParcelData.SequenceID;
            parcel.SnapSelection       = properties.ParcelData.SnapSelection;
            parcel.SelfCount           = properties.ParcelData.SelfCount;
            parcel.OtherCount          = properties.ParcelData.OtherCount;
            parcel.PublicCount         = properties.ParcelData.PublicCount;
            parcel.LocalID             = LocalID;
            parcel.OwnerID             = properties.ParcelData.OwnerID;
            parcel.IsGroupOwned        = properties.ParcelData.IsGroupOwned;
            parcel.AuctionID           = properties.ParcelData.AuctionID;
            parcel.ReservedNewbie      = properties.ParcelData.ReservedNewbie;
            parcel.ClaimDate           = properties.ParcelData.ClaimDate;
            parcel.ClaimPrice          = properties.ParcelData.ClaimPrice;
            parcel.RentPrice           = properties.ParcelData.RentPrice;
            parcel.AABBMin             = properties.ParcelData.AABBMin;
            parcel.AABBMax             = properties.ParcelData.AABBMax;
            parcel.Bitmap              = properties.ParcelData.Bitmap;
            parcel.Area                = properties.ParcelData.Area;
            parcel.Status              = properties.ParcelData.Status;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:libsecondlife-svn,代码行数:101,代码来源:Parcel.cs


注:本文中的libsecondlife.Simulator.SendPacket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。