Exemplo n.º 1
0
        public TextInput(SpriteFont fntText, Texture2D sprCursor, Vector2 TextInputPosition, Vector2 TextInputSize, OnConfirmDelegate OnConfirm = null, bool DigitsOnly = false)
        {
            this.fntText           = fntText;
            this.sprCursor         = sprCursor;
            this.TextInputPosition = TextInputPosition;
            this.TextInputSize     = TextInputSize;
            this.DigitsOnly        = DigitsOnly;

            if (OnConfirm == null)
            {
                this.OnConfirm = EreaseText;
            }
            else
            {
                this.OnConfirm = OnConfirm;
            }

            Text            = string.Empty;
            TextVisible     = string.Empty;
            LastPressedKeys = new Keys[0];
            BlinkingTimer   = 0d;
            IsCursorVisible = true;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Display a prompt utility window.
 /// </summary>
 /// <param name="_Title">The window title.</param>
 /// <param name="_Message">The message to display to the user.</param>
 /// <param name="_Position">The position of the prompt window.</param>
 /// <param name="_Size">The size of the prompt window.</param>
 /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
 /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
 /// window.</param>
 public static void DisplayPrompt(string _Title, string _Message, Vector2 _Position, Vector2 _Size, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
 {
     DisplayPrompt(_Title, _Message, new Rect(_Position, _Size), _OnConfirmCallback, _OnCancelCallback);
 }
 public BoxNumericUpDown(SpriteFont fntText, Texture2D sprPixel, Texture2D sprCursor, Vector2 TextInputPosition, Vector2 TextInputSize, OnConfirmDelegate OnConfirm = null)
     : base(fntText, sprPixel, sprCursor, TextInputPosition, TextInputSize, OnConfirm, true)
 {
     SetText("0");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Display a prompt utility window.
 /// </summary>
 /// <param name="_Title">The window title.</param>
 /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
 /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
 /// window.</param>
 public static void DisplayPrompt(string _Title, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
 {
     DisplayPrompt(_Title, string.Empty, _OnConfirmCallback, _OnCancelCallback);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Display a prompt utility window.
        /// </summary>
        /// <param name="_Title">The window title.</param>
        /// <param name="_Message">The message to display to the user.</param>
        /// <param name="_Position">The position and size of the prompt window.</param>
        /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
        /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
        /// window.</param>
        public static void DisplayPrompt(string _Title, string _Message, Rect _Position, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
        {
            // Close the eventually existing window
            if (s_OpenedWindow != null)
            {
                s_OpenedWindow.Cancel();
            }

            s_OpenedWindow = GetWindow <Prompt>(true, _Title, true);

            // Set size and position if needed.
            Rect rect = s_OpenedWindow.position;

            if (_Position.position != Vector2.zero)
            {
                rect.position = _Position.position;
            }
            if (_Position.size != Vector2.zero)
            {
                rect.size = _Position.size;
            }
            s_OpenedWindow.position = rect;

            // Initialize prompt window
            s_OpenedWindow.m_Message           = _Message;
            s_OpenedWindow.m_OnConfirmCallback = _OnConfirmCallback;
            s_OpenedWindow.m_OnCancelCallback  = _OnCancelCallback;

            s_OpenedWindow.Show();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Display a prompt utility window.
 /// </summary>
 /// <param name="_Title">The window title.</param>
 /// <param name="_Message">The message to display to the user.</param>
 /// <param name="_OwnerWindow">The window from which the prompt utility is displayed. The prompt will be placed at the same coordinates
 /// of its owning popup.</param>
 /// <param name="_Offset">Adds this offset to the owner window's position.</param>
 /// <param name="_Size">The size of the prompt window.</param>
 /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
 /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
 /// window.</param>
 public static void DisplayPrompt(string _Title, string _Message, EditorWindow _OwnerWindow, Vector2 _Offset, Vector2 _Size, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
 {
     DisplayPrompt(_Title, _Message, new Rect(_OwnerWindow.position.position + _Offset, _Size), _OnConfirmCallback, _OnCancelCallback);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Display a prompt utility window.
 /// </summary>
 /// <param name="_Title">The window title.</param>
 /// <param name="_OwnerWindow">The window from which the prompt utility is displayed. The prompt will be placed at the same coordinates
 /// of its owning popup.</param>
 /// <param name="_Offset">Adds this offset to the owner window's position.</param>
 /// <param name="_Size">The size of the prompt window.</param>
 /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
 /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
 /// window.</param>
 public static void DisplayPrompt(string _Title, EditorWindow _OwnerWindow, Vector2 _Offset, Vector2 _Size, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
 {
     DisplayPrompt(_Title, string.Empty, _OwnerWindow, _Offset, _Size, _OnConfirmCallback, _OnCancelCallback);
 }
Exemplo n.º 8
0
 /// <summary>
 /// Display a prompt utility window.
 /// </summary>
 /// <param name="_Title">The window title.</param>
 /// <param name="_Message">The message to display to the user.</param>
 /// <param name="_OwnerWindow">The window from which the prompt utility is displayed. The prompt will be placed at the same coordinates
 /// of its owning popup.</param>
 /// <param name="_OnConfirmCallback">This method will be called once the user clicks on the "Ok" button.</param>
 /// <param name="_OnCancelCallback">This method will be called once the user clicks on the "Cancel" button or clicks out of the prompt
 /// window.</param>
 public static void DisplayPrompt(string _Title, string _Message, EditorWindow _OwnerWindow, OnConfirmDelegate _OnConfirmCallback, OnCancelDelegate _OnCancelCallback = null)
 {
     DisplayPrompt(_Title, _Message, _OwnerWindow, Vector2.zero, Vector2.zero, _OnConfirmCallback, _OnCancelCallback);
 }