示例#1
0
        private int textPadding             = 30;   //odległość tekstu w textboxie od krawędzi tekstboxu, używam obliczając wysokość tekstboxa gdy występują długie linie


        public MyMessageBox(string message, MyMessageBoxType mbType)
        {
            InitializeComponent();
            this.message = message;
            this.mbType  = mbType;
            setFormLayout();
        }
示例#2
0
        public static MyMessageBoxResults display(string message, MyMessageBoxType mbType = MyMessageBoxType.Information)
        {
            MyMessageBox mmb = new MyMessageBox(message, mbType);

            mmb.textBox1.Text = mmb.message;
            mmb.ShowDialog();
            mmb.BringToFront();
            return(mmb.mbResult);
        }
示例#3
0
 public static void Show(
     MyTextsWrapperEnum text,
     MyTextsWrapperEnum caption = MyTextsWrapperEnum.Blank,
     MyMessageBoxType type      = MyMessageBoxType.MESSAGE)
 {
     MyGuiManager.AddScreen(
         new MyGuiScreenMessageBox(
             type,
             text,
             caption,
             MyTextsWrapperEnum.Ok,
             null));
 }
示例#4
0
        public static void displayAndClose(string message, int timeInSeconds = 2)
        {
            MyMessageBoxType mbType = MyMessageBoxType.Information;
            MyMessageBox     mmb    = new MyMessageBox(message, mbType);

            System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer();
            tmr.Tick += delegate {
                mmb.Close();
            };
            tmr.Interval = (int)TimeSpan.FromSeconds(timeInSeconds).TotalMilliseconds;
            tmr.Start();

            mmb.textBox1.Text = mmb.message;
            mmb.ShowDialog();
            mmb.BringToFront();
        }
 public static MessageBoxResult Show(string caption, string msg, MyMessageBoxType type)
 {
     switch (type)
     {
         case MyMessageBoxType.ConfirmationWithYesNo:
             return Show(caption, msg, MessageBoxButton.YesNo, MessageBoxImage.Question);
         case MyMessageBoxType.ConfirmationWithYesNoCancel:
             return Show(caption, msg, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
         case MyMessageBoxType.Information:
             return Show(caption, msg, MessageBoxButton.OK, MessageBoxImage.Information);
         case MyMessageBoxType.Error:
             return Show(caption, msg, MessageBoxButton.OK, MessageBoxImage.Error);
         case MyMessageBoxType.Warning:
             return Show(caption, msg, MessageBoxButton.OK, MessageBoxImage.Warning);
         default:
             return MessageBoxResult.No;
     }
 }
 private MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, bool enableCheckBox)
     : this(type, buttonType, messageText, messageCaption, okButtonText, yesButtonText, noButtonText, callback, enableCheckBox, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE)
 {
 }
 //  Constructor for YES/NO message boxes and TIMEOUT
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, int timeoutInMiliseconds) :
     this(type, MyMessageBoxButtonsType.YES_NO_TIMEOUT, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false)
 {
     m_timeoutStartedTimeInMiliseconds = MyMinerGame.TotalTimeInMilliseconds;
     m_timeoutInMiliseconds = timeoutInMiliseconds;
 }
 //  Constructor for YES/NO message boxes and checkBox
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum checkBoxMessage, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, out MyGuiControlCheckbox showAgainCheckBox) :
     this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, true)
 {
     showAgainCheckBox = m_showAgainCheckBox;
 }
 //  Constructor for YES/NO message boxes - and text and caption defined by StringBuilder instead of enum
 public MyGuiScreenMessageBox(MyMessageBoxType type, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.YES_NO, messageText, messageCaption, null, yesButtonText, noButtonText, callback, false)
 {
 }
 //  Constructor for YES/NO message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false)
 {
 }
示例#11
0
 //  Constructor for OK message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?okButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.OK, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), okButtonText, null, null, callback, false)
 {
 }
示例#12
0
        public MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, bool enableCheckBox, Vector2 buttonSize)
            : base(new Vector2(0.5f, 0.5f), null, null, true, null)
        {
            InstantClose = true;

            MyMessageBoxConfiguration config = m_typesConfiguration[(int)type];

            m_backgroundColor        = config.BackgroundColor;
            m_backgroundTexture      = config.Texture;
            m_textColor              = config.TextColor;
            m_interferenceVideoColor = config.InterferenceVideoColor;

            m_enableBackgroundFade = true;

            m_buttonType           = buttonType;
            m_okButtonText         = okButtonText;
            m_yesButtonText        = yesButtonText;
            m_noButtonText         = noButtonText;
            m_callback             = callback;
            m_drawEvenWithoutFocus = true;
            m_screenCanHide        = false;
            m_buttonSize           = buttonSize;

            //  Recalculate heigh of message box screen, so it will auto-adapt to message size and maybe make split it on more lines
            Vector2 textSize    = MyGuiManager.GetNormalizedSize(config.Font, messageText, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);
            Vector2 captionSize = MyGuiManager.GetNormalizedSize(config.Font, messageCaption, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);

            m_size = new Vector2(Math.Max(2f * m_buttonSize.X + 0.1f, textSize.X) + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X,
                                 3 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y + captionSize.Y + textSize.Y + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y) + new Vector2();

            //if (type == MyMessageBoxType.MESSAGE) m_size = m_size + new Vector2(0.1f, 0.1f);
            //m_size. =m_size.Value.Y * 1.1f;
            if (enableCheckBox)
            {
                m_size = new Vector2(m_size.Value.X, m_size.Value.Y + 0.05f);
            }

            //  Message box caption
            MyGuiControlLabel captionLabel = new MyGuiControlLabel(this, new Vector2(0, -m_size.Value.Y / 2.0f + captionSize.Y / 2.0f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                                                                   null, messageCaption, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font);

            Controls.Add(captionLabel);

            //  Message box text
            m_messageBoxText = new MyGuiControlLabel(this, new Vector2(0f, captionLabel.GetPosition().Y + textSize.Y / 2.0f + 1.0f * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageText,
                                                     m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font);
            Controls.Add(m_messageBoxText);

            float deltaY = 0;

            if (enableCheckBox)
            {
                const float CHECKBOX_DELTA_Y = 0.01f;

                // CheckBox to not show again this message box
                m_showAgainCheckBox = new MyGuiControlCheckbox(this, new Vector2(-0.02f,
                                                                                 m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                                                               true, config.ButtonColor);
                Controls.Add(m_showAgainCheckBox);
                Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f +
                                                                     2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y) + 0 * MyGuiConstants.CONTROLS_DELTA, null,
                                                   MyTextsWrapper.Get(MyTextsWrapperEnum.DecreaseVideoSettingsCheckBox), m_textColor,
                                                   MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, config.Font));
            }

            //  Buttons
            Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - m_buttonSize.Y / 2.0f);

            if (m_buttonType == MyMessageBoxButtonsType.OK)
            {
                //Controls.Add(new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //null,null,null,
                //m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                //true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                var okButton = new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                                                      config.ButtonColor,
                                                      config.ButtonTexture, null, null, m_okButtonText.Value,
                                                      m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                                                      true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);
            }
            else if ((m_buttonType == MyMessageBoxButtonsType.YES_NO) || (m_buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT))
            {
                var okButton = new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                                                      config.ButtonColor,
                                                      config.ButtonTexture, null, null, m_yesButtonText.Value,
                                                      m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                                                      true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);

                var noButton = new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                                                      config.ButtonColor,
                                                      config.ButtonTexture, null, null, m_noButtonText.Value,
                                                      m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick,
                                                      true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(noButton);


                //Controls.Add(new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));
            }
            else if (m_buttonType == MyMessageBoxButtonsType.NONE)
            {
            }
            else
            {
                throw new MyMwcExceptionApplicationShouldNotGetHere();
            }
        }
示例#13
0
 //  Constructor for YES/NO message boxes and TIMEOUT
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, int timeoutInMiliseconds) :
     this(type, MyMessageBoxButtonsType.YES_NO_TIMEOUT, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false)
 {
     m_timeoutStartedTimeInMiliseconds = MyMinerGame.TotalTimeInMilliseconds;
     m_timeoutInMiliseconds            = timeoutInMiliseconds;
 }
示例#14
0
 private MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, bool enableCheckBox)
     : this(type, buttonType, messageText, messageCaption, okButtonText, yesButtonText, noButtonText, callback, enableCheckBox, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE)
 {
 }
示例#15
0
 //  Constructor for YES/NO message boxes and checkBox
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum checkBoxMessage, MyTextsWrapperEnum?okButtonText, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback, out MyGuiControlCheckbox showAgainCheckBox) :
     this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, true)
 {
     showAgainCheckBox = m_showAgainCheckBox;
 }
示例#16
0
 //  Constructor for YES/NO message boxes - and text and caption defined by StringBuilder instead of enum
 public MyGuiScreenMessageBox(MyMessageBoxType type, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.YES_NO, messageText, messageCaption, null, yesButtonText, noButtonText, callback, false)
 {
 }
示例#17
0
 //  Constructor for YES/NO message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum?yesButtonText, MyTextsWrapperEnum?noButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.YES_NO, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, yesButtonText, noButtonText, callback, false)
 {
 }
        public MyGuiScreenMessageBox(MyMessageBoxType type, MyMessageBoxButtonsType buttonType, StringBuilder messageText, StringBuilder messageCaption, MyTextsWrapperEnum? okButtonText, MyTextsWrapperEnum? yesButtonText, MyTextsWrapperEnum? noButtonText, MessageBoxCallback callback, bool enableCheckBox, Vector2 buttonSize)            
            : base(new Vector2(0.5f, 0.5f), null, null, true, null)
        {
            InstantClose = true;

            MyMessageBoxConfiguration config = m_typesConfiguration[(int)type];
            m_backgroundColor = config.BackgroundColor;
            m_backgroundTexture = config.Texture;
            m_textColor = config.TextColor;
            m_interferenceVideoColor = config.InterferenceVideoColor;

            m_enableBackgroundFade = true;

            m_buttonType = buttonType;
            m_okButtonText = okButtonText;
            m_yesButtonText = yesButtonText;
            m_noButtonText = noButtonText;
            m_callback = callback;            
            m_drawEvenWithoutFocus = true;
            m_screenCanHide = false;
            m_buttonSize = buttonSize;                    

            //  Recalculate heigh of message box screen, so it will auto-adapt to message size and maybe make split it on more lines
            Vector2 textSize = MyGuiManager.GetNormalizedSize(config.Font, messageText, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);
            Vector2 captionSize = MyGuiManager.GetNormalizedSize(config.Font, messageCaption, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE);
            m_size = new Vector2(Math.Max(2f * m_buttonSize.X + 0.1f, textSize.X) + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_X, 
                                3 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y + captionSize.Y + textSize.Y + MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y)+ new Vector2();

            //if (type == MyMessageBoxType.MESSAGE) m_size = m_size + new Vector2(0.1f, 0.1f);
            //m_size. =m_size.Value.Y * 1.1f;
            if (enableCheckBox)
            {
                m_size = new Vector2(m_size.Value.X, m_size.Value.Y + 0.05f);
            }

            //  Message box caption
            MyGuiControlLabel captionLabel = new MyGuiControlLabel(this, new Vector2(0, -m_size.Value.Y / 2.0f + captionSize.Y / 2.0f + MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                null, messageCaption, m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,config.Font);
            Controls.Add(captionLabel);

            //  Message box text
            m_messageBoxText = new MyGuiControlLabel(this, new Vector2(0f, captionLabel.GetPosition().Y + textSize.Y / 2.0f + 1.0f * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y), null, messageText,
                m_textColor, MyGuiConstants.MESSAGE_BOX_TEXT_SCALE, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, config.Font);
            Controls.Add(m_messageBoxText);

            float deltaY = 0;

            if (enableCheckBox)
            {
                const float CHECKBOX_DELTA_Y = 0.01f;

                // CheckBox to not show again this message box
                m_showAgainCheckBox = new MyGuiControlCheckbox(this, new Vector2(-0.02f,
                    m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f + 2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y),
                    true, config.ButtonColor);
                Controls.Add(m_showAgainCheckBox);
                Controls.Add(new MyGuiControlLabel(this, new Vector2(0f, m_messageBoxText.GetPosition().Y + CHECKBOX_DELTA_Y + textSize.Y / 2.0f +
                    2 * MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y) + 0 * MyGuiConstants.CONTROLS_DELTA, null,
                    MyTextsWrapper.Get(MyTextsWrapperEnum.DecreaseVideoSettingsCheckBox), m_textColor,
                    MyGuiConstants.LABEL_TEXT_SCALE * 0.75f, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, config.Font));
            }

            //  Buttons
            Vector2 buttonDelta = new Vector2(0.05f, m_size.Value.Y / 2.0f - MyGuiConstants.MESSAGE_BOX_BORDER_AREA_Y - m_buttonSize.Y / 2.0f);
            if (m_buttonType == MyMessageBoxButtonsType.OK)
            {

                    //Controls.Add(new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                    //null,null,null,
                    //m_okButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                    //true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                var okButton = new MyGuiControlButton(this, new Vector2(0, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                    config.ButtonColor,
                    config.ButtonTexture, null, null, m_okButtonText.Value,
                    m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);


            }
            else if ((m_buttonType == MyMessageBoxButtonsType.YES_NO) || (m_buttonType == MyMessageBoxButtonsType.YES_NO_TIMEOUT))
            {

                var okButton = new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                        config.ButtonColor,
                        config.ButtonTexture, null, null, m_yesButtonText.Value,
                        m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick,
                        true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(okButton);

                var noButton = new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE_SMALL,
                    config.ButtonColor,
                    config.ButtonTexture, null, null, m_noButtonText.Value,
                    m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick,
                    true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true);
                Controls.Add(noButton);


                //Controls.Add(new MyGuiControlButton(this, new Vector2(-(buttonDelta.X + m_buttonSize.X / 2f), deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_yesButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnYesClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));

                //Controls.Add(new MyGuiControlButton(this, new Vector2(+buttonDelta.X + m_buttonSize.X / 2f, deltaY + buttonDelta.Y), m_buttonSize, config.ButtonColor,
                //    null,null,null,
                //    m_noButtonText.Value, m_textColor, MyGuiConstants.BUTTON_TEXT_SCALE, MyGuiControlButtonTextAlignment.CENTERED, OnNoClick, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, true, true));
            }
            else if (m_buttonType == MyMessageBoxButtonsType.NONE)
            {
            }
            else
            {
                throw new MyMwcExceptionApplicationShouldNotGetHere();
            }
        }                
 //  Constructor for no buttons message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.NONE, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, null, null, callback, false, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE)
 {
 }
 public static void Show(
     MyTextsWrapperEnum text,
     MyTextsWrapperEnum caption = MyTextsWrapperEnum.Blank,
     MyMessageBoxType type = MyMessageBoxType.MESSAGE)
 {
     MyGuiManager.AddScreen(
         new MyGuiScreenMessageBox(
             type,
             text,
             caption,
             MyTextsWrapperEnum.Ok,
             null));
 }
 //  Constructor for OK message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MyTextsWrapperEnum? okButtonText, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.OK, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), okButtonText, null, null, callback, false)
 {
 }
 public static MessageBoxResult Show(string msg, MyMessageBoxType type)
 {
     return Show(string.Empty, msg, type);
 }
示例#23
0
 //  Constructor for no buttons message boxes
 public MyGuiScreenMessageBox(MyMessageBoxType type, MyTextsWrapperEnum messageText, MyTextsWrapperEnum messageCaption, MessageBoxCallback callback) :
     this(type, MyMessageBoxButtonsType.NONE, MyTextsWrapper.Get(messageText), MyTextsWrapper.Get(messageCaption), null, null, null, callback, false, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE)
 {
 }