本文整理汇总了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;
}
}
}
}
示例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);
}
示例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);
}
}