示例#1
0
        /// <summary>
        /// Display a simple Dialog with a title, message, and
        /// two buttons - ok and cancel.
        /// </summary>
        private void DisplaySimple()
        {
            bool option = EditorUtility.DisplayDialog(Title, Message, Ok.Label, Cancel.Label);

            if (option)
            {
                Ok.DelegateAction();
            }
            else
            {
                Cancel.DelegateAction();
            }
        }
示例#2
0
        /// <summary>
        /// Display a ComplexDialog with title, message,
        /// and 3 buttons - ok, cancel, and alt.
        /// </summary>
        private void DisplayComplex()
        {
            int option = EditorUtility.DisplayDialogComplex(Title, Message, Ok.Label,
                                                            Cancel.Label, Alt.Label);

            switch (option)
            {
            // Ok option (perform action in the affirmative)
            case 0:
                Ok.DelegateAction();
                break;

            // Cancel option (whatever the negative is)
            case 1:
                Cancel.DelegateAction();
                break;

            // Alt option (whatever the third option you intended is)
            case 2:
                Alt.DelegateAction();
                break;
            }
        }