55namespace NativeDialog
66{
77 /// <summary>
8- /// Popup Native Dialog
8+ /// Manages Native Dialog popups across different platforms.
9+ /// Provides a unified interface for showing native select and submit dialogs on iOS, Android, and Unity Editor.
910 /// </summary>
1011 public sealed class DialogManager : MonoBehaviour , IDialogReceiver
1112 {
1213
1314 #region Singleton
1415 private static DialogManager instance ;
16+
17+ /// <summary>
18+ /// Gets the singleton instance of DialogManager.
19+ /// Creates a new instance if one doesn't exist.
20+ /// </summary>
1521 public static DialogManager Instance
1622 {
1723 get
@@ -33,10 +39,11 @@ public static DialogManager Instance
3339
3440 #region Members
3541 private Dictionary < int , Action < bool > > callbacks ;
42+
3643 private IDialog dialog ;
3744 #endregion
3845
39- #region Lyfecycles
46+ #region Lifecycles
4047 private void Awake ( )
4148 {
4249 if ( instance == null )
@@ -92,39 +99,78 @@ private void OnDestroy()
9299 }
93100 #endregion
94101
102+ #region Public Methods
103+
104+ /// <summary>
105+ /// Sets the button labels for all future dialogs.
106+ /// </summary>
107+ /// <param name="decide">Label for the positive/confirm button</param>
108+ /// <param name="cancel">Label for the negative/cancel button</param>
109+ /// <param name="close">Label for the close button in submit dialogs</param>
95110 public static void SetLabel ( string decide , string cancel , string close )
96111 {
97112 Instance . dialog . SetLabel ( decide , cancel , close ) ;
98113 }
99114
115+ /// <summary>
116+ /// Shows a selection dialog with OK/Cancel buttons.
117+ /// </summary>
118+ /// <param name="message">The message to display</param>
119+ /// <param name="callback">Callback invoked with true for OK, false for Cancel</param>
120+ /// <returns>Dialog ID that can be used to dismiss the dialog</returns>
100121 public static int ShowSelect ( string message , Action < bool > callback )
101122 {
102123 int id = Instance . dialog . ShowSelect ( message ) ;
103124 Instance . callbacks . Add ( id , callback ) ;
104125 return id ;
105126 }
106127
128+ /// <summary>
129+ /// Shows a selection dialog with title and OK/Cancel buttons.
130+ /// </summary>
131+ /// <param name="title">The dialog title</param>
132+ /// <param name="message">The message to display</param>
133+ /// <param name="callback">Callback invoked with true for OK, false for Cancel</param>
134+ /// <returns>Dialog ID that can be used to dismiss the dialog</returns>
107135 public static int ShowSelect ( string title , string message , Action < bool > callback )
108136 {
109137 int id = Instance . dialog . ShowSelect ( title , message ) ;
110138 Instance . callbacks . Add ( id , callback ) ;
111139 return id ;
112140 }
113141
142+ /// <summary>
143+ /// Shows a submit dialog with only an OK button.
144+ /// </summary>
145+ /// <param name="message">The message to display</param>
146+ /// <param name="callback">Callback invoked when the dialog is closed</param>
147+ /// <returns>Dialog ID that can be used to dismiss the dialog</returns>
114148 public static int ShowSubmit ( string message , Action < bool > callback )
115149 {
116150 int id = Instance . dialog . ShowSubmit ( message ) ;
117151 Instance . callbacks . Add ( id , callback ) ;
118152 return id ;
119153 }
120154
121- public static int ShowSubmit ( string title , string message , Action < bool > del )
155+ /// <summary>
156+ /// Shows a submit dialog with title and only an OK button.
157+ /// </summary>
158+ /// <param name="title">The dialog title</param>
159+ /// <param name="message">The message to display</param>
160+ /// <param name="callback">Callback invoked when the dialog is closed</param>
161+ /// <returns>Dialog ID that can be used to dismiss the dialog</returns>
162+ public static int ShowSubmit ( string title , string message , Action < bool > callback )
122163 {
123164 int id = Instance . dialog . ShowSubmit ( title , message ) ;
124- Instance . callbacks . Add ( id , del ) ;
165+ Instance . callbacks . Add ( id , callback ) ;
125166 return id ;
126167 }
127168
169+ /// <summary>
170+ /// Programmatically dismisses a dialog.
171+ /// Invokes the callback with false (cancelled).
172+ /// </summary>
173+ /// <param name="id">The ID of the dialog to dismiss</param>
128174 public static void Dismiss ( int id )
129175 {
130176 Instance . dialog . Dismiss ( id ) ;
@@ -141,6 +187,7 @@ public static void Dismiss(int id)
141187 }
142188 }
143189
190+ #endregion // Public Methods
144191
145192 #region Invoked from Native Plugin
146193 public void OnSubmit ( string idStr )
0 commit comments