///
/// MIT License - Copyright(c) 2019 Ugo Belfiore
///
using UnityEditor;
namespace MoveMouseEditor
{
///
/// Display a Dialog Box. Return true if the user press YES
/// return false if the user press CANCEL, or press exit
///
/// if replaceMousePositionAtTheEnd is true, move the mouse position
/// to it's original emplacement before the dialog show up.
///
public static class ExtGUI
{
public static bool DrawDisplayDialog(
string mainTitle = "main title",
string content = "what's the dialog box say",
string accept = "Yes",
string no = "Get me out of here",
bool replaceMousePositionAtTheEnd = true)
{
if (replaceMousePositionAtTheEnd)
{
Win32Mouse.SavePosition();
}
if (!EditorUtility.DisplayDialog(mainTitle, content, accept, no))
{
if (replaceMousePositionAtTheEnd)
{
Win32Mouse.SetCursorPosition(Win32Mouse.GetLastSavedPosition());
}
return (false);
}
if (replaceMousePositionAtTheEnd)
{
Win32Mouse.SetCursorPosition(Win32Mouse.GetLastSavedPosition());
}
return (true);
}
}
}