對話方塊 — MRTK2
對話方塊控制項是提供內容相關應用程式資訊的 UI 重迭。 而且它們通常會需要使用者執行某種動作。 使用對話方塊來通知使用者重要的資訊,或是在完成動作之前要求確認或其他資訊。
您可以在 DialogExample 場景中找到範例: MRTK/Examples/Demo/UX/Dialog
MRTK 提供三個對話方塊預製專案:
- DialogSmall_192x96.prefab
- DialogMedium_192x128.prefab
- DialogLarge_192x192.prefab
使用 Dialog.Open () 開啟新的對話方塊。 指定對話方塊預製專案、按鈕數目、標題文字、郵件內文、放置距離 (近或遠) 、其他變數) 。 對話方塊提供 [確認 (單一按鈕) ] 和 [選擇 (雙按鈕) ] 對話方塊選項。
public static Dialog Open(GameObject dialogPrefab, DialogButtonType buttons, string title, string message, bool placeForNearInteraction, System.Object variable = null)
Dialog.Open(DialogPrefabLarge, DialogButtonType.OK, "Confirmation Dialog, Large, Far", "This is an example of a large dialog with only one button, placed at far interaction range", false);
Dialog.Open(DialogPrefabSmall, DialogButtonType.Yes | DialogButtonType.No, "Confirmation Dialog, Small, Near", "This is an example of a small dialog with a choice message, placed at near interaction range", true);
如需詳細資訊,請參閱 DialogExampleController.cs
DialogExample.unity 場景。