Skip to content

Conversation

@Clayell
Copy link

@Clayell Clayell commented Mar 8, 2025

DeleteGUI gives a button to "Delete custom waypoint '[waypoint]'?", but DeleteGUI is triggered by deleting any waypoint, not just custom ones.

"Hide Stock Waypoint" calls DeleteWaypoint

if (GUILayout.Button(new GUIContent(Config.deleteWaypointIcon, "Hide Stock Waypoint"), GUI.skin.label))
{
CustomWaypointGUI.DeleteWaypoint(wpd.waypoint);
}

DeleteWaypoint sets windowMode to WindowMode.Delete

public static void DeleteWaypoint(Waypoint waypoint)
{
windowMode = WindowMode.Delete;
selectedWaypoint = waypoint;
// Default values
rmWindowPos = new Rect((Screen.width - rmWindowPos.width) / 2.0f, (Screen.height - rmWindowPos.height) / 2.0f, rmWindowPos.width, rmWindowPos.height);
}

when windowMode = WindowMode.Delete, DeleteGUI is called

else if (windowMode == WindowMode.Delete)
{
rmWindowPos = ClickThruBlocker.GUILayoutWindow(
typeof(WaypointManager).FullName.GetHashCode() + 2,
rmWindowPos,
DeleteGUI,
windowMode.ToString() + " Waypoint");
// Add the close icon
if (GUI.Button(new Rect(rmWindowPos.xMax - 18, rmWindowPos.yMin + 2, 16, 16), Config.closeIcon, GUI.skin.label))
{
windowMode = WindowMode.None;
}
}

private static void DeleteGUI(int windowID)
{
GUILayout.BeginVertical();
GUILayout.Label("Delete custom waypoint '" + selectedWaypoint.name + "'?");
GUILayout.BeginHorizontal();
if (GUILayout.Button("Yes"))
{
CustomWaypoints.RemoveWaypoint(selectedWaypoint);
windowMode = WindowMode.None;
}
if (GUILayout.Button("No"))
{
windowMode = WindowMode.None;
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUI.DragWindow();
}

Noticed this while checking out #11, although it is entirely unrelated to it.

@linuxgurugamer
Copy link
Owner

So this is just editing a single GUILayout.label l ine?

@linuxgurugamer linuxgurugamer merged commit 4f1ed82 into linuxgurugamer:master Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants