Пример #1
0
        /// <summary>
        /// The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        public void AgentCachedTexturesRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            List <CachedAgentArgs> resp = new List <CachedAgentArgs>();

            //AvatarData ad = m_scene.AvatarService.GetAvatar(client.AgentId);
            //Send all with UUID zero for now so that we don't confuse the client about baked textures...
            foreach (CachedAgentArgs arg in args)
            {
                UUID cachedID = UUID.Zero;

                /*if (ad.Data.ContainsKey("CachedWearables"))
                 * {
                 *  OSDArray array = (OSDArray)OSDParser.DeserializeJson(ad.Data["CachedWearables"]);
                 *  AvatarWearable wearable = new AvatarWearable();
                 *  wearable.MaxItems = 0; //Unlimited items
                 *  wearable.Unpack(array);
                 *  cachedID = wearable.GetAsset(arg.ID);
                 * }*/
                CachedAgentArgs respArgs = new CachedAgentArgs();
                respArgs.ID           = cachedID;
                respArgs.TextureIndex = arg.TextureIndex;
                resp.Add(respArgs);
            }

            client.SendAgentCachedTexture(resp);
        }
        /// <summary>
        ///     The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        void AgentCachedTexturesRequest(IClientAPI client, List <CachedAgentArgs> args)
        {
            IScenePresence          sp  = m_scene.GetScenePresence(client.AgentId);
            IAvatarAppearanceModule app = sp.RequestModuleInterface <IAvatarAppearanceModule> ();
            // Look up hashes to make sure that the request is valid

            List <CachedAgentArgs> resp = new List <CachedAgentArgs> ();

            foreach (CachedAgentArgs arg in args)
            {
                CachedAgentArgs r = new CachedAgentArgs();
                r.TextureIndex = arg.TextureIndex;
                //V2 changed to send the actual texture index, and not the baked texture index
                int index = arg.TextureIndex >= 5
                    ? arg.TextureIndex
                    : (int)AppearanceManager.BakeTypeToAgentTextureIndex((BakeType)arg.TextureIndex);

                r.ID = (
                    app.Appearance.Texture.FaceTextures [index] == null ||
                    app.Appearance.WearableCache.Count == 0 ||
                    !app.Appearance.WearableCache.ContainsKey(index.ToString()) ||
                    app.Appearance.WearableCache [index.ToString()] != arg.ID
                        ? UUID.Zero
                        : app.Appearance.Texture.FaceTextures [index].TextureID);

                resp.Add(r);
            }

            client.SendAgentCachedTexture(resp);
        }
        /// <summary>
        ///     The client wants to know whether we already have baked textures for the given items
        /// </summary>
        /// <param name="client"></param>
        /// <param name="args"></param>
        private void AgentCachedTexturesRequest(IClientAPI client, List<CachedAgentArgs> args)
        {
            IScenePresence sp = m_scene.GetScenePresence(client.AgentId);
            IAvatarAppearanceModule app = sp.RequestModuleInterface<IAvatarAppearanceModule>();
            // Look up hashes to make sure that the request is valid

            List<CachedAgentArgs> resp = new List<CachedAgentArgs>();
            foreach (CachedAgentArgs arg in args)
            {
                CachedAgentArgs r = new CachedAgentArgs();
                r.TextureIndex = arg.TextureIndex;
                //V2 changed to send the actual texture index, and not the baked texture index
                int index = arg.TextureIndex >= 5 ? arg.TextureIndex :
                    (int)AppearanceManager.BakeTypeToAgentTextureIndex((BakeType)arg.TextureIndex);
                r.ID = app.Appearance.Texture.FaceTextures[index] == null ||
                    app.Appearance.WearableCache.Count == 0 ||
                    !app.Appearance.WearableCache.ContainsKey(index.ToString()) ||
                    app.Appearance.WearableCache[index.ToString()] != arg.ID ?
                    UUID.Zero : app.Appearance.Texture.FaceTextures[index].TextureID;
                resp.Add(r);
            }

            client.SendAgentCachedTexture(resp);
        }