【发布时间】:2021-12-20 13:58:00
【问题描述】:
MessageBox 中有一部分需要在 Unity 中重新创建。
DialogResult result = MessageBox.Show(/*parameters*/);
//When code runs - appears MessageBox and next lines of code WAIT for result
//Only if button is pressed - code proceeds next lines.
if (result == DialogResult.Yes) { DoIt(); }
else { DoNotDoIt(); }
我已经看到了一些关于 Action 回调的实现。 在那个实现中 - MessageBox 具有 Action 字段,并且在 MessageBox.Show() 方法中,您应该将委托添加到适当的 Action 作为参数。 我不能在我的情况下使用它。我需要确保设置了对话框结果,然后才能继续运行代码。
【问题讨论】:
-
我应该为此使用多线程吗?
-
我对多线程说不,尤其是因为你需要它停止。然而。我会问。为什么不能使用回调?个人 id 在协程中执行此操作,您可以等到说 messagebox.result!=null
标签: c# multithreading unity3d messagebox