EditorUtility.DisplayDialogComplex 显示复杂对话框

static function DisplayDialogComplex (title : string, message : string, ok : string, cancel : string, alt : string) : int

Description描述

Displays a modal dialog with three buttons.

显示一个模态对话框带有三个按钮。

Use it for displaying message boxes in the editor.

用于在编辑器显示消息框。

Similar to DisplayDialog, only this version shows a dialog with three buttons. ok, cancel and alt are labels to be displayed on the buttons. DisplayDialogComplex returns an integer 0, 1 or 2 corresponding to ok, cancel and alt buttons.

类似DisplayDialog,这个只是三个按钮版本。ok, cancel 和 alt 是按钮显示的标签。DisplayDialogComplex返回一个整数0,1或2对应于ok, cancel 和 alt按钮。

参见:DisplayDialog function.

EditorUtility.DisplayDialogComplex 显示复杂对话框

Display dialog complex for the example below.
下面的例子显示复杂对话框。

// Lets you save, save and quit or quit without saving

//让你保存,保存并退出或退出不保存

class EditorUtilityDisplayDialogComplex extends MonoBehaviour {



	@MenuItem("Examples/Enhanced Save")

	static function Init() {

		var option = EditorUtility.DisplayDialogComplex(

			"What do you want to do?",

			"Please choose one of the following options.",

			"Save Scene",

			"Save and Quit",

			"Quit without saving");

		switch (option) {

			// Save Scene //保存场景

			case 0:

			EditorApplication.SaveScene(EditorApplication.currentScene);

			break;

			// Save and Quit. //保存并退出

			case 1:

			EditorApplication.SaveScene(EditorApplication.currentScene);

			EditorApplication.Exit(0);

			break;

			// Quit Without saving. // 退出不保存

			case 2:

			EditorApplication.Exit(0);

			break;

			default:

			Debug.LogError("Unrecognized option.");



		}

	}

}
Page last updated: 2011-7-15