}
}
- public void CenterMap(ulong regionHandle, uint localX, uint localY)
+ public void CenterMap(ulong regionHandle, uint localX, uint localY, bool setTarget)
{
uint regionX, regionY;
Utils.LongToUInts(regionHandle, out regionX, out regionY);
- CenterMap(regionX, regionY, localX, localY);
+ CenterMap(regionX, regionY, localX, localY, setTarget);
}
- public void CenterMap(uint regionX, uint regionY, uint localX, uint localY)
+ public void CenterMap(uint regionX, uint regionY, uint localX, uint localY, bool setTarget)
{
centerX = (double)regionX * 256 + (double)localX;
centerY = (double)regionY * 256 + (double)localY;
centered = true;
+ if (setTarget)
+ {
+ ulong handle = Utils.UIntsToLong(regionX * 256, regionY * 256);
+ if (regions.ContainsKey(handle))
+ {
+ targetRegion = regions[handle];
+ GetTargetParcel();
+ if (MapTargetChanged != null)
+ {
+ MapTargetChanged(this, new MapTargetChangedEventArgs(targetRegion, (int)localX, (int)localY));
+ }
+ }
+ else
+ {
+ targetRegion = new GridRegion();
+ }
+ targetX = centerX;
+ targetY = centerY;
+ }
+
// opensim grids need extra push
if (Instance.Netcom.Grid.Platform == "OpenSim")
{
private void InitializeComponent()
{
this.pnlSearch = new System.Windows.Forms.Panel();
+ this.ddOnlineFriends = new System.Windows.Forms.ComboBox();
this.lblStatus = new System.Windows.Forms.Label();
this.btnDestination = new System.Windows.Forms.Button();
this.btnMyPos = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.nudZ = new System.Windows.Forms.NumericUpDown();
this.label4 = new System.Windows.Forms.Label();
- this.lstRegions = new Radegast.ListViewNoFlicker();
this.btnSearch = new System.Windows.Forms.Button();
this.txtRegion = new System.Windows.Forms.TextBox();
- this.pnlMap = new System.Windows.Forms.Panel();
this.zoomTracker = new System.Windows.Forms.TrackBar();
+ this.pnlMap = new System.Windows.Forms.Panel();
+ this.lstRegions = new Radegast.ListViewNoFlicker();
this.pnlSearch.SuspendLayout();
this.pnlProgress.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit();
//
// pnlSearch
//
+ this.pnlSearch.Controls.Add(this.ddOnlineFriends);
this.pnlSearch.Controls.Add(this.lblStatus);
this.pnlSearch.Controls.Add(this.btnDestination);
this.pnlSearch.Controls.Add(this.btnMyPos);
this.pnlSearch.Size = new System.Drawing.Size(194, 412);
this.pnlSearch.TabIndex = 0;
//
+ // ddOnlineFriends
+ //
+ this.ddOnlineFriends.AccessibleName = "Find online friends on the grid";
+ this.ddOnlineFriends.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.ddOnlineFriends.FormattingEnabled = true;
+ this.ddOnlineFriends.Items.AddRange(new object[] {
+ "Online Friends"});
+ this.ddOnlineFriends.Location = new System.Drawing.Point(6, 195);
+ this.ddOnlineFriends.Name = "ddOnlineFriends";
+ this.ddOnlineFriends.Size = new System.Drawing.Size(182, 21);
+ this.ddOnlineFriends.TabIndex = 3;
+ this.ddOnlineFriends.SelectedIndexChanged += new System.EventHandler(this.ddOnlineFriends_SelectedIndexChanged);
+ //
// lblStatus
//
this.lblStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnDestination.Location = new System.Drawing.Point(91, 299);
this.btnDestination.Name = "btnDestination";
this.btnDestination.Size = new System.Drawing.Size(75, 23);
- this.btnDestination.TabIndex = 21;
+ this.btnDestination.TabIndex = 22;
this.btnDestination.Text = "Destination";
this.btnDestination.UseVisualStyleBackColor = true;
this.btnDestination.Click += new System.EventHandler(this.btnDestination_Click);
this.btnGoHome.Location = new System.Drawing.Point(91, 270);
this.btnGoHome.Name = "btnGoHome";
this.btnGoHome.Size = new System.Drawing.Size(75, 23);
- this.btnGoHome.TabIndex = 21;
+ this.btnGoHome.TabIndex = 19;
this.btnGoHome.Text = "Go home";
this.btnGoHome.UseVisualStyleBackColor = true;
this.btnGoHome.Click += new System.EventHandler(this.btnGoHome_Click);
this.label4.TabIndex = 16;
this.label4.Text = "Y";
//
- // lstRegions
- //
- this.lstRegions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.lstRegions.Location = new System.Drawing.Point(6, 38);
- this.lstRegions.MultiSelect = false;
- this.lstRegions.Name = "lstRegions";
- this.lstRegions.ShowGroups = false;
- this.lstRegions.Size = new System.Drawing.Size(182, 175);
- this.lstRegions.Sorting = System.Windows.Forms.SortOrder.Ascending;
- this.lstRegions.TabIndex = 2;
- this.lstRegions.UseCompatibleStateImageBehavior = false;
- this.lstRegions.View = System.Windows.Forms.View.List;
- this.lstRegions.SelectedIndexChanged += new System.EventHandler(this.lstRegions_SelectedIndexChanged);
- this.lstRegions.Enter += new System.EventHandler(this.lstRegions_Enter);
- //
// btnSearch
//
this.btnSearch.Location = new System.Drawing.Point(136, 11);
this.txtRegion.TabIndex = 0;
this.txtRegion.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtRegion_KeyDown);
//
- // pnlMap
- //
- this.pnlMap.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlMap.Location = new System.Drawing.Point(0, 0);
- this.pnlMap.Name = "pnlMap";
- this.pnlMap.Size = new System.Drawing.Size(560, 412);
- this.pnlMap.TabIndex = 1;
- //
// zoomTracker
//
this.zoomTracker.Location = new System.Drawing.Point(6, 331);
this.zoomTracker.Visible = false;
this.zoomTracker.Scroll += new System.EventHandler(this.zoomTracker_Scroll);
//
+ // pnlMap
+ //
+ this.pnlMap.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlMap.Location = new System.Drawing.Point(0, 0);
+ this.pnlMap.Name = "pnlMap";
+ this.pnlMap.Size = new System.Drawing.Size(560, 412);
+ this.pnlMap.TabIndex = 1;
+ //
+ // lstRegions
+ //
+ this.lstRegions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.lstRegions.Location = new System.Drawing.Point(6, 38);
+ this.lstRegions.MultiSelect = false;
+ this.lstRegions.Name = "lstRegions";
+ this.lstRegions.ShowGroups = false;
+ this.lstRegions.Size = new System.Drawing.Size(182, 151);
+ this.lstRegions.Sorting = System.Windows.Forms.SortOrder.Ascending;
+ this.lstRegions.TabIndex = 2;
+ this.lstRegions.UseCompatibleStateImageBehavior = false;
+ this.lstRegions.View = System.Windows.Forms.View.List;
+ this.lstRegions.SelectedIndexChanged += new System.EventHandler(this.lstRegions_SelectedIndexChanged);
+ this.lstRegions.Enter += new System.EventHandler(this.lstRegions_Enter);
+ //
// MapConsole
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
public System.Windows.Forms.Button btnMyPos;
public System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.TrackBar zoomTracker;
+ private System.Windows.Forms.ComboBox ddOnlineFriends;
}
}
\ No newline at end of file
client.Grid.GridRegion += new EventHandler<GridRegionEventArgs>(Grid_GridRegion);
client.Self.TeleportProgress += new EventHandler<TeleportEventArgs>(Self_TeleportProgress);
client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
+ client.Friends.FriendFoundReply += new EventHandler<FriendFoundReplyEventArgs>(Friends_FriendFoundReply);
}
private void UnregisterClientEvents(GridClient client)
client.Grid.GridRegion -= new EventHandler<GridRegionEventArgs>(Grid_GridRegion);
client.Self.TeleportProgress -= new EventHandler<TeleportEventArgs>(Self_TeleportProgress);
client.Network.SimChanged -= new EventHandler<SimChangedEventArgs>(Network_SimChanged);
+ client.Friends.FriendFoundReply -= new EventHandler<FriendFoundReplyEventArgs>(Friends_FriendFoundReply);
}
void instance_ClientChanged(object sender, ClientChangedEventArgs e)
return;
}
- if (e.Region.Name.ToLower().Contains(txtRegion.Text.ToLower())
+ if (e.Region.RegionHandle == friendRegionHandle)
+ {
+ txtRegion.Text = e.Region.Name;
+ friendRegionHandle = 0;
+ }
+
+ if (!string.IsNullOrEmpty(txtRegion.Text)
+ && e.Region.Name.ToLower().Contains(txtRegion.Text.ToLower())
&& !lstRegions.Items.ContainsKey(e.Region.Name))
{
ListViewItem item = new ListViewItem(e.Region.Name);
);
return;
}
- mmap.CenterMap(regionHandles[regionName], (uint)simX, (uint)simY);
+ mmap.CenterMap(regionHandles[regionName], (uint)simX, (uint)simY, false);
return;
}
private void MapConsole_VisibleChanged(object sender, EventArgs e)
{
+ if (Visible)
+ {
+ ddOnlineFriends.Items.Clear();
+ ddOnlineFriends.Items.Add("Online Friends");
+ ddOnlineFriends.SelectedIndex = 0;
+
+ var friends = client.Friends.FriendList.FindAll((FriendInfo f) => { return f.CanSeeThemOnMap && f.IsOnline; });
+ if (friends != null)
+ {
+ foreach (var f in friends)
+ {
+ if (f.Name != null)
+ {
+ ddOnlineFriends.Items.Add(f.Name);
+ }
+ }
+ }
+ }
+
if (!mapCreated && Visible)
{
createMap();
}
#endregion GUIEvents
+
+ #region Map friends
+ FriendInfo mapFriend = null;
+ ulong friendRegionHandle = 0;
+
+ void Friends_FriendFoundReply(object sender, FriendFoundReplyEventArgs e)
+ {
+ if (mapFriend == null || mapFriend.UUID != e.AgentID) return;
+
+ if (InvokeRequired)
+ {
+ if (IsHandleCreated)
+ {
+ BeginInvoke(new MethodInvoker(() => Friends_FriendFoundReply(sender, e)));
+ }
+ return;
+ }
+
+ txtRegion.Text = string.Empty;
+ nudX.Value = (int)e.Location.X;
+ nudY.Value = (int)e.Location.Y;
+ nudZ.Value = (int)e.Location.Z;
+ friendRegionHandle = e.RegionHandle;
+ uint x, y;
+ Utils.LongToUInts(e.RegionHandle, out x, out y);
+ x /= 256;
+ y /= 256;
+ ulong hndle = Utils.UIntsToLong(x, y);
+ foreach (KeyValuePair<string, ulong> kvp in regionHandles)
+ {
+ if (kvp.Value == hndle)
+ {
+ txtRegion.Text = kvp.Key;
+ }
+ }
+ mmap.CenterMap(x, y, (uint)e.Location.X, (uint)e.Location.Y, true);
+ }
+
+ private void ddOnlineFriends_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (ddOnlineFriends.SelectedIndex < 1) return;
+ mapFriend = client.Friends.FriendList.Find((FriendInfo f) => { return f.Name == ddOnlineFriends.SelectedItem.ToString(); });
+ if (mapFriend != null)
+ {
+ friendRegionHandle = 0;
+ client.Friends.MapFriend(mapFriend.UUID);
+ }
+ }
+ #endregion Map friends
}
}