예제 #1
0
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
                return Description;

            activeGroup = string.Empty;

            string groupName = String.Empty;
            for (int i = 0; i < args.Length; i++)
                groupName += args[i] + " ";
            groupName = groupName.Trim();

            UUID groupUUID = Client.GroupName2UUID(groupName);
            if (UUID.Zero != groupUUID) {
                NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AgentDataUpdateHandler);
                Client.Network.RegisterCallback(PacketType.AgentDataUpdate, pcallback);

                Console.WriteLine("setting " + groupName + " as active group");
                Client.Groups.ActivateGroup(groupUUID);
                GroupsEvent.WaitOne(30000, false);

                Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback);
                GroupsEvent.Reset();

                /* A.Biondi 
                 * TODO: Handle titles choosing.
                 */

                if (String.IsNullOrEmpty(activeGroup))
                    return Client.ToString() + " failed to activate the group " + groupName;

                return "Active group is now " + activeGroup;
            }
            return Client.ToString() + " doesn't seem to be member of the group " + groupName;
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
            {
                return(Description);
            }

            groups.Clear();
            activeGroup = string.Empty;

            string groupName = String.Empty;

            for (int i = 0; i < args.Length; i++)
            {
                groupName += args[i] + " ";
            }
            groupName = groupName.Trim();

            GroupManager.CurrentGroupsCallback callback = new GroupManager.CurrentGroupsCallback(Groups_OnCurrentGroups);
            Client.Groups.OnCurrentGroups += callback;
            Client.Groups.RequestCurrentGroups();

            GroupsEvent.WaitOne(30000, false);

            Client.Groups.OnCurrentGroups -= callback;
            GroupsEvent.Reset();

            if (groups.Count > 0)
            {
                foreach (Group currentGroup in groups.Values)
                {
                    if (currentGroup.Name.ToLower() == groupName.ToLower())
                    {
                        NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AgentDataUpdateHandler);
                        Client.Network.RegisterCallback(PacketType.AgentDataUpdate, pcallback);

                        Console.WriteLine("setting " + currentGroup.Name + " as active group");
                        Client.Groups.ActivateGroup(currentGroup.ID);
                        GroupsEvent.WaitOne(30000, false);

                        Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback);
                        GroupsEvent.Reset();

                        /* A.Biondi
                         * TODO: Handle titles choosing.
                         */

                        if (String.IsNullOrEmpty(activeGroup))
                        {
                            return(Client.ToString() + " failed to activate the group " + groupName);
                        }

                        return("Active group is now " + activeGroup);
                    }
                }
                return(Client.ToString() + " doesn't seem to be member of the group " + groupName);
            }

            return(Client.ToString() + " doesn't seem member of any group");
        }
예제 #3
0
 /// <summary>
 /// Unregister an event handler
 /// </summary>
 /// <param name="packetType">Packet type to unregister the handler for</param>
 /// <param name="eventHandler">Callback to be unregistered</param>
 public void UnregisterEvent(PacketType packetType, NetworkManager.PacketCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(packetType) && _EventTable[packetType] != null)
             _EventTable[packetType] -= eventHandler;
     }
 }
예제 #4
0
 /// <summary>
 /// Register an event handler
 /// </summary>
 /// <remarks>Use PacketType.Default to fire this event on every 
 /// incoming packet</remarks>
 /// <param name="packetType">Packet type to register the handler for</param>
 /// <param name="eventHandler">Callback to be fired</param>
 public void RegisterEvent(PacketType packetType, NetworkManager.PacketCallback eventHandler)
 {
     lock (_EventTable)
     {
         if (_EventTable.ContainsKey(packetType))
             _EventTable[packetType] += eventHandler;
         else
             _EventTable[packetType] = eventHandler;
     }
 }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length < 1)
                return Description;

            groups.Clear();
            activeGroup = string.Empty;

            string groupName = String.Empty;
            for (int i = 0; i < args.Length; i++)
                groupName += args[i] + " ";
            groupName = groupName.Trim();

            GroupManager.CurrentGroupsCallback callback = new GroupManager.CurrentGroupsCallback(Groups_OnCurrentGroups);
            Client.Groups.OnCurrentGroups += callback;
            Client.Groups.RequestCurrentGroups();

            GroupsEvent.WaitOne(30000, false);

            Client.Groups.OnCurrentGroups -= callback;
            GroupsEvent.Reset();

            if (groups.Count > 0)
            {
                foreach (Group currentGroup in groups.Values)
                    if (currentGroup.Name.ToLower() == groupName.ToLower())
                    {
                        NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AgentDataUpdateHandler);
                        Client.Network.RegisterCallback(PacketType.AgentDataUpdate, pcallback);

                        Console.WriteLine("setting " + currentGroup.Name + " as active group");
                        Client.Groups.ActivateGroup(currentGroup.ID);
                        GroupsEvent.WaitOne(30000, false);

                        Client.Network.UnregisterCallback(PacketType.AgentDataUpdate, pcallback);
                        GroupsEvent.Reset();

                        /* A.Biondi
                         * TODO: Handle titles choosing.
                         */

                        if (String.IsNullOrEmpty(activeGroup))
                            return Client.ToString() + " failed to activate the group " + groupName;

                        return "Active group is now " + activeGroup;
                    }
                return Client.ToString() + " doesn't seem to be member of the group " + groupName;
            }

            return Client.ToString() + " doesn't seem member of any group";
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            client.Settings.DEBUG              = true;
            client.Settings.LOG_RESENDS        = false;
            client.Settings.SEND_AGENT_UPDATES = true;
            client.Settings.USE_TEXTURE_CACHE  = true;

            NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AvatarAppearanceHandler);
            client.Network.RegisterCallback(PacketType.AvatarAppearance, pcallback);
            //client.Network.RegisterCallback(PacketType.Default, pcallback);

            //System.Threading.Thread.Sleep(100);

            //client.Network.UnregisterCallback(PacketType.Default, pcallback);
        }
예제 #7
0
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 2)
            {
                return("Usage: packetlog 10 tenpackets.xml");
            }

            XmlWriter writer;

            NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(OnPacket);

            Packets.Clear();
            Done  = false;
            Count = 0;

            try
            {
                Total  = Int32.Parse(args[0]);
                writer = XmlWriter.Create(args[1]);

                Client.Network.RegisterCallback(PacketType.Default, callback);
            }
            catch (Exception e)
            {
                return("Usage: packetlog 10 tenpackets.xml (" + e + ")");
            }

            while (!Done)
            {
                System.Threading.Thread.Sleep(100);
            }

            Client.Network.UnregisterCallback(PacketType.Default, callback);

            try
            {
                Helpers.PacketListToXml(Packets, writer);
            }
            catch (Exception e)
            {
                return("Serialization failed: " + e.ToString());
            }

            writer.Close();
            Packets.Clear();

            return("Exported " + Count + " packets to " + args[1]);
        }
예제 #8
0
        public override string Execute(string[] args, LLUUID fromAgentID)
        {
            if (args.Length != 2)
                return "Usage: packetlog 10 tenpackets.xml";

            XmlWriter writer;
            NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(OnPacket);

            Packets.Clear();
            Done = false;
            Count = 0;

            try
            {
                Total = Int32.Parse(args[0]);
                writer = XmlWriter.Create(args[1]);

                Client.Network.RegisterCallback(PacketType.Default, callback);
            }
            catch (Exception e)
            {
                return "Usage: packetlog 10 tenpackets.xml (" + e + ")";
            }

            while (!Done)
            {
                System.Threading.Thread.Sleep(100);
            }

            Client.Network.UnregisterCallback(PacketType.Default, callback);

            try
            {
                return "This command is currently under construction";
            }
            catch (Exception e)
            {
                return "Serialization failed: " + e.ToString();
            }

            writer.Close();
            Packets.Clear();

            return "Exported " + Count + " packets to " + args[1];
        }
        /// <summary>
        /// Represents other avatars
        /// </summary>
        /// <param name="client"></param>
        public AvatarManager(SecondLife client)
        {
            Client = client;

            // Friend notification callback
            NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(FriendNotificationHandler);
            Client.Network.RegisterCallback(PacketType.OnlineNotification, callback);
            Client.Network.RegisterCallback(PacketType.OfflineNotification, callback);

            // Avatar profile callbacks
            Client.Network.RegisterCallback(PacketType.AvatarPropertiesReply, new NetworkManager.PacketCallback(AvatarPropertiesHandler));
            Client.Network.RegisterCallback(PacketType.AvatarStatisticsReply, new NetworkManager.PacketCallback(AvatarStatisticsHandler));
            Client.Network.RegisterCallback(PacketType.AvatarInterestsReply, new NetworkManager.PacketCallback(AvatarInterestsHandler));

            // Other callbacks
            Client.Network.RegisterCallback(PacketType.UUIDNameReply, new NetworkManager.PacketCallback(AvatarNameHandler));
            Client.Network.RegisterCallback(PacketType.AvatarPickerReply, new NetworkManager.PacketCallback(AvatarPickerReplyHandler));
        }
예제 #10
0
        /// <summary>
        /// Represents other avatars
        /// </summary>
        /// <param name="client"></param>
        public AvatarManager(SecondLife client)
        {
            Client = client;

            // Friend notification callback
            NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(FriendNotificationHandler);
            Client.Network.RegisterCallback(PacketType.OnlineNotification, callback);
            Client.Network.RegisterCallback(PacketType.OfflineNotification, callback);

            // Avatar profile callbacks
            Client.Network.RegisterCallback(PacketType.AvatarPropertiesReply, new NetworkManager.PacketCallback(AvatarPropertiesHandler));
            Client.Network.RegisterCallback(PacketType.AvatarStatisticsReply, new NetworkManager.PacketCallback(AvatarStatisticsHandler));
            Client.Network.RegisterCallback(PacketType.AvatarInterestsReply, new NetworkManager.PacketCallback(AvatarInterestsHandler));

            // Other callbacks
            Client.Network.RegisterCallback(PacketType.UUIDNameReply, new NetworkManager.PacketCallback(AvatarNameHandler));
            Client.Network.RegisterCallback(PacketType.AvatarPickerReply, new NetworkManager.PacketCallback(AvatarPickerReplyHandler));
        }
예제 #11
0
        /// <summary>
        /// Constructor, setup callbacks for packets related to our avatar
        /// </summary>
        /// <param name="client">A reference to the <seealso cref="T:libsecondlife.SecondLife"/> Class</param>
        public AgentManager(SecondLife client)
        {
            Client = client;
            Movement = new AgentMovement(Client);
            NetworkManager.PacketCallback callback;

            Client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);

            // Teleport callbacks
            callback = new NetworkManager.PacketCallback(TeleportHandler);
            Client.Network.RegisterCallback(PacketType.TeleportStart, callback);
            Client.Network.RegisterCallback(PacketType.TeleportProgress, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFailed, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFinish, callback);
            Client.Network.RegisterCallback(PacketType.TeleportCancel, callback);
            Client.Network.RegisterCallback(PacketType.TeleportLocal, callback);

            // Instant message callback
            Client.Network.RegisterCallback(PacketType.ImprovedInstantMessage, new NetworkManager.PacketCallback(InstantMessageHandler));
            // Chat callback
            Client.Network.RegisterCallback(PacketType.ChatFromSimulator, new NetworkManager.PacketCallback(ChatHandler));
            // Script dialog callback
            Client.Network.RegisterCallback(PacketType.ScriptDialog, new NetworkManager.PacketCallback(ScriptDialogHandler));
            // Script question callback
            Client.Network.RegisterCallback(PacketType.ScriptQuestion, new NetworkManager.PacketCallback(ScriptQuestionHandler));
            // Script URL callback
            Client.Network.RegisterCallback(PacketType.LoadURL, new NetworkManager.PacketCallback(LoadURLHandler));
            // Movement complete callback
            Client.Network.RegisterCallback(PacketType.AgentMovementComplete, new NetworkManager.PacketCallback(MovementCompleteHandler));
            // Health callback
            Client.Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler));
            // Money callback
            Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, new NetworkManager.PacketCallback(BalanceHandler));
			//Agent update callback
			Client.Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
            // Animation callback
            Client.Network.RegisterCallback(PacketType.AvatarAnimation, new NetworkManager.PacketCallback(AvatarAnimationHandler));
            // Object colliding into our agent callback
            Client.Network.RegisterCallback(PacketType.MeanCollisionAlert, new NetworkManager.PacketCallback(MeanCollisionAlertHandler));
            // Region Crossing
            Client.Network.RegisterCallback(PacketType.CrossedRegion, new NetworkManager.PacketCallback(CrossedRegionHandler));
	        // CAPS callbacks
            Client.Network.RegisterEventCallback("EstablishAgentCommunication", new Caps.EventQueueCallback(EstablishAgentCommunicationEventHandler));
            // Incoming Group Chat
            Client.Network.RegisterEventCallback("ChatterBoxInvitation", new Caps.EventQueueCallback(ChatterBoxInvitationHandler));
            // Outgoing Group Chat Reply
            Client.Network.RegisterEventCallback("ChatterBoxSessionEventReply", new Caps.EventQueueCallback(ChatterBoxSessionEventHandler));
            Client.Network.RegisterEventCallback("ChatterBoxSessionStartReply", new Caps.EventQueueCallback(ChatterBoxSessionStartReplyHandler));
            Client.Network.RegisterEventCallback("ChatterBoxSessionAgentListUpdates", new Caps.EventQueueCallback(ChatterBoxSessionAgentListReplyHandler));
            // Login
            Client.Network.RegisterLoginResponseCallback(new NetworkManager.LoginResponseCallback(Network_OnLoginResponse));
            // Alert Messages
            Client.Network.RegisterCallback(PacketType.AlertMessage, new NetworkManager.PacketCallback(AlertMessageHandler));
            // script control change messages, ie: when an in-world LSL script wants to take control of your agent.
            Client.Network.RegisterCallback(PacketType.ScriptControlChange, new NetworkManager.PacketCallback(ScriptControlChangeHandler));
            // Camera Constraint (probably needs to move to AgentManagerCamera TODO:
            Client.Network.RegisterCallback(PacketType.CameraConstraint, new NetworkManager.PacketCallback(CameraConstraintHandler));
            Client.Network.RegisterCallback(PacketType.ScriptSensorReply, new NetworkManager.PacketCallback(ScriptSensorReplyHandler));
            Client.Network.RegisterCallback(PacketType.AvatarSitResponse, new NetworkManager.PacketCallback(AvatarSitResponseHandler));

        }
예제 #12
0
        /// <summary>
        /// Constructor, setup callbacks for packets related to our avatar
        /// </summary>
        /// <param name="client"></param>
        public AgentManager(SecondLife client)
        {
            Client = client;
            Movement = new AgentMovement(Client);
            NetworkManager.PacketCallback callback;

            Client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);

            // Teleport callbacks
            callback = new NetworkManager.PacketCallback(TeleportHandler);
            Client.Network.RegisterCallback(PacketType.TeleportStart, callback);
            Client.Network.RegisterCallback(PacketType.TeleportProgress, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFailed, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFinish, callback);
            Client.Network.RegisterCallback(PacketType.TeleportCancel, callback);
            Client.Network.RegisterCallback(PacketType.TeleportLocal, callback);

            // Instant Message callback
            Client.Network.RegisterCallback(PacketType.ImprovedInstantMessage, new NetworkManager.PacketCallback(InstantMessageHandler));
            // Chat callback
            Client.Network.RegisterCallback(PacketType.ChatFromSimulator, new NetworkManager.PacketCallback(ChatHandler));
            // Script dialog callback
            Client.Network.RegisterCallback(PacketType.ScriptDialog, new NetworkManager.PacketCallback(ScriptDialogHandler));
            // Script question callback
            Client.Network.RegisterCallback(PacketType.ScriptQuestion, new NetworkManager.PacketCallback(ScriptQuestionHandler));
            // Movement complete callback
            Client.Network.RegisterCallback(PacketType.AgentMovementComplete, new NetworkManager.PacketCallback(MovementCompleteHandler));
            // Health callback
            Client.Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler));
            // Money callback
            Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, new NetworkManager.PacketCallback(BalanceHandler));
			//Agent Update Callback
			Client.Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));

	        // CAPS callbacks
            Client.Network.RegisterEventCallback("EstablishAgentCommunication", new Capabilities.EventQueueCallback(EstablishAgentCommunicationEventHandler));

            // Login
            Client.Network.RegisterLoginResponseCallback(new NetworkManager.LoginResponseCallback(Network_OnLoginResponse));
        }
        /// <summary>
        /// Constructor, setup callbacks for packets related to our avatar
        /// </summary>
        /// <param name="client"></param>
        public MainAvatar(SecondLife client)
        {
            NetworkManager.PacketCallback callback;
            Client = client;

            Status = new MainAvatarStatus(Client);

            // Coarse location callback
            Client.Network.RegisterCallback(PacketType.CoarseLocationUpdate, new NetworkManager.PacketCallback(CoarseLocationHandler));

            // Teleport callbacks
            callback = new NetworkManager.PacketCallback(TeleportHandler);
            Client.Network.RegisterCallback(PacketType.TeleportStart, callback);
            Client.Network.RegisterCallback(PacketType.TeleportProgress, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFailed, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFinish, callback);

            // Instant Message callback
            Client.Network.RegisterCallback(PacketType.ImprovedInstantMessage, new NetworkManager.PacketCallback(InstantMessageHandler));

            // Chat callback
            Client.Network.RegisterCallback(PacketType.ChatFromSimulator, new NetworkManager.PacketCallback(ChatHandler));

            // Script dialog callback
            Client.Network.RegisterCallback(PacketType.ScriptDialog, new NetworkManager.PacketCallback(ScriptDialogHandler));

            // Teleport timeout timer
            TeleportTimer = new Timer(Client.Settings.TELEPORT_TIMEOUT);
            TeleportTimer.Elapsed += new ElapsedEventHandler(TeleportTimerEvent);
            TeleportTimeout = false;

            // Movement complete callback
            Client.Network.RegisterCallback(PacketType.AgentMovementComplete, new NetworkManager.PacketCallback(MovementCompleteHandler));

            // Health callback
            Client.Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler));

            // Money callbacks
            callback = new NetworkManager.PacketCallback(BalanceHandler);
            Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, callback);
            Client.Network.RegisterCallback(PacketType.MoneySummaryReply, callback);
            Client.Network.RegisterCallback(PacketType.AdjustBalance, callback);

            // Group callbacks
            Client.Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupHandler));
            Client.Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupHandler));
            Client.Network.RegisterCallback(PacketType.AgentDropGroup, new NetworkManager.PacketCallback(DropGroupHandler));

            // Event queue callback
            Client.Network.RegisterEventCallback(new NetworkManager.EventQueueCallback(EventQueueHandler));
        }
예제 #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            client.Settings.DEBUG = true;
            client.Settings.LOG_RESENDS = false;
            client.Settings.SEND_AGENT_UPDATES = true;
            client.Settings.USE_TEXTURE_CACHE = true;

            NetworkManager.PacketCallback pcallback = new NetworkManager.PacketCallback(AvatarAppearanceHandler);
            client.Network.RegisterCallback(PacketType.AvatarAppearance, pcallback);
            //client.Network.RegisterCallback(PacketType.Default, pcallback);

            //System.Threading.Thread.Sleep(100);

            //client.Network.UnregisterCallback(PacketType.Default, pcallback);
        }
예제 #15
0
        /// <summary>
        /// Constructor, setup callbacks for packets related to our avatar
        /// </summary>
        /// <param name="client">A reference to the <seealso cref="T:OpenMetaverse.GridClient"/> Class</param>
        public AgentManager(LoggerInstance log, NetworkManager network, GridManager grid)
        {
            Log = log;
            Network = network;
            Grid = grid;
            Movement = new AgentMovement(Log, this, network);
            NetworkManager.PacketCallback callback;

            Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
            Network.OnCurrentSimChanged += new NetworkManager.CurrentSimChangedCallback(Network_OnCurrentSimChanged);
            // Teleport callbacks
            callback = new NetworkManager.PacketCallback(TeleportHandler);
            Network.RegisterCallback(PacketType.TeleportStart, callback);
            Network.RegisterCallback(PacketType.TeleportProgress, callback);
            Network.RegisterCallback(PacketType.TeleportFailed, callback);
            Network.RegisterCallback(PacketType.TeleportCancel, callback);
            Network.RegisterCallback(PacketType.TeleportLocal, callback);
            // these come in via the EventQueue
            Network.RegisterEventCallback("TeleportFailed", new Caps.EventQueueCallback(TeleportFailedEventHandler));
            Network.RegisterEventCallback("TeleportFinish", new Caps.EventQueueCallback(TeleportFinishEventHandler));

            // Upload cost callback:
            Network.RegisterCallback(Packets.PacketType.EconomyData, new NetworkManager.PacketCallback(EconomyDataHandler));
            // Instant message callback
            Network.RegisterCallback(PacketType.ImprovedInstantMessage, new NetworkManager.PacketCallback(InstantMessageHandler));
            // Chat callback
            Network.RegisterCallback(PacketType.ChatFromSimulator, new NetworkManager.PacketCallback(ChatHandler));
            // Script dialog callback
            Network.RegisterCallback(PacketType.ScriptDialog, new NetworkManager.PacketCallback(ScriptDialogHandler));
            // Script question callback
            Network.RegisterCallback(PacketType.ScriptQuestion, new NetworkManager.PacketCallback(ScriptQuestionHandler));
            // Script URL callback
            Network.RegisterCallback(PacketType.LoadURL, new NetworkManager.PacketCallback(LoadURLHandler));
            // Movement complete callback
            Network.RegisterCallback(PacketType.AgentMovementComplete, new NetworkManager.PacketCallback(MovementCompleteHandler));
            // Health callback
            Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler));
            // Money callback
            Network.RegisterCallback(PacketType.MoneyBalanceReply, new NetworkManager.PacketCallback(BalanceHandler));
            //Agent update callback
            Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
            // Animation callback
            Network.RegisterCallback(PacketType.AvatarAnimation, new NetworkManager.PacketCallback(AvatarAnimationHandler));
            // Object colliding into our agent callback
            Network.RegisterCallback(PacketType.MeanCollisionAlert, new NetworkManager.PacketCallback(MeanCollisionAlertHandler));
            // Region Crossing
            Network.RegisterCallback(PacketType.CrossedRegion, new NetworkManager.PacketCallback(CrossedRegionHandler));
            Network.RegisterEventCallback("CrossedRegion", new Caps.EventQueueCallback(CrossedRegionEventHandler));
            // CAPS callbacks
            Network.RegisterEventCallback("EstablishAgentCommunication", new Caps.EventQueueCallback(EstablishAgentCommunicationEventHandler));
            // Incoming Group Chat
            Network.RegisterEventCallback("ChatterBoxInvitation", new Caps.EventQueueCallback(ChatterBoxInvitationEventHandler));
            // Outgoing Group Chat Reply
            Network.RegisterEventCallback("ChatterBoxSessionEventReply", new Caps.EventQueueCallback(ChatterBoxSessionEventReplyEventHandler));
            Network.RegisterEventCallback("ChatterBoxSessionStartReply", new Caps.EventQueueCallback(ChatterBoxSessionStartReplyEventHandler));
            Network.RegisterEventCallback("ChatterBoxSessionAgentListUpdates", new Caps.EventQueueCallback(ChatterBoxSessionAgentListUpdatesEventHandler));
            // Login
            Network.RegisterLoginResponseCallback(new NetworkManager.LoginResponseCallback(Network_OnLoginResponse));
            // Alert Messages
            Network.RegisterCallback(PacketType.AlertMessage, new NetworkManager.PacketCallback(AlertMessageHandler));
            // script control change messages, ie: when an in-world LSL script wants to take control of your agent.
            Network.RegisterCallback(PacketType.ScriptControlChange, new NetworkManager.PacketCallback(ScriptControlChangeHandler));
            // Camera Constraint (probably needs to move to AgentManagerCamera TODO:
            Network.RegisterCallback(PacketType.CameraConstraint, new NetworkManager.PacketCallback(CameraConstraintHandler));
            Network.RegisterCallback(PacketType.ScriptSensorReply, new NetworkManager.PacketCallback(ScriptSensorReplyHandler));
            Network.RegisterCallback(PacketType.AvatarSitResponse, new NetworkManager.PacketCallback(AvatarSitResponseHandler));
        }
예제 #16
0
        /// <summary>
        /// Constructor, setup callbacks for packets related to our avatar
        /// </summary>
        /// <param name="client"></param>
        public MainAvatar(SecondLife client)
        {
            Client = client;
            Status = new MainAvatarStatus(Client);
            NetworkManager.PacketCallback callback;

            // Teleport callbacks
            callback = new NetworkManager.PacketCallback(TeleportHandler);
            Client.Network.RegisterCallback(PacketType.TeleportStart, callback);
            Client.Network.RegisterCallback(PacketType.TeleportProgress, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFailed, callback);
            Client.Network.RegisterCallback(PacketType.TeleportFinish, callback);
            Client.Network.RegisterCallback(PacketType.TeleportCancel, callback);
            Client.Network.RegisterCallback(PacketType.TeleportLocal, callback);

            // Instant Message callback
            Client.Network.RegisterCallback(PacketType.ImprovedInstantMessage, new NetworkManager.PacketCallback(InstantMessageHandler));

            // Chat callback
            Client.Network.RegisterCallback(PacketType.ChatFromSimulator, new NetworkManager.PacketCallback(ChatHandler));

            // Script dialog callback
            Client.Network.RegisterCallback(PacketType.ScriptDialog, new NetworkManager.PacketCallback(ScriptDialogHandler));

            // Script question callback
            Client.Network.RegisterCallback(PacketType.ScriptQuestion, new NetworkManager.PacketCallback(ScriptQuestionHandler));

            // Movement complete callback
            Client.Network.RegisterCallback(PacketType.AgentMovementComplete, new NetworkManager.PacketCallback(MovementCompleteHandler));

            // Health callback
            Client.Network.RegisterCallback(PacketType.HealthMessage, new NetworkManager.PacketCallback(HealthHandler));

            // Money callback
            Client.Network.RegisterCallback(PacketType.MoneyBalanceReply, new NetworkManager.PacketCallback(BalanceHandler));

            // Group callbacks
            Client.Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupHandler));
            Client.Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupHandler));
            Client.Network.RegisterCallback(PacketType.AgentDropGroup, new NetworkManager.PacketCallback(DropGroupHandler));
			
			//Agent Update Callback
			Client.Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));

	        // Event queue callback (used for Caps teleports currently)
	        Client.Network.RegisterEventCallback(new Caps.EventQueueCallback(EventQueueHandler));
        }