LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in AvatarManager
* BREAKING CHANGE * this is a major shift in the way events are internally handled. * TODO: need to complete the EventArgs class documentation * Adds new TestClient commands "play" to play animations, and bots to detect other bots. git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3163 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -18,20 +18,19 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
public CloneProfileCommand(TestClient testClient)
|
||||
{
|
||||
testClient.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests);
|
||||
testClient.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties);
|
||||
testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups);
|
||||
testClient.Avatars.AvatarInterestsReply += new EventHandler<AvatarInterestsReplyEventArgs>(Avatars_AvatarInterestsReply);
|
||||
testClient.Avatars.AvatarPropertiesReply += new EventHandler<AvatarPropertiesReplyEventArgs>(Avatars_AvatarPropertiesReply);
|
||||
testClient.Avatars.AvatarGroupsReply += new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);
|
||||
testClient.Groups.GroupJoinedReply += new EventHandler<GroupOperationEventArgs>(Groups_OnGroupJoined);
|
||||
|
||||
testClient.Avatars.OnAvatarPicks += new AvatarManager.AvatarPicksCallback(Avatars_OnAvatarPicks);
|
||||
testClient.Avatars.OnPickInfo += new AvatarManager.PickInfoCallback(Avatars_OnPickInfo);
|
||||
testClient.Avatars.AvatarPicksReply += new EventHandler<AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);
|
||||
testClient.Avatars.PickInfoReply += new EventHandler<PickInfoReplyEventArgs>(Avatars_PickInfoReply);
|
||||
|
||||
Name = "cloneprofile";
|
||||
Description = "Clones another avatars profile as closely as possible. WARNING: This command will " +
|
||||
"destroy your existing profile! Usage: cloneprofile [targetuuid]";
|
||||
Category = CommandCategory.Other;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, UUID fromAgentID)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
@@ -80,67 +79,7 @@ namespace OpenMetaverse.TestClient
|
||||
}
|
||||
|
||||
return "Synchronized our profile to the profile of " + targetID.ToString();
|
||||
}
|
||||
|
||||
void Avatars_OnAvatarPicks(UUID avatarid, Dictionary<UUID, string> picks)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, string> kvp in picks)
|
||||
{
|
||||
if (avatarid == Client.Self.AgentID)
|
||||
{
|
||||
Client.Self.PickDelete(kvp.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
Client.Avatars.RequestPickInfo(avatarid, kvp.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_OnPickInfo(UUID pickid, ProfilePick pick)
|
||||
{
|
||||
Client.Self.PickInfoUpdate(pickid, pick.TopPick, pick.ParcelID, pick.Name, pick.PosGlobal, pick.SnapshotID, pick.Desc);
|
||||
}
|
||||
|
||||
void Avatars_OnAvatarProperties(UUID avatarID, Avatar.AvatarProperties properties)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
Properties = properties;
|
||||
ReceivedProperties = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_OnAvatarInterests(UUID avatarID, Avatar.Interests interests)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
Interests = interests;
|
||||
ReceivedInterests = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_OnAvatarGroups(UUID avatarID, List<AvatarGroup> groups)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
foreach (AvatarGroup group in groups)
|
||||
{
|
||||
Groups.Add(group.GroupID);
|
||||
}
|
||||
|
||||
ReceivedGroups = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Groups_OnGroupJoined(object sender, GroupOperationEventArgs e)
|
||||
{
|
||||
@@ -154,5 +93,67 @@ namespace OpenMetaverse.TestClient
|
||||
Client.Groups.ActivateGroup(e.GroupID);
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_PickInfoReply(object sender, PickInfoReplyEventArgs e)
|
||||
{
|
||||
Client.Self.PickInfoUpdate(e.PickID, e.Pick.TopPick, e.Pick.ParcelID, e.Pick.Name, e.Pick.PosGlobal, e.Pick.SnapshotID, e.Pick.Desc);
|
||||
}
|
||||
|
||||
void Avatars_AvatarPicksReply(object sender, AvatarPicksReplyEventArgs e)
|
||||
{
|
||||
foreach (KeyValuePair<UUID, string> kvp in e.Picks)
|
||||
{
|
||||
if (e.AvatarID == Client.Self.AgentID)
|
||||
{
|
||||
Client.Self.PickDelete(kvp.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
Client.Avatars.RequestPickInfo(e.AvatarID, kvp.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_AvatarGroupsReply(object sender, AvatarGroupsReplyEventArgs e)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
foreach (AvatarGroup group in e.Groups)
|
||||
{
|
||||
Groups.Add(group.GroupID);
|
||||
}
|
||||
|
||||
ReceivedGroups = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
Properties = e.Properties;
|
||||
ReceivedProperties = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
void Avatars_AvatarInterestsReply(object sender, AvatarInterestsReplyEventArgs e)
|
||||
{
|
||||
lock (ReceivedProfileEvent)
|
||||
{
|
||||
Interests = e.Interests;
|
||||
ReceivedInterests = true;
|
||||
|
||||
if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
|
||||
ReceivedProfileEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user