v1.0.0.13: User-placed map notes with Title/Description; custom icon; notes on minimap

Made-with: Cursor
This commit is contained in:
2026-03-01 00:12:37 -05:00
parent b1c833ebcf
commit 542da3a71b
12 changed files with 383 additions and 17 deletions
+50
View File
@@ -22,6 +22,13 @@ namespace Mappy.Windows;
public class MapWindow : Window
{
public static (uint Territory, uint Map, float X, float Y)? PendingMapNotePosition;
private static string _pendingNoteTitle = string.Empty;
private static string _pendingNoteDescription = string.Empty;
private static bool _requestOpenAddNotePopup;
public static void RequestOpenAddNotePopup() => _requestOpenAddNotePopup = true;
public Vector2 MapDrawOffset { get; private set; }
public HoverFlags HoveredFlags { get; private set; }
public bool ProcessingCommand { get; set; }
@@ -243,6 +250,49 @@ public class MapWindow : Window
// Draw Context Menu
mapContextMenu.Draw(MapDrawOffset);
DrawAddMapNotePopup();
}
private static void DrawAddMapNotePopup()
{
if (_requestOpenAddNotePopup) {
ImGui.OpenPopup("AddMapNote");
_requestOpenAddNotePopup = false;
}
if (!ImGui.BeginPopup("AddMapNote")) return;
ImGui.Text("Note Title:");
ImGui.SetNextItemWidth(250f * ImGuiHelpers.GlobalScale);
ImGui.InputText("##notetitle", ref _pendingNoteTitle, 256);
ImGui.Text("Note Description:");
ImGui.SetNextItemWidth(250f * ImGuiHelpers.GlobalScale);
ImGui.InputText("##notedesc", ref _pendingNoteDescription, 512);
if (ImGui.Button("Cancel")) {
PendingMapNotePosition = null;
_pendingNoteTitle = string.Empty;
_pendingNoteDescription = string.Empty;
ImGui.CloseCurrentPopup();
}
ImGui.SameLine();
if (ImGui.Button("Add")) {
if (PendingMapNotePosition is { } pos && !string.IsNullOrWhiteSpace(_pendingNoteTitle)) {
System.MapNoteConfig.Notes.Add(new MapNote(pos.Territory, pos.Map, pos.X, pos.Y, _pendingNoteTitle.Trim(), _pendingNoteDescription?.Trim() ?? ""));
if (System.MapNoteConfig.Notes.Count > System.MapNoteConfig.MaxNotes) {
System.MapNoteConfig.Notes.RemoveAt(0);
}
System.MapNoteConfig.Save();
}
PendingMapNotePosition = null;
_pendingNoteTitle = string.Empty;
_pendingNoteDescription = string.Empty;
ImGui.CloseCurrentPopup();
}
ImGui.EndPopup();
}
private unsafe void UpdateStyle()