当前位置: 首页>>代码示例>>C#>>正文


C# OpenMetaverse.PacketReceivedEventArgs类代码示例

本文整理汇总了C#中OpenMetaverse.PacketReceivedEventArgs的典型用法代码示例。如果您正苦于以下问题:C# PacketReceivedEventArgs类的具体用法?C# PacketReceivedEventArgs怎么用?C# PacketReceivedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PacketReceivedEventArgs类属于OpenMetaverse命名空间,在下文中一共展示了PacketReceivedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AvatarAnimationHandler

        /// <summary>
        /// Process incoming avatar animations
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="sim"></param>
        private void AvatarAnimationHandler(object sender, PacketReceivedEventArgs e)
        {
            var sim = e.Simulator;
            var packet = e.Packet;

            if (!IsMaster(sim)) return;
            AvatarAnimationPacket data = (AvatarAnimationPacket)packet;

            List<Animation> signaledAnimations = new List<Animation>(data.AnimationList.Length);

            for (int i = 0; i < data.AnimationList.Length; i++)
            {
                Animation animation = new Animation();
                animation.AnimationID = data.AnimationList[i].AnimID;
                animation.AnimationSequence = data.AnimationList[i].AnimSequenceID;
                if (i < data.AnimationSourceList.Length)
                {
                    animation.AnimationSourceObjectID = data.AnimationSourceList[i].ObjectID;
                }

                signaledAnimations.Add(animation);
            }

            Avatars_OnAvatarAnimation(this, new AvatarAnimationEventArgs(data.Sender.ID, signaledAnimations));
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:30,代码来源:WorldEffects.cs

示例2: HandlePacket

        /// <summary>
        /// Logs the packet received for this client.
        /// </summary>
        /// <remarks>
        /// This handler assumes that packets are processed one at a time.
        /// </remarks>
        /// <param name="sender">Sender.</param>
        /// <param name="args">Arguments.</param>
        private void HandlePacket(object sender, PacketReceivedEventArgs args)
        {
//            Console.WriteLine(
//                "Received packet {0} from {1} for {2}", args.Packet.Type, args.Simulator.Name, m_client.Self.Name);

            lock (this)
            {
                if (!m_isLogging)
                    return;               

                m_logStreamWriter.WriteLine("Received: {0}", DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss.fff"));

                try
                {
                    m_logStreamWriter.WriteLine(PacketDecoder.PacketToString(args.Packet));
                }
                catch (Exception e)
                {
                    m_logStreamWriter.WriteLine("Failed to write decode of {0}, exception {1}", args.Packet.Type, e);
                }

                if (--m_packetsToLogRemaining <= 0)
                {
                    m_client.Network.UnregisterCallback(PacketType.Default, HandlePacket);
                    m_logStreamWriter.Close();
                    Console.WriteLine("Finished logging packets for {0}", m_client.Self.Name);
                    m_isLogging = false;
                }
            }
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:38,代码来源:LogPacketCommand.cs

示例3: AgentDataUpdateHandler

 private void AgentDataUpdateHandler(object sender, PacketReceivedEventArgs e)
 {
     AgentDataUpdatePacket p = (AgentDataUpdatePacket)e.Packet;
     if (p.AgentData.AgentID == Client.Self.AgentID)
     {
         activeGroup = Utils.BytesToString(p.AgentData.GroupName) + " ( " + Utils.BytesToString(p.AgentData.GroupTitle) + " )";
         GroupsEvent.Set();
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:9,代码来源:ActivateGroupCommand.cs

示例4: estateUpdateHandle

 //custom handler for dealing with estate packets
 void estateUpdateHandle(object sender, PacketReceivedEventArgs e)
 {
     EstateOwnerMessagePacket message = (EstateOwnerMessagePacket)e.Packet;
     RegionFlags flag = (RegionFlags)(Utils.BytesToInt(message.ParamList[3].Parameter));
     if((flag & RegionFlags.NoFly) != RegionFlags.None)
         feedback("nofly");
     else
         feedback("fly");
 }
开发者ID:kopilo,项目名称:Estate-Console---Radegast-Viewer,代码行数:10,代码来源:RegionConsole.cs

示例5: AttachedSoundHandler

 protected void AttachedSoundHandler(object sender, PacketReceivedEventArgs e)
 {
     var simulator = e.Simulator;
     var packet = e.Packet;
     if (!MaintainSounds) return;
     if (!IsMaster(simulator)) return;
     AttachedSoundPacket sound = (AttachedSoundPacket)packet;
     Sound_OnAttachSound(this,
                         new AttachedSoundEventArgs(simulator, sound.DataBlock.SoundID, sound.DataBlock.OwnerID,
                                                    sound.DataBlock.ObjectID, sound.DataBlock.Gain,
                                                    (SoundFlags) sound.DataBlock.Flags));
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:12,代码来源:WorldSound.cs

示例6: AttachedSoundGainChangeHandler

        protected void AttachedSoundGainChangeHandler(object sender, PacketReceivedEventArgs e)
        {
            var simulator = e.Simulator;
            var packet = e.Packet;

            if (!MaintainSounds) return;
            if (!IsMaster(simulator)) return;

            AttachedSoundGainChangePacket change = (AttachedSoundGainChangePacket)packet;

            Sound_OnAttachSoundGainChange(this,new AttachedSoundGainChangeEventArgs(simulator,change.DataBlock.ObjectID, change.DataBlock.Gain));
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:12,代码来源:WorldSound.cs

示例7: PreloadSoundHandler

        protected void PreloadSoundHandler(object sender, PacketReceivedEventArgs e)
        {
            var simulator = e.Simulator;
            var packet = e.Packet;

            if (!MaintainSounds) return;
            if (!IsMaster(simulator)) return;

            PreloadSoundPacket preload = (PreloadSoundPacket)packet;
            foreach (PreloadSoundPacket.DataBlockBlock data in preload.DataBlock)
            {

                Sound_OnPreloadSound(this, new PreloadSoundEventArgs(simulator, data.SoundID, data.OwnerID, data.ObjectID));
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:15,代码来源:WorldSound.cs

示例8: SoundTriggerHandler

        protected void SoundTriggerHandler(object sender, PacketReceivedEventArgs e)
        {
            var simulator = e.Simulator;
            var packet = e.Packet;

            if (!MaintainSounds) return;
            if (!IsMaster(simulator)) return;

            SoundTriggerPacket trigger = (SoundTriggerPacket)packet;

            Sound_OnSoundTrigger(this, new SoundTriggerEventArgs(simulator,
                                           trigger.SoundData.SoundID,
                                           trigger.SoundData.OwnerID,
                                           trigger.SoundData.ObjectID,
                                           trigger.SoundData.ParentID,
                                           trigger.SoundData.Gain,
                                           trigger.SoundData.Handle,
                                           trigger.SoundData.Position));

        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:20,代码来源:WorldSound.cs

示例9: ScriptSensorReplyHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void ScriptSensorReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_ScriptSensorReply != null)
            {
                Packet packet = e.Packet;

                ScriptSensorReplyPacket reply = (ScriptSensorReplyPacket)packet;

                for (int i = 0; i < reply.SensedData.Length; i++)
                {
                    ScriptSensorReplyPacket.SensedDataBlock block = reply.SensedData[i];
                    ScriptSensorReplyPacket.RequesterBlock requestor = reply.Requester;

                    OnScriptSensorReply(new ScriptSensorReplyEventArgs(requestor.SourceID, block.GroupID, Utils.BytesToString(block.Name),
                      block.ObjectID, block.OwnerID, block.Position, block.Range, block.Rotation, (ScriptSensorTypeFlags)block.Type, block.Velocity));
                }
            }

        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:22,代码来源:AgentManager.cs

示例10: AlertMessageHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void AlertMessageHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_AlertMessage != null)
            {
                Packet packet = e.Packet;

                AlertMessagePacket alert = (AlertMessagePacket)packet;

                OnAlertMessage(new AlertMessageEventArgs(Utils.BytesToString(alert.AlertData.Message)));
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:14,代码来源:AgentManager.cs

示例11: MeanCollisionAlertHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void MeanCollisionAlertHandler(object sender, PacketReceivedEventArgs e)
        {
            if (m_MeanCollision != null)
            {
                Packet packet = e.Packet;
                MeanCollisionAlertPacket collision = (MeanCollisionAlertPacket)packet;

                for (int i = 0; i < collision.MeanCollision.Length; i++)
                {
                    MeanCollisionAlertPacket.MeanCollisionBlock block = collision.MeanCollision[i];

                    DateTime time = Utils.UnixTimeToDateTime(block.Time);
                    MeanCollisionType type = (MeanCollisionType)block.Type;

                    OnMeanCollision(new MeanCollisionEventArgs(type, block.Perp, block.Victim, block.Mag, time));
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:21,代码来源:AgentManager.cs

示例12: TeleportHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void TeleportHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            bool finished = false;
            TeleportFlags flags = TeleportFlags.Default;

            if (packet.Type == PacketType.TeleportStart)
            {
                TeleportStartPacket start = (TeleportStartPacket)packet;

                teleportMessage = "Teleport started";
                flags = (TeleportFlags)start.Info.TeleportFlags;
                teleportStat = TeleportStatus.Start;

                Logger.DebugLog("TeleportStart received, Flags: " + flags.ToString(), Client);
            }
            else if (packet.Type == PacketType.TeleportProgress)
            {
                TeleportProgressPacket progress = (TeleportProgressPacket)packet;

                teleportMessage = Utils.BytesToString(progress.Info.Message);
                flags = (TeleportFlags)progress.Info.TeleportFlags;
                teleportStat = TeleportStatus.Progress;

                Logger.DebugLog("TeleportProgress received, Message: " + teleportMessage + ", Flags: " + flags.ToString(), Client);
            }
            else if (packet.Type == PacketType.TeleportFailed)
            {
                TeleportFailedPacket failed = (TeleportFailedPacket)packet;

                teleportMessage = Utils.BytesToString(failed.Info.Reason);
                teleportStat = TeleportStatus.Failed;
                finished = true;

                Logger.DebugLog("TeleportFailed received, Reason: " + teleportMessage, Client);
            }
            else if (packet.Type == PacketType.TeleportFinish)
            {
                TeleportFinishPacket finish = (TeleportFinishPacket)packet;

                flags = (TeleportFlags)finish.Info.TeleportFlags;
                string seedcaps = Utils.BytesToString(finish.Info.SeedCapability);
                finished = true;

                Logger.DebugLog("TeleportFinish received, Flags: " + flags.ToString(), Client);

                // Connect to the new sim
                Simulator newSimulator = Client.Network.Connect(new IPAddress(finish.Info.SimIP),
                    finish.Info.SimPort, finish.Info.RegionHandle, true, seedcaps);

                if (newSimulator != null)
                {
                    teleportMessage = "Teleport finished";
                    teleportStat = TeleportStatus.Finished;

                    Logger.Log("Moved to new sim " + newSimulator.ToString(), Helpers.LogLevel.Info, Client);
                }
                else
                {
                    teleportMessage = "Failed to connect to the new sim after a teleport";
                    teleportStat = TeleportStatus.Failed;

                    // We're going to get disconnected now
                    Logger.Log(teleportMessage, Helpers.LogLevel.Error, Client);
                }
            }
            else if (packet.Type == PacketType.TeleportCancel)
            {
                //TeleportCancelPacket cancel = (TeleportCancelPacket)packet;

                teleportMessage = "Cancelled";
                teleportStat = TeleportStatus.Cancelled;
                finished = true;

                Logger.DebugLog("TeleportCancel received from " + simulator.ToString(), Client);
            }
            else if (packet.Type == PacketType.TeleportLocal)
            {
                TeleportLocalPacket local = (TeleportLocalPacket)packet;

                teleportMessage = "Teleport finished";
                flags = (TeleportFlags)local.Info.TeleportFlags;
                teleportStat = TeleportStatus.Finished;
                relativePosition = local.Info.Position;
                Movement.Camera.LookDirection(local.Info.LookAt);
                // This field is apparently not used for anything
                //local.Info.LocationID;
                finished = true;

                Logger.DebugLog("TeleportLocal received, Flags: " + flags.ToString(), Client);
            }

            if (m_Teleport != null)
            {
                OnTeleport(new TeleportEventArgs(teleportMessage, teleportStat, flags));
//.........这里部分代码省略.........
开发者ID:RavenB,项目名称:gridsearch,代码行数:101,代码来源:AgentManager.cs

示例13: AgentDataUpdateHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void AgentDataUpdateHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;

            if (p.AgentData.AgentID == simulator.Client.Self.AgentID)
            {
                firstName = Utils.BytesToString(p.AgentData.FirstName);
                lastName = Utils.BytesToString(p.AgentData.LastName);
                activeGroup = p.AgentData.ActiveGroupID;
                activeGroupPowers = (GroupPowers)p.AgentData.GroupPowers;

                if (m_AgentData != null)
                {
                    string groupTitle = Utils.BytesToString(p.AgentData.GroupTitle);
                    string groupName = Utils.BytesToString(p.AgentData.GroupName);

                    OnAgentData(new AgentDataReplyEventArgs(firstName, lastName, activeGroup, groupTitle, activeGroupPowers, groupName));
                }
            }
            else
            {
                Logger.Log("Got an AgentDataUpdate packet for avatar " + p.AgentData.AgentID.ToString() +
                    " instead of " + Client.Self.AgentID.ToString() + ", this shouldn't happen", Helpers.LogLevel.Error, Client);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:31,代码来源:AgentManager.cs

示例14: MovementCompleteHandler

        /// <summary>
        /// Update client's Position, LookAt and region handle from incoming packet
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        /// <remarks>This occurs when after an avatar moves into a new sim</remarks>
        private void MovementCompleteHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;
            Simulator simulator = e.Simulator;

            AgentMovementCompletePacket movement = (AgentMovementCompletePacket)packet;

            relativePosition = movement.Data.Position;
            Movement.Camera.LookDirection(movement.Data.LookAt);
            simulator.Handle = movement.Data.RegionHandle;
            simulator.SimVersion = Utils.BytesToString(movement.SimData.ChannelVersion);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:18,代码来源:AgentManager.cs

示例15: ConfirmXferPacketHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void ConfirmXferPacketHandler(object sender, PacketReceivedEventArgs e)
        {
            ConfirmXferPacketPacket confirm = (ConfirmXferPacketPacket)e.Packet;

            // Building a new UUID every time an ACK is received for an upload is a horrible
            // thing, but this whole Xfer system is horrible
            UUID transferID = new UUID(confirm.XferID.ID);
            Transfer transfer;
            AssetUpload upload = null;

            if (Transfers.TryGetValue(transferID, out transfer))
            {
                upload = (AssetUpload)transfer;

                //Client.DebugLog(String.Format("ACK for upload {0} of asset type {1} ({2}/{3})",
                //    upload.AssetID.ToString(), upload.Type, upload.Transferred, upload.Size));

                try { OnUploadProgress(new AssetUploadEventArgs(upload)); }
                catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }

                if (upload.Transferred < upload.Size)
                    SendNextUploadPacket(upload);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:27,代码来源:AssetManager.cs


注:本文中的OpenMetaverse.PacketReceivedEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。