IEnumerator OpenMessageBox(MsgBoxContext ctx) { while (m_workingDialog != null && m_workingDialog.isOpened == true) { yield return(null); } NvMessageBox msgbox = ctx.msgbox; msgbox.title = ctx.title; msgbox.description = ctx.description; msgbox.style = ctx.style; msgbox.eventOnEndModal += HandleDlgeventOnEndModal; if (ctx.callback != null) { msgbox.eventOnEndModal += ctx.callback; } msgbox.doModal(); m_baffle.enabled = true; m_workingDialog = msgbox; }
public NvUIDialogBase showMessageBox(string msg, string title = "", NvMessageBox.EMessageBoxStyle style = NvMessageBox.EMessageBoxStyle.eStyle_OkayOnly, NvUIDialogBase.OnEndModal callback = null, bool closeIfOpened = false) { bool pendingMessagebox = false; if (m_workingDialog != null && m_workingDialog.isOpened) { if (!closeIfOpened) { return(null); } else { pendingMessagebox = true; m_workingDialog.endModal(-1); } } NvUIDialogBase msgbox = findDialog("MessageBox"); if (msgbox == null) { msgbox = createDialog("MessageBox", "UI Prefabs/Prefabs/Dialogs/MessageBox"); } if (msgbox != null) { NvMessageBox messagebox = msgbox as NvMessageBox; if (pendingMessagebox) { MsgBoxContext ctx = new MsgBoxContext(); ctx.msgbox = messagebox; ctx.title = title; ctx.description = msg; ctx.style = style; ctx.callback = callback; StartCoroutine("OpenMessageBox", ctx); } else { messagebox.eventOnEndModal += HandleDlgeventOnEndModal; if (callback != null) { messagebox.eventOnEndModal += callback; } messagebox.description = msg; messagebox.title = title; messagebox.style = style; messagebox.doModal(); m_workingDialog = messagebox; m_baffle.enabled = true; } } return(msgbox); }