@@ -61,9 +61,15 @@ public enum Option {
61
61
/// <param name="option0">Text for the first option.</param>
62
62
/// <param name="option1">Text for the second option or null to disable.</param>
63
63
/// <param name="option2">Text for the third option or null to disable.</param>
64
- /// <returns>The selected option.</returns>
65
- public delegate Option DisplayDelegate ( string title , string message , Option defaultOption ,
66
- string option0 , string option1 , string option2 ) ;
64
+ /// <param name="complete">Called with the selected option when
65
+ /// ExecutionEnvironment.InteractiveMode, otherwise receives the defaultOption.</param>
66
+ /// <param name="renderContent">Specify to optionally render content in the dialog.</param>
67
+ /// <param name="renderButtons">Specify to optionally render buttons in the dialog.</param>
68
+ public delegate void DisplayDelegate ( string title , string message , Option defaultOption ,
69
+ string option0 , string option1 , string option2 ,
70
+ Action < Option > complete ,
71
+ Action < UnityEditor . EditorWindow > renderContent ,
72
+ Action < UnityEditor . EditorWindow > renderButtons ) ;
67
73
68
74
/// <summary>
69
75
/// Delegate that displays a dialog requesting consent to report analytics.
@@ -80,25 +86,32 @@ public delegate Option DisplayDelegate(string title, string message, Option defa
80
86
/// <param name="option1">Text for the second option.</param>
81
87
/// <param name="option2">Text for the third option.</param>
82
88
/// <param name="defaultOption">Option selected if interactivity is disabled.</param>
83
- /// <returns>When ExecutionEnvironment.InteractiveMode, the selected option, the
84
- /// defaultOption otherwise.</returns>
85
- internal static Option DisplayDefault ( string title , string message , Option defaultOption ,
86
- string option0 , string option1 , string option2 ) {
89
+ /// <param name="complete">Called with the selected option when
90
+ /// ExecutionEnvironment.InteractiveMode, otherwise receives the defaultOption.</param>
91
+ /// <param name="renderContent">Specify to optionally render content in the dialog.</param>
92
+ /// <param name="renderButtons">Specify to optionally render buttons in the dialog.</param>
93
+ internal static void DisplayDefault ( string title , string message , Option defaultOption ,
94
+ string option0 , string option1 , string option2 ,
95
+ Action < Option > complete ,
96
+ Action < UnityEditor . EditorWindow > renderContent ,
97
+ Action < UnityEditor . EditorWindow > renderButtons ) {
98
+ if ( complete == null ) complete = ( unusedOption ) => { } ;
87
99
if ( ExecutionEnvironment . InteractiveMode ) {
88
100
if ( String . IsNullOrEmpty ( option1 ) ) {
89
- UnityEditor . EditorUtility . DisplayDialog ( title , message , option0 , cancel : "" ) ;
90
- return Option . Selected0 ;
101
+ if ( UnityEditor . EditorUtility . DisplayDialog ( title , message , option0 , cancel : "" ) ) {
102
+ complete ( Option . Selected0 ) ;
103
+ }
91
104
} else if ( String . IsNullOrEmpty ( option2 ) ) {
92
- return UnityEditor . EditorUtility . DisplayDialog ( title , message , option0 ,
93
- cancel : option1 ) ?
94
- Option . Selected0 : Option . Selected1 ;
105
+ complete ( UnityEditor . EditorUtility . DisplayDialog ( title , message , option0 ,
106
+ cancel : option1 ) ?
107
+ Option . Selected0 : Option . Selected1 ) ;
95
108
} else {
96
- return ( Option ) UnityEditor . EditorUtility . DisplayDialogComplex ( title , message ,
97
- option0 , option1 ,
98
- option2 ) ;
109
+ complete ( ( Option ) UnityEditor . EditorUtility . DisplayDialogComplex ( title , message ,
110
+ option0 , option1 ,
111
+ option2 ) ) ;
99
112
}
100
113
}
101
- return defaultOption ;
114
+ complete ( defaultOption ) ;
102
115
}
103
116
104
117
/// <summary>
@@ -110,11 +123,17 @@ internal static Option DisplayDefault(string title, string message, Option defau
110
123
/// <param name="option0">Text for the first option.</param>
111
124
/// <param name="option1">Text for the second option.</param>
112
125
/// <param name="option2">Text for the third option.</param>
113
- /// <returns>When ExecutionEnvironment.InteractiveMode, the selected option, the defaultOption
114
- /// otherwise.</returns>
115
- public static Option Display ( string title , string message , Option defaultOption ,
116
- string option0 , string option1 , string option2 ) {
117
- return displayDialogMethod ( title , message , defaultOption , option0 , option1 , option2 ) ;
126
+ /// <param name="complete">Called with the selected option when
127
+ /// ExecutionEnvironment.InteractiveMode, otherwise receives the defaultOption.</param>
128
+ /// <param name="renderContent">Specify to optionally render content in the dialog.</param>
129
+ /// <param name="renderButtons">Specify to optionally render buttons in the dialog.</param>
130
+ public static void Display ( string title , string message , Option defaultOption ,
131
+ string option0 , string option1 , string option2 ,
132
+ Action < Option > complete ,
133
+ Action < UnityEditor . EditorWindow > renderContent = null ,
134
+ Action < UnityEditor . EditorWindow > renderButtons = null ) {
135
+ displayDialogMethod ( title , message , defaultOption , option0 , option1 , option2 , complete ,
136
+ renderContent , renderButtons ) ;
118
137
}
119
138
120
139
/// <summary>
@@ -125,11 +144,16 @@ public static Option Display(string title, string message, Option defaultOption,
125
144
/// <param name="defaultOption">Option selected if interactivity is disabled.</param>
126
145
/// <param name="option0">Text for the first option.</param>
127
146
/// <param name="option1">Text for the second option.</param>
128
- /// <returns>When ExecutionEnvironment.InteractiveMode, the selected option, the defaultOption
129
- /// otherwise.</returns>
130
- public static Option Display ( string title , string message , Option defaultOption ,
131
- string option0 , string option1 ) {
132
- return displayDialogMethod ( title , message , defaultOption , option0 , option1 , null ) ;
147
+ /// <param name="complete">Called with the selected option when
148
+ /// ExecutionEnvironment.InteractiveMode, otherwise receives the defaultOption.</param>
149
+ /// <param name="renderContent">Specify to optionally render content in the dialog.</param>
150
+ /// <param name="renderButtons">Specify to optionally render buttons in the dialog.</param>
151
+ public static void Display ( string title , string message , Option defaultOption ,
152
+ string option0 , string option1 , Action < Option > complete ,
153
+ Action < UnityEditor . EditorWindow > renderContent = null ,
154
+ Action < UnityEditor . EditorWindow > renderButtons = null ) {
155
+ displayDialogMethod ( title , message , defaultOption , option0 , option1 , null , complete ,
156
+ renderContent , renderButtons ) ;
133
157
}
134
158
135
159
/// <summary>
@@ -140,11 +164,16 @@ public static Option Display(string title, string message, Option defaultOption,
140
164
/// <param name="defaultOption">Option selected if interactivity is disabled.</param>
141
165
/// <param name="option0">Text for the first option.</param>
142
166
/// <param name="option1">Text for the second option.</param>
143
- /// <returns>When ExecutionEnvironment.InteractiveMode, the selected option, the defaultOption
144
- /// otherwise.</returns>
145
- public static Option Display ( string title , string message , Option defaultOption ,
146
- string option0 ) {
147
- return displayDialogMethod ( title , message , defaultOption , option0 , null , null ) ;
167
+ /// <param name="complete">Called with the selected option when
168
+ /// ExecutionEnvironment.InteractiveMode, otherwise receives the defaultOption.</param>
169
+ /// <param name="renderContent">Specify to optionally render content in the dialog.</param>
170
+ /// <param name="renderButtons">Specify to optionally render buttons in the dialog.</param>
171
+ public static void Display ( string title , string message , Option defaultOption ,
172
+ string option0 , Action < Option > complete = null ,
173
+ Action < UnityEditor . EditorWindow > renderContent = null ,
174
+ Action < UnityEditor . EditorWindow > renderButtons = null ) {
175
+ displayDialogMethod ( title , message , defaultOption , option0 , null , null , complete ,
176
+ renderContent , renderButtons ) ;
148
177
}
149
178
}
150
179
0 commit comments