本文整理匯總了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);
}
}