• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LLAgent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SignalTaskInventoryChange

        private void SignalTaskInventoryChange(LLAgent agent, LLPrimitive prim)
        {
            // Send an ObjectPropertiesReply to inform the client that inventory has changed
            ObjectPropertiesPacket props = new ObjectPropertiesPacket();
            props.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1];
            props.ObjectData[0] = LLUtil.BuildEntityPropertiesBlock(prim);
            m_udp.SendPacket(agent, props, ThrottleCategory.Task, false);

            // Signal this prim for serialization
            m_scene.EntityAddOrUpdate(this, prim, UpdateFlags.Serialize, 0);
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:11,代码来源:TaskInventory.cs


示例2: TransferDownload

        private void TransferDownload(LLAgent agent, UUID transferID, UUID assetID, AssetType type, Asset asset)
        {
            const int MAX_CHUNK_SIZE = 1000;

            string contentType = LLUtil.LLAssetTypeToContentType((int)type);

            if (contentType == asset.ContentType)
            {
                m_log.Debug(String.Format("Transferring asset {0} ({1})", asset.ID, asset.ContentType));

                TransferInfoPacket response = new TransferInfoPacket();
                response.TransferInfo = new TransferInfoPacket.TransferInfoBlock();
                response.TransferInfo.TransferID = transferID;

                // Set the response channel type
                response.TransferInfo.ChannelType = (int)ChannelType.Asset;

                // Params
                response.TransferInfo.Params = new byte[20];
                assetID.ToBytes(response.TransferInfo.Params, 0);
                Utils.IntToBytes((int)type, response.TransferInfo.Params, 16);

                response.TransferInfo.Size = asset.Data.Length;
                response.TransferInfo.Status = (int)StatusCode.OK;
                response.TransferInfo.TargetType = (int)TargetType.Unknown; // Doesn't seem to be used by the client

                m_udp.SendPacket(agent, response, ThrottleCategory.Asset, false);

                // Transfer system does not wait for ACKs, just sends all of the
                // packets for this transfer out
                int processedLength = 0;
                int packetNum = 0;
                while (processedLength < asset.Data.Length)
                {
                    TransferPacketPacket transfer = new TransferPacketPacket();
                    transfer.TransferData.ChannelType = (int)ChannelType.Asset;
                    transfer.TransferData.TransferID = transferID;
                    transfer.TransferData.Packet = packetNum++;

                    int chunkSize = Math.Min(asset.Data.Length - processedLength, MAX_CHUNK_SIZE);
                    transfer.TransferData.Data = new byte[chunkSize];
                    Buffer.BlockCopy(asset.Data, processedLength, transfer.TransferData.Data, 0, chunkSize);
                    processedLength += chunkSize;

                    if (processedLength >= asset.Data.Length)
                        transfer.TransferData.Status = (int)StatusCode.Done;
                    else
                        transfer.TransferData.Status = (int)StatusCode.OK;

                    m_udp.SendPacket(agent, transfer, ThrottleCategory.Asset, false);
                }
            }
            else
            {
                m_log.WarnFormat("Request for asset {0} with type {1} does not match actual asset type {2}",
                    assetID, type, asset.ContentType);

                TransferNotFound(agent, transferID, assetID, type);
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:60,代码来源:Assets.cs


示例3: TransferRequestHandler

        private void TransferRequestHandler(Packet packet, LLAgent agent)
        {
            TransferRequestPacket request = (TransferRequestPacket)packet;

            ChannelType channel = (ChannelType)request.TransferInfo.ChannelType;
            SourceType source = (SourceType)request.TransferInfo.SourceType;

            if (channel == ChannelType.Asset)
            {
                if (source == SourceType.Asset)
                {
                    // Parse the request
                    UUID assetID = new UUID(request.TransferInfo.Params, 0);
                    AssetType type = (AssetType)(sbyte)Utils.BytesToInt(request.TransferInfo.Params, 16);
                    string contentType = LLUtil.LLAssetTypeToContentType((int)type);

                    // Permission check
                    if (!CanDownloadInventory(agent, type, assetID))
                    {
                        TransferNotFound(agent, request.TransferInfo.TransferID, assetID, type);
                        return;
                    }

                    // Check if we have this asset
                    Asset asset;
                    if (m_assets.TryGetAsset(assetID, contentType, out asset))
                        TransferDownload(agent, request.TransferInfo.TransferID, assetID, type, asset);
                    else
                        TransferNotFound(agent, request.TransferInfo.TransferID, assetID, type);
                }
                else if (source == SourceType.SimInventoryItem)
                {
                    //UUID agentID = new UUID(request.TransferInfo.Params, 0);
                    //UUID sessionID = new UUID(request.TransferInfo.Params, 16);
                    //UUID ownerID = new UUID(request.TransferInfo.Params, 32);
                    UUID taskID = new UUID(request.TransferInfo.Params, 48);
                    UUID itemID = new UUID(request.TransferInfo.Params, 64);
                    UUID assetID = new UUID(request.TransferInfo.Params, 80);
                    AssetType type = (AssetType)(sbyte)Utils.BytesToInt(request.TransferInfo.Params, 96);
                    string contentType = LLUtil.LLAssetTypeToContentType((int)type);

                    if (taskID != UUID.Zero)
                    {
                        // Task (prim) inventory request permission check
                        if (!CanDownloadTaskInventory(agent, type, taskID, itemID))
                        {
                            TransferNotFound(agent, request.TransferInfo.TransferID, assetID, type);
                            return;
                        }
                    }
                    else
                    {
                        // Agent inventory request permission check
                        if (!CanDownloadInventory(agent, type, assetID))
                        {
                            TransferNotFound(agent, request.TransferInfo.TransferID, assetID, type);
                            return;
                        }
                    }

                    // Check if we have this asset
                    Asset asset;
                    if (m_assets.TryGetAsset(assetID, contentType, out asset))
                        TransferDownload(agent, request.TransferInfo.TransferID, assetID, type, asset);
                    else
                        TransferNotFound(agent, request.TransferInfo.TransferID, assetID, type);
                }
                else if (source == SourceType.SimEstate)
                {
                    //UUID agentID = new UUID(request.TransferInfo.Params, 0);
                    //UUID sessionID = new UUID(request.TransferInfo.Params, 16);
                    //EstateAssetType type = (EstateAssetType)Utils.BytesToInt(request.TransferInfo.Params, 32);

                    m_log.Warn("Don't know what to do with an estate asset transfer request");
                }
                else
                {
                    m_log.WarnFormat(
                        "Received a TransferRequest that we don't know how to handle. Channel: {0}, Source: {1}",
                        channel, source);
                }
            }
            else
            {
                m_log.WarnFormat(
                    "Received a TransferRequest that we don't know how to handle. Channel: {0}, Source: {1}",
                    channel, source);
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:89,代码来源:Assets.cs


示例4: CanDownloadTaskInventory

        private bool CanDownloadTaskInventory(LLAgent agent, AssetType type, UUID taskID, UUID itemID)
        {
            ISceneEntity entity;
            if (m_scene.TryGetEntity(taskID, out entity))
            {
                if (entity is LLPrimitive)
                {
                    LLPrimitive prim = (LLPrimitive)entity;

                    LLInventoryTaskItem item;
                    if (prim.Inventory.TryGetItem(itemID, out item))
                    {
                        bool success;

                        if (item.OwnerID == agent.ID)
                            success = item.Permissions.OwnerMask.HasPermission(PermissionMask.Modify);
                        else
                            success = item.Permissions.EveryoneMask.HasPermission(PermissionMask.Modify);

                        if (!success)
                            m_log.Warn("Denying task inventory download from " + agent.Name + " for item " + item.Name + " in task " + taskID);

                        return success;
                    }
                }
            }

            return false;
        }
开发者ID:thoys,项目名称:simian,代码行数:29,代码来源:Assets.cs


示例5: RequestXferHandler

        private void RequestXferHandler(Packet packet, LLAgent agent)
        {
            RequestXferPacket request = (RequestXferPacket)packet;

            string filename = Utils.BytesToString(request.XferID.Filename);

            UUID taskInventoryID;
            if (filename.StartsWith("inventory_") && filename.EndsWith(".tmp") && UUID.TryParse(filename.Substring(10, 36), out taskInventoryID))
            {
                // This is a request for a task inventory listing, which we generate on demand
                ISceneEntity entity;
                if (m_scene.TryGetEntity(taskInventoryID, out entity) && entity is LLPrimitive)
                {
                    LLPrimitive prim = (LLPrimitive)entity;
                    byte[] assetData = Encoding.UTF8.GetBytes(prim.Inventory.GetTaskInventoryAsset());

                    SendXferPacketPacket xfer = new SendXferPacketPacket();
                    xfer.XferID.ID = request.XferID.ID;

                    if (assetData.Length < 1000)
                    {
                        xfer.XferID.Packet = 0 | LAST_PACKET_MARKER;
                        xfer.DataPacket.Data = new byte[assetData.Length + 4];
                        Utils.IntToBytes(assetData.Length, xfer.DataPacket.Data, 0);
                        Buffer.BlockCopy(assetData, 0, xfer.DataPacket.Data, 4, assetData.Length);

                        m_udp.SendPacket(agent, xfer, ThrottleCategory.Asset, false);
                        m_log.Debug("Completed single packet xfer download of " + filename);
                    }
                    else
                    {
                        xfer.XferID.Packet = 0;
                        xfer.DataPacket.Data = new byte[1000 + 4];
                        Utils.IntToBytes(assetData.Length, xfer.DataPacket.Data, 0);
                        Buffer.BlockCopy(assetData, 0, xfer.DataPacket.Data, 4, 1000);

                        // We don't need the entire XferDownload class, just the asset data and the current packet number
                        XferDownload download = new XferDownload();
                        download.AssetData = assetData;
                        download.PacketNum = 1;
                        download.Filename = filename;
                        lock (currentDownloads)
                            currentDownloads[request.XferID.ID] = download;

                        m_udp.SendPacket(agent, xfer, ThrottleCategory.Asset, false);
                    }
                }
                else
                {
                    m_log.Warn("Could not find primitive " + taskInventoryID);
                }
            }
            else
            {
                m_log.Warn("Got a RequestXfer for an unknown file: " + filename);
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:57,代码来源:Assets.cs


示例6: ChatFromViewerHandler

        private void ChatFromViewerHandler(Packet packet, LLAgent agent)
        {
            ChatFromViewerPacket chat = (ChatFromViewerPacket)packet;
            ChatType chatType = (ChatType)chat.ChatData.Type;
            string message = Utils.BytesToString(chat.ChatData.Message);
            int channel = chat.ChatData.Channel;

            // Don't allow clients to chat on negative channels
            if (channel < 0)
                channel = 0;

            // Start/stop typing messages are specific to the LLUDP protocol, so we create events
            // directly that will be processed by this same class. Chat messages are a generic
            // event that can be supported by multiple protocols, so we call IScene.EntityChat and
            // hook IScene.OnChat to do the actual processing

            // Event IDs for start/stop typing are generated with UUID.Combine(agent.ID, TYPING_EVENT_ID)
            // to create an ID that is unique to each agent in the context of typing. Newer typing
            // events will overwrite older ones

            switch (chatType)
            {
                case ChatType.StartTyping:
                    m_scene.CreateInterestListEvent(new InterestListEvent(UUID.Combine(agent.ID, TYPING_EVENT_ID),
                        VIEWER_TYPING, agent.ScenePosition, new Vector3(NORMAL_DIST),
                        new TypingData { Source = agent, StartTyping = true }));
                    break;
                case ChatType.StopTyping:
                    m_scene.CreateInterestListEvent(new InterestListEvent(UUID.Combine(agent.ID, TYPING_EVENT_ID),
                        VIEWER_TYPING, agent.ScenePosition, new Vector3(NORMAL_DIST),
                        new TypingData { Source = agent, StartTyping = false }));
                    break;
                case ChatType.Whisper:
                    m_scene.EntityChat(this, agent, WHISPER_DIST, message, channel, EntityChatType.Normal);
                    break;
                case ChatType.Shout:
                    m_scene.EntityChat(this, agent, SHOUT_DIST, message, channel, EntityChatType.Normal);
                    break;
                case ChatType.Normal:
                default:
                    m_scene.EntityChat(this, agent, NORMAL_DIST, message, channel, EntityChatType.Normal);
                    break;
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:44,代码来源:Chat.cs


示例7: AssetUploadRequestHandler

        private void AssetUploadRequestHandler(Packet packet, LLAgent agent)
        {
            AssetUploadRequestPacket request = (AssetUploadRequestPacket)packet;
            UUID assetID = UUID.Combine(request.AssetBlock.TransactionID, agent.SecureSessionID);
            AssetType type = (AssetType)request.AssetBlock.Type;

            // Check if the agent is allowed to upload an asset
            string uploadError;
            if (m_permissions != null && !m_permissions.TryUploadOneAsset(agent, out uploadError))
            {
                m_scene.PresenceAlert(this, agent, uploadError);
                return;
            }

            bool local = request.AssetBlock.StoreLocal | type == AssetType.LSLBytecode;
            bool temp = request.AssetBlock.Tempfile;

            // Check if the asset is small enough to fit in a single packet
            if (request.AssetBlock.AssetData.Length != 0)
            {
                // Create a new asset from the completed upload

                Asset asset = CreateAsset(type, assetID, DateTime.UtcNow, agent.ID, local, temp, request.AssetBlock.AssetData);

                if (asset == null)
                {
                    m_log.Warn("Failed to create asset from uploaded data");
                    return;
                }

                if (type != AssetType.LSLBytecode)
                {
                    // Store the asset
                    m_log.DebugFormat("Storing uploaded asset {0} ({1})", assetID, asset.ContentType);
                    if (!m_assets.StoreAsset(asset))
                        m_log.ErrorFormat("Failed to store uploaded asset {0} ({1})", assetID, asset.ContentType);
                }
                else
                {
                    m_log.Debug("Ignoring LSL bytecode upload " + assetID);
                }

                // Send a success response
                AssetUploadCompletePacket complete = new AssetUploadCompletePacket();
                complete.AssetBlock.Success = true;
                complete.AssetBlock.Type = request.AssetBlock.Type;
                complete.AssetBlock.UUID = assetID;
                m_udp.SendPacket(agent, complete, ThrottleCategory.Task, false);
            }
            else
            {
                // Create a new (empty) asset for the upload
                Asset asset = CreateAsset(type, assetID, DateTime.UtcNow, agent.ID, local, temp, null);

                if (asset == null)
                {
                    m_log.Warn("Failed to create asset from uploaded data");
                    return;
                }

                asset.Temporary = (request.AssetBlock.Tempfile | request.AssetBlock.StoreLocal);
                ulong transferID = request.AssetBlock.TransactionID.GetULong();

                // Prevent LSL bytecode transfers from colliding with LSL source transfers, which
                // use a colliding UUID
                if (type == AssetType.LSLBytecode)
                    ++transferID;

                RequestXferPacket xfer = new RequestXferPacket();
                xfer.XferID.DeleteOnCompletion = request.AssetBlock.Tempfile;
                xfer.XferID.FilePath = 0;
                xfer.XferID.Filename = Utils.EmptyBytes;
                xfer.XferID.ID = transferID;
                xfer.XferID.UseBigPackets = false;
                xfer.XferID.VFileID = asset.ID;
                xfer.XferID.VFileType = request.AssetBlock.Type;

                m_log.DebugFormat("Starting upload for {0} / {1} ({2})", assetID, transferID, asset.ContentType);

                // Add this asset to the current upload list
                lock (currentUploads)
                    currentUploads[transferID] = asset;

                m_udp.SendPacket(agent, xfer, ThrottleCategory.Task, false);
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:86,代码来源:Assets.cs


示例8: ImprovedInstantMessageHandler

        private void ImprovedInstantMessageHandler(Packet packet, LLAgent agent)
        {
            ImprovedInstantMessagePacket im = (ImprovedInstantMessagePacket)packet;

            // The following fields are unused since we already have this information, plus the
            // client could forge it:
            // - im.MessageBlock.FromAgentName
            // - im.MessageBlock.FromGroup;
            // - im.MessageBlock.RegionID
            // - im.MessageBlock.Position
            // - im.MessageBlock.Timestamp
            // - im.MessageBlock.ParentEstateID

            InstantMessageDialog type = (InstantMessageDialog)im.MessageBlock.Dialog;
            string message = Utils.BytesToString(im.MessageBlock.Message);
            bool allowOffline = (im.MessageBlock.Offline != 0);

            switch (type)
            {
                case InstantMessageDialog.MessageFromAgent:
                case InstantMessageDialog.StartTyping:
                case InstantMessageDialog.StopTyping:
                    SendInstantMessage(im.MessageBlock.ID, im.MessageBlock.ToAgentID, agent.Name,
                        agent.ScenePosition, agent.Scene.ID, false, type, message, allowOffline,
                        DateTime.UtcNow, im.MessageBlock.BinaryBucket);
                    break;

                case InstantMessageDialog.RequestTeleport:
                case InstantMessageDialog.GodLikeRequestTeleport:
                case InstantMessageDialog.Lure911:
                case InstantMessageDialog.AcceptTeleport:
                case InstantMessageDialog.DenyTeleport:
                case InstantMessageDialog.BusyAutoResponse:
                    break;

                case InstantMessageDialog.FriendshipOffered:
                case InstantMessageDialog.FriendshipAccepted:
                case InstantMessageDialog.FriendshipDeclined:
                    break;

                case InstantMessageDialog.GroupInvitation:
                case InstantMessageDialog.GroupInvitationAccept:
                case InstantMessageDialog.GroupInvitationDecline:
                    break;

                case InstantMessageDialog.GroupNotice:
                case InstantMessageDialog.GroupNoticeRequested:
                case InstantMessageDialog.GroupNoticeInventoryAccepted:
                case InstantMessageDialog.GroupNoticeInventoryDeclined:
                case InstantMessageDialog.GroupVote:
                    break;

                case InstantMessageDialog.InventoryOffered:
                case InstantMessageDialog.InventoryAccepted:
                case InstantMessageDialog.InventoryDeclined:
                    break;

                case InstantMessageDialog.TaskInventoryOffered:
                case InstantMessageDialog.TaskInventoryAccepted:
                case InstantMessageDialog.TaskInventoryDeclined:
                    break;

                case InstantMessageDialog.SessionAdd:
                case InstantMessageDialog.SessionOfflineAdd:
                case InstantMessageDialog.SessionCardlessStart:
                case InstantMessageDialog.Session911Start:
                case InstantMessageDialog.SessionDrop:
                case InstantMessageDialog.SessionGroupStart:
                case InstantMessageDialog.SessionSend:
                    break;

                //case InstantMessageDialog.MessageFromObject:
                //case InstantMessageDialog.FromTaskAsAlert:
                //case InstantMessageDialog.MessageBox:
                //case InstantMessageDialog.GotoUrl:
                //case InstantMessageDialog.ConsoleAndChatHistory:
                //case InstantMessageDialog.NewUserDefault:
                default:
                    m_log.Warn("Received an IM with unhandled type " + type + " from " + agent.Name);
                    return;
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:82,代码来源:Messaging.cs


示例9: ViewerEffectHandler

        private void ViewerEffectHandler(Packet packet, LLAgent agent)
        {
            ViewerEffectPacket effect = (ViewerEffectPacket)packet;

            // Broadcast this viewer effect to everyone
            for (int i = 0; i < effect.Effect.Length; i++)
            {
                ViewerEffectPacket.EffectBlock block = effect.Effect[i];

                if (block.AgentID == agent.ID)
                    m_scene.CreateInterestListEvent(new InterestListEvent(UUID.Combine(block.ID, EFFECT_EVENT_ID), VIEWER_EFFECT, agent.ScenePosition, Vector3.One, block));
                else
                    m_log.Warn("Skipping ViewerEffect block for " + block.AgentID + " from " + agent.ID + " (" + agent.Name + ")");
            }
        }
开发者ID:thoys,项目名称:simian,代码行数:15,代码来源:Animations.cs


示例10: AgentSetAppearanceHandler

        private void AgentSetAppearanceHandler(Packet packet, LLAgent agent)
        {
            AgentSetAppearancePacket set = (AgentSetAppearancePacket)packet;
            UpdateFlags updateFlags = 0;
            LLUpdateFlags llUpdateFlags = 0;

            m_log.Debug("Updating avatar appearance with " + set.VisualParam.Length + " visual params, texture=" +
                (set.ObjectData.TextureEntry.Length > 1 ? "yes" : "no"));

            //TODO: Store this for cached bake responses
            for (int i = 0; i < set.WearableData.Length; i++)
            {
                //AvatarTextureIndex index = (AvatarTextureIndex)set.WearableData[i].TextureIndex;
                //UUID cacheID = set.WearableData[i].CacheID;

                //m_log.DebugFormat("WearableData: {0} is now {1}", index, cacheID);
            }

            // Create a TextureEntry
            if (set.ObjectData.TextureEntry.Length > 1)
            {
                agent.TextureEntry = new Primitive.TextureEntry(set.ObjectData.TextureEntry, 0,
                    set.ObjectData.TextureEntry.Length);

                llUpdateFlags |= LLUpdateFlags.Textures;

                #region Bake Cache Check

                for (int i = 0; i < BAKE_INDICES.Length; i++)
                {
                    int j = BAKE_INDICES[i];
                    Primitive.TextureEntryFace face = agent.TextureEntry.FaceTextures[j];

                    if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE)
                    {
                        m_log.Debug("Baked texture " + (AvatarTextureIndex)j + " set to " + face.TextureID);
                    }
                }

                #endregion Bake Cache Check
            }

            if (agent.Scale != set.AgentData.Size)
            {
                // This will be modified in UpdateHeight() if VisualParams are also sent
                agent.Scale = set.AgentData.Size;
                updateFlags |= UpdateFlags.Scale;
            }

            // Create a block of VisualParams
            if (set.VisualParam.Length > 1)
            {
                byte[] visualParams = new byte[set.VisualParam.Length];
                for (int i = 0; i < set.VisualParam.Length; i++)
                    visualParams[i] = set.VisualParam[i].ParamValue;

                agent.VisualParams = visualParams;
                agent.UpdateHeight();

                // Create the event that generates an AvatarAppearance packet for this agent
                m_scene.CreateInterestListEvent(new InterestListEvent
                (
                    UUID.Combine(agent.ID, APPEARANCE_EVENT_ID),
                    AVATAR_APPEARANCE,
                    agent.ScenePosition,
                    agent.Scale,
                    agent
                ));
            }

            if (updateFlags != 0 || llUpdateFlags != 0)
                m_scene.EntityAddOrUpdate(this, agent, updateFlags, (uint)llUpdateFlags);
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:73,代码来源:Appearance.cs


示例11: AgentWearablesRequestHandler

        private void AgentWearablesRequestHandler(Packet packet, LLAgent agent)
        {
            AgentWearablesUpdatePacket update = new AgentWearablesUpdatePacket();
            update.AgentData.AgentID = agent.ID;

            User user;
            if (m_userClient != null && m_userClient.TryGetUser(agent.ID, out user))
            {
                OSDMap appearanceMap = user.GetField("LLAppearance") as OSDMap;

                if (appearanceMap != null)
                {
                    Dictionary<WearableType, UUID> items = new Dictionary<WearableType, UUID>();
                    Dictionary<WearableType, UUID> assets = new Dictionary<WearableType, UUID>();

                    foreach (KeyValuePair<string, OSD> kvp in appearanceMap)
                    {
                        UUID id = kvp.Value.AsUUID();
                        if (id != UUID.Zero)
                        {
                            #region LLAppearance Parsing

                            switch (kvp.Key)
                            {
                                case "ShapeItem":
                                    items[WearableType.Shape] = id;
                                    break;
                                case "SkinItem":
                                    items[WearableType.Skin] = id;
                                    break;
                                case "HairItem":
                                    items[WearableType.Hair] = id;
                                    break;
                                case "EyesItem":
                                    items[WearableType.Eyes] = id;
                                    break;
                                case "ShirtItem":
                                    items[WearableType.Shirt] = id;
                                    break;
                                case "PantsItem":
                                    items[WearableType.Pants] = id;
                                    break;
                                case "ShoesItem":
                                    items[WearableType.Shoes] = id;
                                    break;
                                case "SocksItem":
                                    items[WearableType.Socks] = id;
                                    break;
                                case "JacketItem":
                                    items[WearableType.Jacket] = id;
                                    break;
                                case "GlovesItem":
                                    items[WearableType.Gloves] = id;
                                    break;
                                case "UndershirtItem":
                                    items[WearableType.Undershirt] = id;
                                    break;
                                case "UnderpantsItem":
                                    items[WearableType.Underpants] = id;
                                    break;
                                case "SkirtItem":
                                    items[WearableType.Skirt] = id;
                                    break;
                                case "AlphaItem":
                                    items[WearableType.Alpha] = id;
                                    break;
                                case "TattooItem":
                                    items[WearableType.Tattoo] = id;
                                    break;

                                case "ShapeAsset":
                                    assets[WearableType.Shape] = id;
                                    break;
                                case "SkinAsset":
                                    assets[WearableType.Skin] = id;
                                    break;
                                case "HairAsset":
                                    assets[WearableType.Hair] = id;
                                    break;
                                case "EyesAsset":
                                    assets[WearableType.Eyes] = id;
                                    break;
                                case "ShirtAsset":
                                    assets[WearableType.Shirt] = id;
                                    break;
                                case "PantsAsset":
                                    assets[WearableType.Pants] = id;
                                    break;
                                case "ShoesAsset":
                                    assets[WearableType.Shoes] = id;
                                    break;
                                case "SocksAsset":
                                    assets[WearableType.Socks] = id;
                                    break;
                                case "JacketAsset":
                                    assets[WearableType.Jacket] = id;
                                    break;
                                case "GlovesAsset":
                                    assets[WearableType.Gloves] = id;
                                    break;
//.........这里部分代码省略.........
开发者ID:osgrid,项目名称:openmetaverse,代码行数:101,代码来源:Appearance.cs


示例12: AgentIsNowWearingHandler

        private void AgentIsNowWearingHandler(Packet packet, LLAgent agent)
        {
            // This odd function takes the incoming map of WearableType -> ItemID, converts it to
            // the LLAppearance format of string -> ItemID, fetches all of the wearable inventory
            // items, and converts them into the LLAppearance format of string -> AssetID before
            // updating the user's LLAppearance data

            AgentIsNowWearingPacket wearing = (AgentIsNowWearingPacket)packet;

            OSDMap appearanceMap = new OSDMap();
            List<UUID> requestIDs = new List<UUID>(wearing.WearableData.Length);
            Dictionary<UUID, string> wornItems = new Dictionary<UUID, string>();
            int count = 0;

            // Put the ItemIDs in appearanceMap and requestIDs
            for (int i = 0; i < wearing.WearableData.Length; i++)
            {
                AgentIsNowWearingPacket.WearableDataBlock block = wearing.WearableData[i];

                #region WearableType Conversion

                switch ((WearableType)block.WearableType)
                {
                    case WearableType.Shape:
                        appearanceMap["ShapeItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "ShapeAsset";
                        break;
                    case WearableType.Skin:
                        appearanceMap["SkinItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "SkinAsset";
                        break;
                    case WearableType.Hair:
                        appearanceMap["HairItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "HairAsset";
                        break;
                    case WearableType.Eyes:
                        appearanceMap["EyesItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "EyesAsset";
                        break;
                    case WearableType.Shirt:
                        appearanceMap["ShirtItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "ShirtAsset";
                        break;
                    case WearableType.Pants:
                        appearanceMap["PantsItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "PantsAsset";
                        break;
                    case WearableType.Shoes:
                        appearanceMap["ShoesItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "ShoesAsset";
                        break;
                    case WearableType.Socks:
                        appearanceMap["SocksItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "SocksAsset";
                        break;
                    case WearableType.Jacket:
                        appearanceMap["JacketItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "JacketAsset";
                        break;
                    case WearableType.Gloves:
                        appearanceMap["GlovesItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "GlovesAsset";
                        break;
                    case WearableType.Undershirt:
                        appearanceMap["UndershirtItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "UndershirtAsset";
                        break;
                    case WearableType.Underpants:
                        appearanceMap["UnderpantsItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "UnderpantsAsset";
                        break;
                    case WearableType.Skirt:
                        appearanceMap["SkirtItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "SkirtAsset";
                        break;
                    case WearableType.Alpha:
                        appearanceMap["AlphaItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "AlphaAsset";
                        break;
                    case WearableType.Tattoo:
                        appearanceMap["TattooItem"] =  OSD.FromUUID(block.ItemID);
                        wornItems[block.ItemID] = "TattooAsset";
                        break;
                }

                #endregion WearableType Conversion

                if (block.ItemID != UUID.Zero)
                {
                    requestIDs.Add(block.ItemID);
                    ++count;
                }
            }

            m_log.Debug("Updating agent wearables for " + agent.Name + ", new count: " + count);

            // Fetch all of the AssetIDs for inventory items listed in requestIDs
            IDictionary<UUID, UUID> itemsToAssetIDs;
            if (m_inventoryClient != null && m_inventoryClient.TryGetAssetIDs(agent.ID, requestIDs.ToArray(), out itemsToAssetIDs))
            {
//.........这里部分代码省略.........
开发者ID:osgrid,项目名称:openmetaverse,代码行数:101,代码来源:Appearance.cs


示例13: AgentCachedTextureHandler

        private void AgentCachedTextureHandler(Packet packet, LLAgent agent)
        {
            AgentCachedTexturePacket cached = (AgentCachedTexturePacket)packet;

            AgentCachedTextureResponsePacket response = new AgentCachedTextureResponsePacket();
            response.Header.Zerocoded = true;

            response.AgentData.AgentID = agent.ID;
            response.AgentData.SerialNum = cached.AgentData.SerialNum;

            response.WearableData = new AgentCachedTextureResponsePacket.WearableDataBlock[cached.WearableData.Length];

            // TODO: Respond back with actual cache entries if we have them
            for (int i = 0; i < cached.WearableData.Length; i++)
            {
                response.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
                response.WearableData[i].TextureIndex = cached.WearableData[i].TextureIndex;
                response.WearableData[i].TextureID = UUID.Zero;
                response.WearableData[i].HostName = Utils.EmptyBytes;
            }

            m_log.DebugFormat("Sending a cached texture response with {0}/{1} cache hits, SerialNum={2}",
                0, cached.WearableData.Length, cached.AgentData.SerialNum);

            m_udp.SendPacket(agent, response, ThrottleCategory.Task, false);
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:26,代码来源:Appearance.cs


示例14: UpdateTaskInventoryHandler

        private void UpdateTaskInventoryHandler(Packet packet, LLAgent agent)
        {
            UpdateTaskInventoryPacket update = (UpdateTaskInventoryPacket)packet;

            LLInventoryTaskItem item;
            ISceneEntity targetObj;

            if (update.UpdateData.Key != 0)
            {
                m_log.Warn("Got an UpdateTaskInventory packet with a Key of " + update.UpdateData.Key);
                return;
            }

            if (m_scene.TryGetEntity(update.UpdateData.LocalID, out targetObj) && targetObj is LLPrimitive)
            {
                LLPrimitive targetPrim = (LLPrimitive)targetObj;

                // Updating an existing item in the task inventory
                if (targetPrim.Inventory.TryGetItem(update.InventoryData.ItemID, out item))
                {
                    if (update.InventoryData.TransactionID != UUID.Zero)
                        item.AssetID = UUID.Combine(update.InventoryData.TransactionID, agent.SecureSessionID);

                    item.Description = Utils.BytesToString(update.InventoryData.Description);
                    item.Flags = update.InventoryData.Flags;
                    item.GroupID = update.InventoryData.GroupID;
                    item.GroupOwned = update.InventoryData.GroupOwned;
                    item.Name = Utils.BytesToString(update.InventoryData.Name);
                    item.Permissions = new Permissions(update.InventoryData.BaseMask, update.InventoryData.EveryoneMask,
                        update.InventoryData.GroupMask, update.InventoryData.NextOwnerMask, update.InventoryData.OwnerMask);
                    item.SalePrice = update.InventoryData.SalePrice;
                    item.SaleType = (SaleType)update.InventoryData.SaleType;

                    targetPrim.Inventory.AddOrUpdateItem(item, true);
                    m_log.Debug(agent.Name + " updated task inventory item: " + item.Name);

                    SignalTaskInventoryChange(agent, targetPrim);
                }
                else if (m_inventory != null)
                {
                    // Copying from agent inventory to task inventory
                    InventoryBase obj;
                    if (m_inventory.TryGetInventory(agent.ID, update.InventoryData.ItemID, out obj))
                    {
                        if (obj is InventoryItem)
                        {
                            // Create a new item in the task inventory
                            LLInventoryItem fromItem = new LLInventoryItem((InventoryItem)obj);

                            item = new LLInventoryTaskItem();
                            //item.ID will be assigned in AddOrUpdateItem
                            item.AssetID = fromItem.AssetID;
                            item.ContentType = fromItem.ContentType;
                            item.CreationDate = fromItem.CreationDate;
                            item.CreatorID = fromItem.CreatorID;
                            item.Description = fromItem.Description;
                            item.Flags = fromItem.ExtraData["Flags"].AsUInteger();
                            item.GrantedPermissions = 0;
                            item.GroupID = fromItem.ExtraData["group_id"].AsUUID();
                            item.GroupOwned = fromItem.ExtraData["group_owned"].AsBoolean();
                            item.Name = fromItem.Name;
                            item.OwnerID = agent.ID;
                            item.ParentID = update.InventoryData.FolderID;
                            item.ParentObjectID = targetPrim.ID;
                            item.PermissionGranter = UUID.Zero;
                            item.Permissions = fromItem.Permissions;
                            item.SalePrice = fromItem.ExtraData["sale_price"].AsInteger();
                            item.SaleType = (SaleType)fromItem.ExtraData["sale_type"].AsInteger();

                            targetPrim.Inventory.AddOrUpdateItem(item, false);
                            m_log.Debug(agent.Name + " created new task inventory item: " + item.Name);

                            SignalTaskInventoryChange(agent, targetPrim);
                        }
                        else
                        {
                            m_log.Error("[TODO] Handle dropping folders in task inventory");
                        }
                    }
                    else
                    {
                        m_log.Warn(agent.Name + " sent an UpdateTaskInventory packet requesting unknown " +
                            "(or failed to fetch) inventory item " + update.InventoryData.ItemID);
                    }
                }
                else
                {
                    m_log.Warn(agent.Name + "attempted to copy inventory item " + update.InventoryData.ItemID +
                        " to task inventory, but we have no IInventoryClient");
                }
            }
            else
            {
                m_log.Warn(agent.Name + " attempted to update task inventory for prim " + update.UpdateData.LocalID +
                    " that does not exist in this scene");
            }
        }
开发者ID:osgrid,项目名称:openmetaverse,代码行数:97,代码来源:TaskInventory.cs


示例15: UUIDNameRequestHandler

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LLClientView类代码示例发布时间:2022-05-24
下一篇:
C# LG类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap