diff --git a/OpenMetaverse.GUI/LocalChat.cs b/OpenMetaverse.GUI/LocalChat.cs index a2f2a2e6..34d02af2 100644 --- a/OpenMetaverse.GUI/LocalChat.cs +++ b/OpenMetaverse.GUI/LocalChat.cs @@ -65,7 +65,7 @@ namespace OpenMetaverse.GUI _txtInput.Dock = DockStyle.Bottom; _txtInput.KeyDown += new KeyEventHandler(_txtInput_KeyDown); - this.Controls.AddRange(new Control[]{ _rtfOutput, _txtInput }); + this.Controls.AddRange(new Control[] { _txtInput, _rtfOutput }); } /// diff --git a/OpenMetaverse.GUI/MiniMap.cs b/OpenMetaverse.GUI/MiniMap.cs index 19134887..47696fb7 100644 --- a/OpenMetaverse.GUI/MiniMap.cs +++ b/OpenMetaverse.GUI/MiniMap.cs @@ -24,6 +24,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +using OpenMetaverse.Imaging; using System.Drawing; using System.Windows.Forms; @@ -31,7 +32,9 @@ namespace OpenMetaverse.GUI { public class MiniMap : PictureBox { + private UUID _MapImageID; private GridClient _Client; + private Image _MapLayer; /// /// Gets or sets the GridClient associated with this control @@ -62,7 +65,28 @@ namespace OpenMetaverse.GUI private void InitializeClient(GridClient client) { _Client = client; + _Client.Assets.OnImageReceived += new AssetManager.ImageReceivedCallback(Assets_OnImageReceived); _Client.Grid.OnCoarseLocationUpdate += new GridManager.CoarseLocationUpdateCallback(Grid_OnCoarseLocationUpdate); + _Client.Network.OnCurrentSimChanged += new NetworkManager.CurrentSimChangedCallback(Network_OnCurrentSimChanged); + } + + void Assets_OnImageReceived(ImageDownload image, AssetTexture asset) + { + if (asset.AssetID == _MapImageID) + { + ManagedImage nullImage; + OpenJPEG.DecodeToImage(asset.AssetData, out nullImage, out _MapLayer); + } + } + + void Network_OnCurrentSimChanged(Simulator PreviousSimulator) + { + GridRegion region; + if (Client.Grid.GetGridRegion(Client.Network.CurrentSim.Name, GridLayerType.Objects, out region)) + { + _MapImageID = region.MapImageID; + Client.Assets.RequestImage(_MapImageID, ImageType.Baked); + } } private void UpdateMiniMap(Simulator sim) @@ -70,13 +94,15 @@ namespace OpenMetaverse.GUI if (this.InvokeRequired) this.BeginInvoke((MethodInvoker)delegate { UpdateMiniMap(sim); }); else { - Bitmap bmp = new Bitmap(256, 256); + Bitmap bmp = _MapLayer == null ? new Bitmap(256, 256) : (Bitmap)_MapLayer; Graphics g = Graphics.FromImage(bmp); //SolidBrush brush = new SolidBrush(Color.FromArgb(90, 32, 32, 32)); - g.Clear(this.BackColor); - - g.FillRectangle(Brushes.White, 0f, 0f, 256f, 256f); + if (_MapLayer == null) + { + g.Clear(this.BackColor); + g.FillRectangle(Brushes.White, 0f, 0f, 256f, 256f); + } if (sim.PositionIndexYou == -1 || sim.PositionIndexYou >= sim.AvatarPositions.Count) return; diff --git a/Programs/examples/Dashboard/Dashboard.Designer.cs b/Programs/examples/Dashboard/Dashboard.Designer.cs index 57180bcd..812a5e80 100644 --- a/Programs/examples/Dashboard/Dashboard.Designer.cs +++ b/Programs/examples/Dashboard/Dashboard.Designer.cs @@ -29,19 +29,19 @@ namespace Dashboard private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.localChat1 = new OpenMetaverse.GUI.LocalChat(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); - this.avatarList1 = new OpenMetaverse.GUI.AvatarList(); this.tabPage2 = new System.Windows.Forms.TabPage(); - this.friendsList1 = new OpenMetaverse.GUI.FriendList(); this.tabPage3 = new System.Windows.Forms.TabPage(); - this.groupList1 = new OpenMetaverse.GUI.GroupList(); this.tabPage4 = new System.Windows.Forms.TabPage(); + this.txtStatus = new System.Windows.Forms.Label(); + this.localChat1 = new OpenMetaverse.GUI.LocalChat(); + this.avatarList1 = new OpenMetaverse.GUI.AvatarList(); + this.friendsList1 = new OpenMetaverse.GUI.FriendList(); + this.groupList1 = new OpenMetaverse.GUI.GroupList(); this.inventoryTree1 = new OpenMetaverse.GUI.InventoryTree(); this.miniMap1 = new OpenMetaverse.GUI.MiniMap(); - this.txtStatus = new System.Windows.Forms.Label(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -75,15 +75,6 @@ namespace Dashboard this.splitContainer1.SplitterDistance = 415; this.splitContainer1.TabIndex = 4; // - // localChat1 - // - this.localChat1.Client = null; - this.localChat1.Dock = System.Windows.Forms.DockStyle.Fill; - this.localChat1.Location = new System.Drawing.Point(0, 0); - this.localChat1.Name = "localChat1"; - this.localChat1.Size = new System.Drawing.Size(415, 419); - this.localChat1.TabIndex = 4; - // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -113,7 +104,7 @@ namespace Dashboard this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(208, 209); - this.tabControl1.TabIndex = 9; + this.tabControl1.TabIndex = 1; // // tabPage1 // @@ -126,6 +117,57 @@ namespace Dashboard this.tabPage1.Text = "Nearby"; this.tabPage1.UseVisualStyleBackColor = true; // + // tabPage2 + // + this.tabPage2.Controls.Add(this.friendsList1); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(200, 183); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Friends"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.groupList1); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(200, 183); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Groups"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // tabPage4 + // + this.tabPage4.Controls.Add(this.inventoryTree1); + this.tabPage4.Location = new System.Drawing.Point(4, 22); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Size = new System.Drawing.Size(200, 183); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "Inventory"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // txtStatus + // + this.txtStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtStatus.AutoEllipsis = true; + this.txtStatus.Location = new System.Drawing.Point(10, 426); + this.txtStatus.Name = "txtStatus"; + this.txtStatus.Size = new System.Drawing.Size(611, 13); + this.txtStatus.TabIndex = 5; + this.txtStatus.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // localChat1 + // + this.localChat1.Client = null; + this.localChat1.Dock = System.Windows.Forms.DockStyle.Fill; + this.localChat1.Location = new System.Drawing.Point(0, 0); + this.localChat1.Name = "localChat1"; + this.localChat1.Size = new System.Drawing.Size(415, 419); + this.localChat1.TabIndex = 3; + // // avatarList1 // this.avatarList1.Client = null; @@ -133,70 +175,39 @@ namespace Dashboard this.avatarList1.Location = new System.Drawing.Point(3, 3); this.avatarList1.Name = "avatarList1"; this.avatarList1.Size = new System.Drawing.Size(194, 177); - this.avatarList1.TabIndex = 3; + this.avatarList1.TabIndex = 2; this.avatarList1.UseCompatibleStateImageBehavior = false; this.avatarList1.View = System.Windows.Forms.View.Details; // - // tabPage2 - // - this.tabPage2.Controls.Add(this.friendsList1); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(200, 221); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Friends"; - this.tabPage2.UseVisualStyleBackColor = true; - // // friendsList1 // this.friendsList1.Client = null; this.friendsList1.Dock = System.Windows.Forms.DockStyle.Fill; this.friendsList1.Location = new System.Drawing.Point(3, 3); this.friendsList1.Name = "friendsList1"; - this.friendsList1.Size = new System.Drawing.Size(194, 215); + this.friendsList1.Size = new System.Drawing.Size(194, 177); this.friendsList1.TabIndex = 5; this.friendsList1.UseCompatibleStateImageBehavior = false; this.friendsList1.View = System.Windows.Forms.View.Details; // - // tabPage3 - // - this.tabPage3.Controls.Add(this.groupList1); - this.tabPage3.Location = new System.Drawing.Point(4, 22); - this.tabPage3.Name = "tabPage3"; - this.tabPage3.Size = new System.Drawing.Size(200, 221); - this.tabPage3.TabIndex = 2; - this.tabPage3.Text = "Groups"; - this.tabPage3.UseVisualStyleBackColor = true; - // // groupList1 // this.groupList1.Client = null; this.groupList1.Dock = System.Windows.Forms.DockStyle.Fill; this.groupList1.Location = new System.Drawing.Point(0, 0); this.groupList1.Name = "groupList1"; - this.groupList1.Size = new System.Drawing.Size(200, 221); + this.groupList1.Size = new System.Drawing.Size(200, 183); this.groupList1.TabIndex = 7; this.groupList1.UseCompatibleStateImageBehavior = false; this.groupList1.View = System.Windows.Forms.View.Details; // - // tabPage4 - // - this.tabPage4.Controls.Add(this.inventoryTree1); - this.tabPage4.Location = new System.Drawing.Point(4, 22); - this.tabPage4.Name = "tabPage4"; - this.tabPage4.Size = new System.Drawing.Size(200, 221); - this.tabPage4.TabIndex = 3; - this.tabPage4.Text = "Inventory"; - this.tabPage4.UseVisualStyleBackColor = true; - // // inventoryTree1 // this.inventoryTree1.Client = null; this.inventoryTree1.Dock = System.Windows.Forms.DockStyle.Fill; this.inventoryTree1.Location = new System.Drawing.Point(0, 0); this.inventoryTree1.Name = "inventoryTree1"; - this.inventoryTree1.Size = new System.Drawing.Size(200, 221); + this.inventoryTree1.Size = new System.Drawing.Size(200, 183); this.inventoryTree1.TabIndex = 1; // // miniMap1 @@ -212,17 +223,6 @@ namespace Dashboard this.miniMap1.TabIndex = 11; this.miniMap1.TabStop = false; // - // txtStatus - // - this.txtStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtStatus.AutoEllipsis = true; - this.txtStatus.Location = new System.Drawing.Point(10, 426); - this.txtStatus.Name = "txtStatus"; - this.txtStatus.Size = new System.Drawing.Size(611, 13); - this.txtStatus.TabIndex = 5; - this.txtStatus.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // // Dashboard // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Programs/examples/Dashboard/Dashboard.cs b/Programs/examples/Dashboard/Dashboard.cs index 528b28ae..a85b6245 100644 --- a/Programs/examples/Dashboard/Dashboard.cs +++ b/Programs/examples/Dashboard/Dashboard.cs @@ -28,6 +28,7 @@ namespace Dashboard //initialize client object Client = new GridClient(); + Client.Settings.USE_TEXTURE_CACHE = true; Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin); LoginParams ClientLogin = Client.Network.DefaultLoginParams(firstName, lastName, password, "OpenMetaverse Dashboard", Assembly.GetExecutingAssembly().GetName().Version.ToString()); ClientLogin.Start = "last";