コード例 #1
0
ファイル: frmGroupInfo.cs プロジェクト: RavenB/gridsearch
        public frmGroupInfo(Group group, SecondLife client)
        {
            InitializeComponent();

            while (!IsHandleCreated)
            {
                // Force handle creation
                IntPtr temp = Handle;
            }

            GroupProfileCallback = new GroupManager.GroupProfileCallback(GroupProfileHandler);
            GroupMembersCallback = new GroupManager.GroupMembersCallback(GroupMembersHandler);
            GroupTitlesCallback = new GroupManager.GroupTitlesCallback(GroupTitlesHandler);
            AvatarNamesCallback = new AvatarManager.AvatarNamesCallback(AvatarNamesHandler);
            ImageReceivedCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);

            Group = group;
            Client = client;
            
            // Register the callbacks for this form
            Client.Assets.OnImageReceived += ImageReceivedCallback;
            Client.Groups.OnGroupProfile += GroupProfileCallback;
            Client.Groups.OnGroupMembers += GroupMembersCallback;
            Client.Groups.OnGroupTitles += GroupTitlesCallback;
            Client.Avatars.OnAvatarNames += AvatarNamesCallback;

            // Request the group information
            Client.Groups.RequestGroupProfile(Group.ID);
            Client.Groups.RequestGroupMembers(Group.ID);
            Client.Groups.RequestGroupTitles(Group.ID);
        }
コード例 #2
0
        public frmGroupInfo(Group group, GridClient client)
        {
            InitializeComponent();

            while (!IsHandleCreated)
            {
                // Force handle creation
                IntPtr temp = Handle;
            }

            GroupProfileCallback  = new GroupManager.GroupProfileCallback(GroupProfileHandler);
            GroupMembersCallback  = new GroupManager.GroupMembersCallback(GroupMembersHandler);
            GroupTitlesCallback   = new GroupManager.GroupTitlesCallback(GroupTitlesHandler);
            AvatarNamesCallback   = new AvatarManager.AvatarNamesCallback(AvatarNamesHandler);
            ImageReceivedCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);

            Group  = group;
            Client = client;

            // Register the callbacks for this form
            Client.Assets.OnImageReceived += ImageReceivedCallback;
            Client.Groups.OnGroupProfile  += GroupProfileCallback;
            Client.Groups.OnGroupMembers  += GroupMembersCallback;
            Client.Groups.OnGroupTitles   += GroupTitlesCallback;
            Client.Avatars.OnAvatarNames  += AvatarNamesCallback;

            // Request the group information
            Client.Groups.RequestGroupProfile(Group.ID);
            Client.Groups.RequestGroupMembers(Group.ID);
            Client.Groups.RequestGroupTitles(Group.ID);
        }
コード例 #3
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to <code>SecondLife</code> client</param>
        public TexturePipeline(GridClient client)
        {
            Running = true;

            RequestQueue = new Queue<UUID>();
            CurrentRequests = new Dictionary<UUID, int>(MAX_TEXTURE_REQUESTS);

            RenderReady = new Dictionary<UUID, ImageDownload>();

            resetEvents = new AutoResetEvent[MAX_TEXTURE_REQUESTS];
            threadpoolSlots = new int[MAX_TEXTURE_REQUESTS];

            // pre-configure autoreset events/download slots
            for (int i = 0; i < MAX_TEXTURE_REQUESTS; i++)
            {
                resetEvents[i] = new AutoResetEvent(false);
                threadpoolSlots[i] = -1;
            }

            Client = client;

            DownloadCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
            DownloadProgCallback = new AssetManager.ImageReceiveProgressCallback(Assets_OnImageReceiveProgress);
            Client.Assets.OnImageReceived += DownloadCallback;
            Client.Assets.OnImageReceiveProgress += DownloadProgCallback;

            // Fire up the texture download thread
            downloadMaster = new Thread(new ThreadStart(DownloadThread));
            downloadMaster.Start();
        }
コード例 #4
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to <code>SecondLife</code> client</param>
        public TexturePipeline(GridClient client)
        {
            Running = true;

            RequestQueue    = new Queue <UUID>();
            CurrentRequests = new Dictionary <UUID, int>(MAX_TEXTURE_REQUESTS);

            RenderReady = new Dictionary <UUID, ImageDownload>();

            resetEvents     = new AutoResetEvent[MAX_TEXTURE_REQUESTS];
            threadpoolSlots = new int[MAX_TEXTURE_REQUESTS];

            // pre-configure autoreset events/download slots
            for (int i = 0; i < MAX_TEXTURE_REQUESTS; i++)
            {
                resetEvents[i]     = new AutoResetEvent(false);
                threadpoolSlots[i] = -1;
            }

            Client = client;

            DownloadCallback                      = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
            DownloadProgCallback                  = new AssetManager.ImageReceiveProgressCallback(Assets_OnImageReceiveProgress);
            Client.Assets.OnImageReceived        += DownloadCallback;
            Client.Assets.OnImageReceiveProgress += DownloadProgCallback;

            // Fire up the texture download thread
            downloadMaster = new Thread(new ThreadStart(DownloadThread));
            downloadMaster.Start();
        }
コード例 #5
0
        public DumpOutfitCommand(TestClient testClient)
        {
            Name = "dumpoutfit";
            Description = "Dumps all of the textures from an avatars outfit to the hard drive. Usage: dumpoutfit [avatar-Guid]";
            Category = CommandCategory.Inventory;

            ImageReceivedHandler = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
        }
コード例 #6
0
        public DumpOutfitCommand(TestClient testClient)
        {
            Name        = "dumpoutfit";
            Description = "Dumps all of the textures from an avatars outfit to the hard drive. Usage: dumpoutfit [avatar-uuid]";
            Category    = CommandCategory.Inventory;

            ImageReceivedHandler = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
        }
コード例 #7
0
        private void UpdateAppearanceFromWearables(bool bake)
        {
            lock (AgentTextures)
            {
                for (int i = 0; i < AgentTextures.Length; i++)
                    AgentTextures[i] = LLUUID.Zero;
            }

            // Register an asset download callback to get wearable data
            AssetManager.AssetReceivedCallback assetCallback = new AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);
            AssetManager.ImageReceivedCallback imageCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
            AssetManager.AssetUploadedCallback uploadCallback = new AssetManager.AssetUploadedCallback(Assets_OnAssetUploaded);
            Assets.OnAssetReceived += assetCallback;
            Assets.OnImageReceived += imageCallback;
            Assets.OnAssetUploaded += uploadCallback;

            // Download assets for what we are wearing and fill in AgentTextures
            DownloadWearableAssets();
            WearablesDownloadedEvent.WaitOne();

            // Unregister the asset download callback
            Assets.OnAssetReceived -= assetCallback;

            // Check if anything needs to be rebaked
            if (bake) RequestCachedBakes();

            // Tell the sim what we are wearing
            SendAgentIsNowWearing();

            // Wait for cached layer check to finish
            if (bake) CachedResponseEvent.WaitOne();

            // Unregister the image download and asset upload callbacks
            Assets.OnImageReceived -= imageCallback;
            Assets.OnAssetUploaded -= uploadCallback;

            Client.DebugLog("CachedResponseEvent completed");

            #region Send Appearance

            LLObject.TextureEntry te = null;

            ObjectManager.NewAvatarCallback updateCallback =
                delegate(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
                {
                    if (avatar.LocalID == Client.Self.LocalID)
                    {
                        if (avatar.Textures.FaceTextures != null)
                        {
                            bool match = true;

                            for (uint i = 0; i < AgentTextures.Length; i++)
                            {
                                LLObject.TextureEntryFace face = avatar.Textures.FaceTextures[i];

                                if (face == null)
                                {
                                    // If the texture is LLUUID.Zero the face should be null
                                    if (AgentTextures[i] != LLUUID.Zero)
                                    {
                                        match = false;
                                        break;
                                    }
                                }
                                else if (face.TextureID != AgentTextures[i])
                                {
                                    match = false;
                                    break;
                                }
                            }

                            if (!match)
                                Client.Log("TextureEntry mismatch after updating our appearance", Helpers.LogLevel.Warning);

                            te = avatar.Textures;
                            UpdateEvent.Set();
                        }
                        else
                        {
                            Client.Log("Received an update for our avatar with a null FaceTextures array",
                                Helpers.LogLevel.Warning);
                        }
                    }
                };
            Client.Objects.OnNewAvatar += updateCallback;

            // Send all of the visual params and textures for our agent
            SendAgentSetAppearance();

            // Wait for the ObjectUpdate to come in for our avatar after changing appearance
            if (UpdateEvent.WaitOne(1000 * 60, false))
            {
                if (OnAppearanceUpdated != null)
                {
                    try { OnAppearanceUpdated(te); }
                    catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
                }
            }
            else
            {
                Client.Log("Timed out waiting for our appearance to update on the simulator", Helpers.LogLevel.Warning);
            }

            Client.Objects.OnNewAvatar -= updateCallback;

            #endregion Send Appearance
        }