65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System.Text;
|
|
using Sandbox;
|
|
using Sandbox.Graphics.GUI;
|
|
using VRage.Utils;
|
|
using VRageMath;
|
|
|
|
namespace PluginLoader.GUI;
|
|
|
|
public static class ConfirmationDialog
|
|
{
|
|
public static MyGuiScreenMessageBox CreateMessageBox(
|
|
MyMessageBoxStyleEnum styleEnum = MyMessageBoxStyleEnum.Error,
|
|
MyMessageBoxButtonsType buttonType = MyMessageBoxButtonsType.OK,
|
|
StringBuilder messageText = null,
|
|
StringBuilder messageCaption = null,
|
|
MyStringId? okButtonText = null,
|
|
MyStringId? cancelButtonText = null,
|
|
MyStringId? yesButtonText = null,
|
|
MyStringId? noButtonText = null,
|
|
Action<MyGuiScreenMessageBox.ResultEnum> callback = null,
|
|
int timeoutInMiliseconds = 0,
|
|
MyGuiScreenMessageBox.ResultEnum focusedResult = MyGuiScreenMessageBox.ResultEnum.YES,
|
|
bool canHideOthers = true,
|
|
Vector2? size = null,
|
|
bool useOpacity = true,
|
|
Vector2? position = null,
|
|
bool focusable = true,
|
|
bool canBeHidden = false,
|
|
Action onClosing = null)
|
|
{
|
|
var num1 = (int)styleEnum;
|
|
var num2 = (int)buttonType;
|
|
var messageText1 = messageText;
|
|
var messageCaption1 = messageCaption;
|
|
var nullable = okButtonText;
|
|
var okButtonText1 = nullable ?? MyCommonTexts.Ok;
|
|
nullable = cancelButtonText;
|
|
var cancelButtonText1 = nullable ?? MyCommonTexts.Cancel;
|
|
nullable = yesButtonText;
|
|
var yesButtonText1 = nullable ?? MyCommonTexts.Yes;
|
|
nullable = noButtonText;
|
|
var noButtonText1 = nullable ?? MyCommonTexts.No;
|
|
var callback1 = callback;
|
|
var timeoutInMiliseconds1 = timeoutInMiliseconds;
|
|
var num3 = (int)focusedResult;
|
|
var num4 = canHideOthers ? 1 : 0;
|
|
var size1 = size;
|
|
var num5 = useOpacity ? MySandboxGame.Config.UIBkOpacity : 1.0;
|
|
var num6 = useOpacity ? MySandboxGame.Config.UIOpacity : 1.0;
|
|
var position1 = position;
|
|
var num7 = focusable ? 1 : 0;
|
|
var num8 = canBeHidden ? 1 : 0;
|
|
var onClosing1 = onClosing;
|
|
var dlg = new MyGuiScreenMessageBox((MyMessageBoxStyleEnum)num1, (MyMessageBoxButtonsType)num2, messageText1,
|
|
messageCaption1, okButtonText1, cancelButtonText1, yesButtonText1,
|
|
noButtonText1, callback1, timeoutInMiliseconds1,
|
|
(MyGuiScreenMessageBox.ResultEnum)num3, num4 != 0, size1, (float)num5,
|
|
(float)num6, position1, num7 != 0, num8 != 0, onClosing1);
|
|
|
|
if (dlg.Controls.GetControlByName("MyGuiControlMultilineText") is MyGuiControlMultilineText text)
|
|
text.TextAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
|
|
|
|
return dlg;
|
|
}
|
|
} |