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


C# Agent.SendPacket方法代码示例

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


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

示例1: AvatarPropertiesRequestHandler

        void AvatarPropertiesRequestHandler(Packet packet, Agent agent)
        {
            AvatarPropertiesRequestPacket request = (AvatarPropertiesRequestPacket)packet;

            lock (Server.Agents)
            {
                foreach (Agent agt in Server.Agents.Values)
                {
                    if (agent.AgentID == request.AgentData.AvatarID)
                    {
                        AvatarPropertiesReplyPacket reply = new AvatarPropertiesReplyPacket();
                        reply.AgentData.AgentID = agt.AgentID;
                        reply.AgentData.AvatarID = request.AgentData.AvatarID;
                        reply.PropertiesData.AboutText = Utils.StringToBytes("Profile info unavailable");
                        reply.PropertiesData.BornOn = Utils.StringToBytes("Unknown");
                        reply.PropertiesData.CharterMember = Utils.StringToBytes("Test User");
                        reply.PropertiesData.FLAboutText = Utils.StringToBytes("First life info unavailable");
                        reply.PropertiesData.Flags = 0;
                        //TODO: at least generate static image uuids based on name.
                        //this will prevent re-caching the default image for the same av name.
                        reply.PropertiesData.FLImageID = agent.AgentID; //temporary hack
                        reply.PropertiesData.ImageID = agent.AgentID; //temporary hack
                        reply.PropertiesData.PartnerID = UUID.Zero;
                        reply.PropertiesData.ProfileURL = Utils.StringToBytes(String.Empty);

                        agent.SendPacket(reply);

                        break;
                    }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:32,代码来源:AvatarPropertiesReply.cs

示例2: SendBalance

        void SendBalance(Agent agent, UUID transactionID, string message)
        {
            MoneyBalanceReplyPacket reply = new MoneyBalanceReplyPacket();
            reply.MoneyData.AgentID = agent.AgentID;
            reply.MoneyData.MoneyBalance = agent.Balance;
            reply.MoneyData.TransactionID = transactionID;
            reply.MoneyData.Description = Utils.StringToBytes(message);

            agent.SendPacket(reply);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:10,代码来源:Money.cs

示例3: RequestImageHandler

        void RequestImageHandler(Packet packet, Agent agent)
        {
            RequestImagePacket request = (RequestImagePacket)packet;

            foreach (RequestImagePacket.RequestImageBlock block in request.RequestImage)
            {
                //ImageNotInDatabasePacket missing = new ImageNotInDatabasePacket();
                //missing.ImageID.ID = block.Image;
                //agent.SendPacket(missing);

                ImageDataPacket imageData = new ImageDataPacket();
                imageData.ImageData.Data = OpenJPEG.EncodeFromImage(DefaultImage, true);
                imageData.ImageID.ID = block.Image;
                imageData.ImageID.Codec = 1;
                imageData.ImageID.Packets = 1;
                imageData.ImageID.Size = (uint)imageData.ImageData.Data.Length;

                agent.SendPacket(imageData);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:20,代码来源:ImageDelivery.cs


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