示例#1
0
 /// <summary>
 /// A list has a unified width/height of the elements. Each element is rendered below the other one
 /// </summary>
 /// <param name="position"></param>
 /// <param name="defaultDimensions"></param>
 /// <param name="layer"></param>
 /// <param name="alignment"></param>
 /// <param name="parentDimensions"></param>
 public GUIList(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2))
 {
     DefaultDimensions = defaultDimensions;
     ParentDimensions  = parentDimensions;
     Position          = position;
     OffsetPosition    = position;
     Layer             = layer;
     Alignment         = alignment;
 }
示例#2
0
 public GUICanvas(Vector2 position, Vector2 dimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = default(Vector2))
 {
     Dimensions     = dimensions;
     Alignment      = alignment;
     Position       = position;
     OffsetPosition = position;
     Layer          = layer;
     if (Alignment != GUIStyle.GUIAlignment.None)
     {
         ParentResized(ParentDimensions);
     }
 }
示例#3
0
 public GUIBlock(Vector2 position, Vector2 dimensions, Color blockColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = default(Vector2))
 {
     Position   = position;
     Dimensions = dimensions;
     BlockColor = blockColor;
     Layer      = layer;
     Alignment  = alignment;
     if (Alignment != GUIStyle.GUIAlignment.None)
     {
         ParentResized(ParentDimensions);
     }
 }
示例#4
0
        //If the parent resized then our alignemnt may have changed and we need new position coordinates
        public static Vector2 UpdateAlignment(GUIStyle.GUIAlignment alignment, Vector2 parentDimensions, Vector2 dimensions, Vector2 position, Vector2 offsetPosition)
        {
            if (parentDimensions == Vector2.Zero)
            {
                throw new NotImplementedException();
            }

            switch (alignment)
            {
            case GUIStyle.GUIAlignment.None:
                break;

            case GUIStyle.GUIAlignment.TopLeft:
                position.X = 0;
                position.Y = 0;
                break;

            case GUIStyle.GUIAlignment.TopRight:
                position.X = parentDimensions.X - dimensions.X;
                position.Y = 0;
                break;

            case GUIStyle.GUIAlignment.BottomLeft:
                position.Y = parentDimensions.Y - dimensions.Y;
                position.X = 0;
                break;

            case GUIStyle.GUIAlignment.BottomRight:
                position = parentDimensions - dimensions;
                break;

            case GUIStyle.GUIAlignment.Center:
                position = parentDimensions / 2 - dimensions / 2;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(position + offsetPosition);
        }
示例#5
0
 public GUITextBlockToggle(Vector2 position, Vector2 dimensions, String text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer)
 {
 }
示例#6
0
 public GuiListToggleScroll(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, defaultDimensions, layer, alignment, ParentDimensions)
 {
     this.ParentDimensions = ParentDimensions;
 }
示例#7
0
 public GuiListToggle(Vector2 position, Vector2 defaultDimensions, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, defaultDimensions, layer, alignment, ParentDimensions)
 {
     _toggleDimensions = new Vector2(defaultDimensions.X, ToggleButtonHeight);
 }
        public GuiTextBlockLoadDialog(Vector2 position, Vector2 dimensions, string text, GUIContentLoader guiContentLoader, ContentType contentType, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Center, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer)
        {
            _loadedObjectName.Append("...");

            //Initialize the loader and the kind of content we want to retrieve

            GUILoader = guiContentLoader;

            Type type = null;

            switch (contentType)
            {
            case ContentType.Texture2D:
                type = typeof(Texture2D);
                break;
            }

            LoaderMethod = GUILoader.GetType().GetMethod("LoadContentFile").MakeGenericMethod(type);
        }
示例#9
0
 public GuiSliderIntText(Vector2 position, Vector2 sliderDimensions, Vector2 textdimensions, int min, int max, int stepSize, String text, SpriteFont font, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), Vector2 ParentDimensions = new Vector2()) : base(position, sliderDimensions, textdimensions, min, max, 0, text, font, blockColor, sliderColor, layer, alignment, textAlignment, textBorder, ParentDimensions)
 {
     MaxValueInt = max;
     MinValueInt = min;
     StepSize    = stepSize;
 }
示例#10
0
        public GuiSliderFloatText(Vector2 position, Vector2 sliderDimensions, Vector2 textdimensions, float min, float max, uint decimals, String text, SpriteFont font, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), Vector2 ParentDimensions = new Vector2()) : base(position, sliderDimensions, blockColor, layer, alignment, ParentDimensions)
        {
            _textBlock = new GUITextBlock(position, textdimensions, text, font, blockColor, sliderColor, textAlignment, textBorder, layer, alignment, ParentDimensions);

            Dimensions       = sliderDimensions + _textBlock.Dimensions * Vector2.UnitY;
            SliderDimensions = sliderDimensions;
            _sliderColor     = sliderColor;
            MinValue         = min;
            MaxValue         = max;
            _sliderValue     = min;
            roundDecimals    = decimals;
            baseText         = text;

            UpdateText();
        }
示例#11
0
 public GuiSliderInt(Vector2 position, Vector2 dimensions, int min, int max, int stepSize, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, min, max, blockColor, sliderColor, layer, alignment, ParentDimensions)
 {
     MaxValueInt = max;
     MinValueInt = min;
     StepSize    = stepSize;
 }
示例#12
0
        /// <summary>
        /// A default colored block with text on top
        /// </summary>
        public GUITextBlock(Vector2 position, Vector2 dimensions, String text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Left, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, blockColor, layer, alignment, parentDimensions)
        {
            _text     = new StringBuilder(text);
            TextColor = textColor;
            TextFont  = font;

            _textBorder = textBorder;

            TextAlignment = textAlignment;
        }
示例#13
0
 public GuiSliderFloat(Vector2 position, Vector2 dimensions, float min, float max, Color blockColor, Color sliderColor, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, blockColor, layer, alignment, ParentDimensions)
 {
     _sliderColor = sliderColor;
     MinValue     = min;
     MaxValue     = max;
     _sliderValue = min;
 }
示例#14
0
        public GUIColorPicker(Vector2 position, Vector2 dimensions, Color blockColor, SpriteFont font, int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 ParentDimensions = new Vector2()) : base(position, dimensions, blockColor, layer, alignment, ParentDimensions)
        {
            _font        = font;
            _colorString = new StringBuilder(20);

            _colorString.Append(CurrentFullColor);

            _mousePointerFine = position + Vector2.One * 20;
            _mousePointerFull = position + Vector2.One * 20;
        }
示例#15
0
        public GuiDropList(Vector2 position, Vector2 dimensions, string text, SpriteFont font, Color blockColor, Color textColor, GUIStyle.TextAlignment textAlignment = GUIStyle.TextAlignment.Center, Vector2 textBorder = default(Vector2), int layer = 0, GUIStyle.GUIAlignment alignment = GUIStyle.GUIAlignment.None, Vector2 parentDimensions = default(Vector2)) : base(position, dimensions, text, font, blockColor, textColor, textAlignment, textBorder, layer)
        {
            _selectedOptionName.Append("...");

            _baseDimensions = Dimensions;

            throw new NotImplementedException();
        }