From 57b358d7e8cc26e8d5478327b2fa4881ab962aaf Mon Sep 17 00:00:00 2001 From: Kurt Date: Wed, 13 Apr 2022 19:30:58 -0700 Subject: [PATCH] Show coordinates on hover --- .../Arceus/Util/EncounterTable8aUtil.cs | 6 +++--- pkNX.WinForms/Subforms/MapViewer8a.Designer.cs | 14 ++++++++++++++ pkNX.WinForms/Subforms/MapViewer8a.cs | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pkNX.Structures.FlatBuffers/Arceus/Util/EncounterTable8aUtil.cs b/pkNX.Structures.FlatBuffers/Arceus/Util/EncounterTable8aUtil.cs index 10724cc5..8c52a1dc 100644 --- a/pkNX.Structures.FlatBuffers/Arceus/Util/EncounterTable8aUtil.cs +++ b/pkNX.Structures.FlatBuffers/Arceus/Util/EncounterTable8aUtil.cs @@ -220,14 +220,14 @@ public static IEnumerable GetUnownLinesBias(AreaInstance8a area, IReadOn var contained = s.GetContainingLocations(area.Locations).First().PlaceName; var name = valueTuples[contained].Name; var p = s.Parameters; - yield return $"Spawner @ {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) @ {p.Coordinates.ToTriple()}, {area.AreaName} = {name}"; + yield return $"Spawner @ {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) @ {p.Coordinates.ToTriple()} ({s.MinSpawnCount}-{s.MaxSpawnCount}), {area.AreaName} = {name}"; } foreach (var s in usedByNHO) { var contained = s.GetContainingLocations(area.Locations).First().PlaceName; var name = valueTuples[contained].Name; var p = s.Parameters; - yield return $"SpawnerNHO @ {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) @ {p.Coordinates.ToTriple()}, {area.AreaName} = {name}"; + yield return $"SpawnerNHO @ {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) @ {p.Coordinates.ToTriple()} ({s.MinSpawnCount}-{s.MaxSpawnCount}), {area.AreaName} = {name}"; } foreach (var s in usedByWormholes) { @@ -235,7 +235,7 @@ public static IEnumerable GetUnownLinesBias(AreaInstance8a area, IReadOn var name = valueTuples[contained].Name; var p = s.Parameters; var c = s.Field_20_Value; - yield return $"Wormhole: {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) [{c.BonusLevelMin}-{c.BonusLevelMax}] @ {p.Coordinates.ToTriple()}, {area.AreaName} = {name}"; + yield return $"Wormhole: {s.NameSummary}_{s.Field_01:X16} ({p.GetConditionSummary()}) [{c.BonusLevelMin}-{c.BonusLevelMax}] @ {p.Coordinates.ToTriple()} ({s.MinSpawnCount}-{s.MaxSpawnCount}), {area.AreaName} = {name}"; } foreach (var s in usedByLandmarks) { diff --git a/pkNX.WinForms/Subforms/MapViewer8a.Designer.cs b/pkNX.WinForms/Subforms/MapViewer8a.Designer.cs index 92ab5e9c..86a53094 100644 --- a/pkNX.WinForms/Subforms/MapViewer8a.Designer.cs +++ b/pkNX.WinForms/Subforms/MapViewer8a.Designer.cs @@ -31,6 +31,7 @@ private void InitializeComponent() this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.CB_Map = new System.Windows.Forms.ComboBox(); this.CB_Species = new System.Windows.Forms.ComboBox(); + this.L_CoordinateMouse = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -64,18 +65,30 @@ private void InitializeComponent() this.CB_Species.TabIndex = 2; this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.CB_Species_SelectedIndexChanged); // + // L_CoordinateMouse + // + this.L_CoordinateMouse.AutoSize = true; + this.L_CoordinateMouse.Location = new System.Drawing.Point(527, 510); + this.L_CoordinateMouse.Name = "L_CoordinateMouse"; + this.L_CoordinateMouse.Size = new System.Drawing.Size(153, 13); + this.L_CoordinateMouse.TabIndex = 3; + this.L_CoordinateMouse.Text = "Hover over img for Coordinates"; + // // MapViewer8a // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(709, 532); + this.Controls.Add(this.L_CoordinateMouse); this.Controls.Add(this.CB_Species); this.Controls.Add(this.CB_Map); this.Controls.Add(this.pictureBox1); this.Name = "MapViewer8a"; this.Text = "MapViewer8a"; + this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MapViewer8a_MouseMove); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -84,5 +97,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ComboBox CB_Map; private System.Windows.Forms.ComboBox CB_Species; + private System.Windows.Forms.Label L_CoordinateMouse; } } \ No newline at end of file diff --git a/pkNX.WinForms/Subforms/MapViewer8a.cs b/pkNX.WinForms/Subforms/MapViewer8a.cs index b86ff52c..b1745e4c 100644 --- a/pkNX.WinForms/Subforms/MapViewer8a.cs +++ b/pkNX.WinForms/Subforms/MapViewer8a.cs @@ -193,6 +193,12 @@ private static List GetSpawnerInfo(int species, AreaInstance8a area) } private static readonly EncounterSlot8a[] Unown = { new() { Species = 201 } }; + + private void MapViewer8a_MouseMove(object sender, MouseEventArgs e) + { + var (x, y) = (e.X, e.Y); + L_CoordinateMouse.Text = $"{x * 2}, {y * 2}"; + } } public class AreaDef