當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。