参考:http://www.cnblogs.com/2Yous/p/5079965.html
//准备工作
下载 System.Windows.Forms.dll
将下载好的dll 放入到 Assets/Plugins下
设置Edit->player setting ->player 找到Api Compatibility Level 设置为.NET 2.0
创建MessageBoxEx.cs 脚本
namespace System.Windows.Forms
{
public class MessageBoxEx
{
public static DialogResult Show(string text)
{
return MessageBox(text);
}
public static DialogResult Show(IWin32Window owner, string text)
{
return MessageBox( owner, text);
}
public static DialogResult Show(string text, string caption)
{
return MessageBox( text, caption);
}
public static DialogResult Show(IWin32Window owner, string text, string caption)
{
return MessageBox( owner, text, caption);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
{
return MessageBox( text, caption, buttons);
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons)
{
return MessageBox( owner, text, caption, buttons);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
return MessageBox( text, string caption, buttons, icon);
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
{
return MessageBox( owner, text, caption, buttons, icon);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
return MessageBox( text, caption, buttons, icon, defaultButton);
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
{
return MessageBox( owner, text, caption, buttons, icon, defaultButton);
}
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
{
return MessageBox( text, caption, buttons, icon, defaultButton, options);
}
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
{
return MessageBox( owner, text, caption, buttons, icon, defaultButton, options);
}
}
}
//使用
首先引入必要的文件
using MessageBase = System.Windows.Forms.MessageBoxEx;
using winFrom = System.Windows.Forms;
调用
MessageBase.Show("我咋没看见这个信息呢","标题",winFrom.MessageBoxButtons.OK,winFrom.MessageBoxIcon.Warning);