Ejemplo n.º 1
0
 // Constructor for custom pane textures
 public Pane(
     Screen screen,
     Texture2D topLeftCorner,
     Texture2D topRightCorner,
     Texture2D bottomRightCorner,
     Texture2D bottomLeftCorner,
     Texture2D leftSide,
     Texture2D topSide,
     Texture2D rightSide,
     Texture2D bottomSide,
     Texture2D background,
     UIAlignment alignment,
     int x,
     int y,
     int width,
     int height)
 {
     _screen = screen;
     _spriteBatch = _screen.screenSystem.spriteBatch;
     _topLeftCorner = topLeftCorner;
     _topRightCorner = topRightCorner;
     _bottomRightCorner = bottomRightCorner;
     _bottomLeftCorner = bottomLeftCorner;
     _leftSide = leftSide;
     _topSide = topSide;
     _rightSide = rightSide;
     _bottomSide = bottomSide;
     _background = background;
     _alignment = alignment;
     _xOffset = x;
     _yOffset = y;
     _width = width;
     _height = height;
 }
Ejemplo n.º 2
0
 // Constructor for custom pane textures
 public Pane(
     Screen screen,
     Texture2D topLeftCorner,
     Texture2D topRightCorner,
     Texture2D bottomRightCorner,
     Texture2D bottomLeftCorner,
     Texture2D leftSide,
     Texture2D topSide,
     Texture2D rightSide,
     Texture2D bottomSide,
     Texture2D background,
     UIAlignment alignment,
     int x,
     int y,
     int width,
     int height)
 {
     _screen            = screen;
     _spriteBatch       = _screen.screenSystem.spriteBatch;
     _topLeftCorner     = topLeftCorner;
     _topRightCorner    = topRightCorner;
     _bottomRightCorner = bottomRightCorner;
     _bottomLeftCorner  = bottomLeftCorner;
     _leftSide          = leftSide;
     _topSide           = topSide;
     _rightSide         = rightSide;
     _bottomSide        = bottomSide;
     _background        = background;
     _alignment         = alignment;
     _xOffset           = x;
     _yOffset           = y;
     _width             = width;
     _height            = height;
 }
Ejemplo n.º 3
0
 public LabelTextureButton(
     Screen screen,
     SpriteBatch spriteBatch,
     UIAlignment alignment,
     int x,
     int y,
     Texture2D selectedTexture,
     Texture2D deselectedTexture,
     Rectangle localHitBox,
     SpriteFont font,
     TextAlignment textAlignment,
     string text,
     int textXOffset,
     int textYOffset,
     int outline,
     Color selectedColor,
     Color deselectedColor,
     Action onActivate,
     Action onMouseOver,
     Action onMouseOut)
     : base(screen, spriteBatch, alignment, x, y, selectedTexture, deselectedTexture, localHitBox, onActivate, onMouseOver, onMouseOut)
 {
     _font = font;
     _textAlignment = textAlignment;
     _text = text;
     _textXOffset = textXOffset;
     _textYOffset = textYOffset;
     _outline = outline;
     _selectedColor = selectedColor;
     _deselectedColor = deselectedColor;
 }
Ejemplo n.º 4
0
 public LabelTextureButton(
     Screen screen,
     SpriteBatch spriteBatch,
     UIAlignment alignment,
     int x,
     int y,
     Texture2D selectedTexture,
     Texture2D deselectedTexture,
     Rectangle localHitBox,
     SpriteFont font,
     TextAlignment textAlignment,
     string text,
     int textXOffset,
     int textYOffset,
     int outline,
     Color selectedColor,
     Color deselectedColor,
     Action onActivate,
     Action onMouseOver,
     Action onMouseOut)
     : base(screen, spriteBatch, alignment, x, y, selectedTexture, deselectedTexture, localHitBox, onActivate, onMouseOver, onMouseOut)
 {
     _font            = font;
     _textAlignment   = textAlignment;
     _text            = text;
     _textXOffset     = textXOffset;
     _textYOffset     = textYOffset;
     _outline         = outline;
     _selectedColor   = selectedColor;
     _deselectedColor = deselectedColor;
 }
Ejemplo n.º 5
0
 public UIText(byte color, UIPosition pivot, UIAlignment alignment)
 {
     this.color     = color;
     this.pivot     = pivot;
     this.alignment = alignment;
     lines          = new List <string>();
 }
Ejemplo n.º 6
0
 public UIText(byte color, UIPosition pivot, UIAlignment alignment, params string[] lines)
 {
     this.color     = color;
     this.pivot     = pivot;
     this.alignment = alignment;
     this.lines     = lines.ToList();
 }
Ejemplo n.º 7
0
 public ProgressBar(Screen screen, UIAlignment alignment, int x, int y)
 {
     _screen = screen;
     _spriteBatch = screen.screenSystem.spriteBatch;
     _alignment = alignment;
     _xOffset = x;
     _yOffset = y;
     _background = ResourceManager.getTexture("progress_bar_background");
     _fill = ResourceManager.getTexture("progress_bar_fill");
     _border = ResourceManager.getTexture("progress_bar_border");
 }
Ejemplo n.º 8
0
 public InteractiveDialoguePane(Screen screen, UIAlignment alignment, int x, int y, int width, int height, SpriteFont dialogueFont, SpriteFont optionFont, CharacterDialogueComponent dialogueComponent)
     : base(screen, alignment, x, y, width, height)
 {
     _dialogueComponent = dialogueComponent;
     _dialogueFont = dialogueFont;
     _optionFont = optionFont;
     _dialogueManager = DataManager.dialogueManager;
     _maxLineWidth = (float)_width - _margin * 2f;
     _optionButtons = new List<TextButton>();
     setCurrentNodeUid(_dialogueManager.getCurrentDialogueNodeUid(dialogueComponent.dialogueUid));
 }
Ejemplo n.º 9
0
 public ProgressBar(Screen screen, UIAlignment alignment, int x, int y)
 {
     _screen      = screen;
     _spriteBatch = screen.screenSystem.spriteBatch;
     _alignment   = alignment;
     _xOffset     = x;
     _yOffset     = y;
     _background  = ResourceManager.getTexture("progress_bar_background");
     _fill        = ResourceManager.getTexture("progress_bar_fill");
     _border      = ResourceManager.getTexture("progress_bar_border");
 }
Ejemplo n.º 10
0
 public InteractiveDialoguePane(Screen screen, UIAlignment alignment, int x, int y, int width, int height, SpriteFont dialogueFont, SpriteFont optionFont, CharacterDialogueComponent dialogueComponent)
     : base(screen, alignment, x, y, width, height)
 {
     _dialogueComponent = dialogueComponent;
     _dialogueFont      = dialogueFont;
     _optionFont        = optionFont;
     _dialogueManager   = DataManager.dialogueManager;
     _maxLineWidth      = (float)_width - _margin * 2f;
     _optionButtons     = new List <TextButton>();
     setCurrentNodeUid(_dialogueManager.getCurrentDialogueNodeUid(dialogueComponent.dialogueUid));
 }
Ejemplo n.º 11
0
 public NamePreview(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, int maxLetters)
 {
     _screen = screen;
     _spriteBatch = _screen.screenSystem.spriteBatch;
     _font = font;
     _alignment = alignment;
     _xOffset = x;
     _yOffset = y;
     _maxLetters = maxLetters;
     _width = _maxLetters * _letterSpacing;
     _letterLine = ResourceManager.getTexture("line_indicator");
 }
Ejemplo n.º 12
0
 public NamePreview(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, int maxLetters)
 {
     _screen      = screen;
     _spriteBatch = _screen.screenSystem.spriteBatch;
     _font        = font;
     _alignment   = alignment;
     _xOffset     = x;
     _yOffset     = y;
     _maxLetters  = maxLetters;
     _width       = _maxLetters * _letterSpacing;
     _letterLine  = ResourceManager.getTexture("line_indicator");
 }
Ejemplo n.º 13
0
 public Label(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, TextAlignment textAlignment, string text, int outline, Color color)
 {
     _screen        = screen;
     _spriteBatch   = screen.screenSystem.spriteBatch;
     _font          = font;
     _text          = text;
     _outline       = outline;
     _xOffset       = x;
     _yOffset       = y;
     _alignment     = alignment;
     _textAlignment = textAlignment;
     _color         = color;
 }
Ejemplo n.º 14
0
 public Label(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, TextAlignment textAlignment, string text, int outline, Color color)
 {
     _screen = screen;
     _spriteBatch = screen.screenSystem.spriteBatch;
     _font = font;
     _text = text;
     _outline = outline;
     _xOffset = x;
     _yOffset = y;
     _alignment = alignment;
     _textAlignment = textAlignment;
     _color = color;
 }
Ejemplo n.º 15
0
        public TextureButton(Screen screen, SpriteBatch spriteBatch, UIAlignment alignment, int x, int y, Texture2D selectedTexture, Texture2D deselectedTexture, Rectangle localHitBox, Action onActivate, Action onMouseOver, Action onMouseOut)
        {
            _screen            = screen;
            _spriteBatch       = spriteBatch;
            _alignment         = alignment;
            _xOffset           = x;
            _yOffset           = y;
            _selectedTexture   = selectedTexture;
            _deselectedTexture = deselectedTexture;
            _localHitBox       = localHitBox;
            _onActivate        = onActivate;
            _onMouseOver       = onMouseOver;
            _onMouseOut        = onMouseOut;

            _pixel = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
            _pixel.SetData <Color>(new[] { Color.White });
        }
Ejemplo n.º 16
0
        public TextureButton(Screen screen, SpriteBatch spriteBatch, UIAlignment alignment, int x, int y, Texture2D selectedTexture, Texture2D deselectedTexture, Rectangle localHitBox, Action onActivate, Action onMouseOver, Action onMouseOut)
        {
            _screen = screen;
            _spriteBatch = spriteBatch;
            _alignment = alignment;
            _xOffset = x;
            _yOffset = y;
            _selectedTexture = selectedTexture;
            _deselectedTexture = deselectedTexture;
            _localHitBox = localHitBox;
            _onActivate = onActivate;
            _onMouseOver = onMouseOver;
            _onMouseOut = onMouseOut;

            _pixel = new Texture2D(spriteBatch.GraphicsDevice, 1, 1);
            _pixel.SetData<Color>(new[] { Color.White });
        }
Ejemplo n.º 17
0
 public BluePane(Screen screen, UIAlignment alignment, int x, int y, int width, int height)
     : base(screen,
         ResourceManager.getTexture("blue_pane_top_left_corner"),
         ResourceManager.getTexture("blue_pane_top_right_corner"),
         ResourceManager.getTexture("blue_pane_bottom_right_corner"),
         ResourceManager.getTexture("blue_pane_bottom_left_corner"),
         ResourceManager.getTexture("blue_pane_left_side"),
         ResourceManager.getTexture("blue_pane_top_side"),
         ResourceManager.getTexture("blue_pane_right_side"),
         ResourceManager.getTexture("blue_pane_bottom_side"),
         ResourceManager.getTexture("blue_pane_background"),
         alignment,
         x,
         y,
         width,
         height)
 {
 }
Ejemplo n.º 18
0
 public StonePane(Screen screen, UIAlignment alignment, int x, int y, int width, int height)
     : base(
         screen,
         ResourceManager.getTexture("stone_pane_top_left_corner"),
         ResourceManager.getTexture("stone_pane_top_right_corner"),
         ResourceManager.getTexture("stone_pane_bottom_right_corner"),
         ResourceManager.getTexture("stone_pane_bottom_left_corner"),
         ResourceManager.getTexture("stone_pane_left_side"),
         ResourceManager.getTexture("stone_pane_top_side"),
         ResourceManager.getTexture("stone_pane_right_side"),
         ResourceManager.getTexture("stone_pane_bottom_side"),
         ResourceManager.getTexture("stone_pane_background"),
         alignment,
         x,
         y,
         width,
         height)
 {
 }
Ejemplo n.º 19
0
 public TextButton(Screen screen, SpriteFont font, UIAlignment alignment, int xOffset, int yOffset, int hitBoxPadding, TextAlignment textAlignment, string text, int outline, Color selectedColor, Color deselectedColor, Action onActivate, Action onMouseOver, Action onMouseOut)
 {
     _screen = screen;
     _spriteBatch = _screen.screenSystem.spriteBatch;
     _font = font;
     _alignment = alignment;
     _xOffset = xOffset;
     _yOffset = yOffset;
     _hitBoxPadding = hitBoxPadding;
     _textAlignment = textAlignment;
     this.text = text;
     _outline = outline;
     _selectedColor = selectedColor;
     _deselectedColor = deselectedColor;
     _onActivate = onActivate;
     _onMouseOver = onMouseOver;
     _onMouseOut = onMouseOut;
     _color = deselectedColor;
 }
Ejemplo n.º 20
0
 public TextButton(Screen screen, SpriteFont font, UIAlignment alignment, int xOffset, int yOffset, int hitBoxPadding, TextAlignment textAlignment, string text, int outline, Color selectedColor, Color deselectedColor, Action onActivate, Action onMouseOver, Action onMouseOut)
 {
     _screen          = screen;
     _spriteBatch     = _screen.screenSystem.spriteBatch;
     _font            = font;
     _alignment       = alignment;
     _xOffset         = xOffset;
     _yOffset         = yOffset;
     _hitBoxPadding   = hitBoxPadding;
     _textAlignment   = textAlignment;
     this.text        = text;
     _outline         = outline;
     _selectedColor   = selectedColor;
     _deselectedColor = deselectedColor;
     _onActivate      = onActivate;
     _onMouseOver     = onMouseOver;
     _onMouseOut      = onMouseOut;
     _color           = deselectedColor;
 }
Ejemplo n.º 21
0
        public NameInputPane(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, int width, int height, int maxLetters)
            : base(screen, alignment, x, y, width, height)
        {
            _font          = font;
            _maxLetters    = maxLetters;
            _lineIndicator = ResourceManager.getTexture("line_indicator");
            _sb            = new StringBuilder();
            _letterButtons = new List <TextButton>();

            string[] letters = new string[]
            {
                "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
                "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
                "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", " ", "-", "_", ".", ","
            };
            int   gridCellWidth = (int)Math.Floor((float)_width / (float)_letterSpacing);
            int   halfWidth     = (int)((float)_width / 2f);
            int   halfHeight    = (int)((float)_height / 2f);
            Point letterOffset  = new Point(32, 24);

            for (int i = 0; i < letters.Length; i++)
            {
                string letter      = letters[i];
                int    letterCellX = i % gridCellWidth;
                int    letterCellY = (int)Math.Floor((float)i / (float)gridCellWidth);

                _letterButtons.Add(new TextButton(
                                       _screen,
                                       _font,
                                       _alignment,
                                       letterOffset.X + -halfWidth + _xOffset + letterCellX * _letterSpacing,
                                       letterOffset.Y + -halfHeight + _yOffset + letterCellY * _letterSpacing,
                                       16,
                                       TextAlignment.Center,
                                       letter,
                                       1,
                                       Color.White,
                                       new Color(0.8f, 0.8f, 0.8f),
                                       () => { addLetter(letter); }));
            }
        }
Ejemplo n.º 22
0
 public TextButton(Screen screen, SpriteFont font, UIAlignment alignment, int xOffset, int yOffset, int hitBoxPadding, TextAlignment textAlignment, string text, int outline, Color selectedColor, Color deselectedColor, Action onActivate)
     : this(screen, font, alignment, xOffset, yOffset, hitBoxPadding, textAlignment, text, outline, selectedColor, deselectedColor, onActivate, null, null)
 {
     _onMouseOver = () => { select(); };
     _onMouseOut  = () => { deselect(); };
 }
Ejemplo n.º 23
0
 public Label(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, TextAlignment textAlignment, string text, int outline)
     : this(screen, font, alignment, x, y, textAlignment, text, outline, Color.White)
 {
 }
Ejemplo n.º 24
0
 public TextureButton(Screen screen, SpriteBatch spriteBatch, UIAlignment alignment, int x, int y, Texture2D selectedTexture, Texture2D deselectedTexture, Rectangle localHitBox, Action onActivate)
     : this(screen, spriteBatch, alignment, x, y, selectedTexture, deselectedTexture, localHitBox, onActivate, null, null)
 {
     _onMouseOver = () => { select(); };
     _onMouseOut = () => { deselect(); };
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Create a column container inside this element.
 /// Columns are sub elements that takes 100% of height, and arrange themselves automatically based on alignment and other columns.
 /// For example if you create 3 columns in the sizes of 50, 100, and 150, and they all align left, the last column will have offset of 50 + 100.
 /// Columns are useful when you want to arrange elements side by side.
 /// </summary>
 /// <remarks>To remove the column, use RemoveChild() just like you would do with a regular child element.</remarks>
 /// <param name="stylesheet">Column stylesheet or null to create empty container.</param>
 /// <param name="width">Column width.</param>
 /// <param name="widthType">Column width unit (pixels / percents).</param>
 /// <param name="alignment">Column alignment, ie which side of the parent element it will stick to.</param>
 /// <returns>New column element.</returns>
 public UIElement CreateColumn(string stylesheet, int width, UISizeType widthType = UISizeType.Pixels, UIAlignment alignment = UIAlignment.Left)
 {
     return(new UIElement(_BonEngineBind.BON_UIElement_CreateColumn(_handle, stylesheet, width, (int)widthType, (int)alignment)));
 }
Ejemplo n.º 26
0
 public TextButton(Screen screen, SpriteFont font, UIAlignment alignment, int xOffset, int yOffset, int hitBoxPadding, TextAlignment textAlignment, string text, int outline, Color selectedColor, Color deselectedColor, Action onActivate)
     : this(screen, font, alignment, xOffset, yOffset, hitBoxPadding, textAlignment, text, outline, selectedColor, deselectedColor, onActivate, null, null)
 {
     _onMouseOver = () => { select(); };
     _onMouseOut = () => { deselect(); };
 }
Ejemplo n.º 27
0
        public static void Text(Console console, UIPosition position, string text, byte color, UIAlignment alignment = UIAlignment.Center)
        {
            int x = position.GetX(console);
            int y = position.GetY(console);

            Text(console, x, y, text, color, alignment);
        }
Ejemplo n.º 28
0
        public static void Text(Console console, int x, int y, string text, byte color, UIAlignment alignment = UIAlignment.Center)
        {
            int start = x;

            switch (alignment)
            {
            case UIAlignment.Center:
                start -= text.Length / 2;
                break;

            case UIAlignment.Right:
                start -= text.Length - 1;
                break;
            }

            for (int xx = start; xx < start + text.Length; xx++)
            {
                if (xx >= 0 && xx < console.Width)
                {
                    console.Data[xx, y]  = text[xx - start];
                    console.Color[xx, y] = color;
                }
            }
        }
Ejemplo n.º 29
0
 public Label(Screen screen, SpriteFont font, UIAlignment alignment, int x, int y, TextAlignment textAlignment, string text, int outline)
     : this(screen, font, alignment, x, y, textAlignment, text, outline, Color.White)
 {
 }
Ejemplo n.º 30
0
 public TextureButton(Screen screen, SpriteBatch spriteBatch, UIAlignment alignment, int x, int y, Texture2D selectedTexture, Texture2D deselectedTexture, Rectangle localHitBox, Action onActivate) :
     this(screen, spriteBatch, alignment, x, y, selectedTexture, deselectedTexture, localHitBox, onActivate, null, null)
 {
     _onMouseOver = () => { select(); };
     _onMouseOut  = () => { deselect(); };
 }
Ejemplo n.º 31
0
 public UILabel(float x, float y, float width, float height, string text, UIContainer parent = null, UISizeMethod sizing = UISizeMethod.UV, UIAlignment alignment = UIAlignment.Center) : base(x, y, width, height, parent, sizing)
 {
     Text           = text;
     this.alignment = alignment;
 }