Beispiel #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="widget"></param>
 public DropdownScreen(IDropdown <T> widget) : base("Dropdown")
 {
     TransitionObject   = new WipeTransitionObject(TransitionWipeType.None);
     Transition.OnTime  = 0f;
     Transition.OffTime = 0f;
     DropdownWidget     = widget;
     CoverOtherScreens  = false;
 }
Beispiel #2
0
        /// <summary>
        /// Helper draws a translucent black sprite, used for fading specific areas
        /// </summary>
        public void DrawRect(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition, Texture2D tex)
        {
            //set the transition location
            rect.Location = transition.Position(screen, rect);

            //draw the filled background
            DrawRect(screen.AlphaColor(color), rect, tex);
        }
Beispiel #3
0
        public override void LoadContent()
        {
            base.LoadContent();

            _stack = new StackLayout()
            {
                Alignment  = StackAlignment.Top,
                Position   = Point.Zero,
                Horizontal = HorizontalAlignment.Left,
                Vertical   = VerticalAlignment.Top,
            };

            //add each menu item below this
            foreach (var menuItem in ContextMenuItems)
            {
                CreateButton(menuItem, _stack);
            }

            //figure out if we should do left or right
            var horiz = HorizontalAlignment.Left;

            if ((_clickPos.X + _stack.Rect.Width) > Resolution.ScreenArea.Right)
            {
                horiz = HorizontalAlignment.Right;
            }

            //figure out if we should do top or bottom
            var vert = VerticalAlignment.Top;

            if ((_clickPos.Y + _stack.Rect.Height) > Resolution.ScreenArea.Bottom)
            {
                vert = VerticalAlignment.Bottom;

                foreach (var item in _stack.Items)
                {
                    var transitionable = item as ITransitionable;
                    if (null != transitionable)
                    {
                        transitionable.TransitionObject = new WipeTransitionObject(TransitionWipeType.PopBottom);
                    }
                }
            }

            //create the scroll layout
            _layout = new ScrollLayout()
            {
                Position         = _clickPos.ToPoint(),
                Horizontal       = horiz,
                Vertical         = vert,
                TransitionObject = new WipeTransitionObject(vert == VerticalAlignment.Top ? TransitionWipeType.PopTop : TransitionWipeType.PopBottom),
                Size             = new Vector2(_stack.Rect.Width, _stack.Rect.Height)
            };
            _layout.AddItem(_stack);
            AddItem(_layout);

            //set the transition object for this layout so the background will follow correctly
            TransitionObject = new WipeTransitionObject(vert == VerticalAlignment.Top ? TransitionWipeType.PopTop : TransitionWipeType.PopBottom);
        }
Beispiel #4
0
 public ScrollLayout()
 {
     TransitionObject        = new WipeTransitionObject(StyleSheet.Transition);
     DrawVerticalScrollBar   = false;
     DrawHorizontalScrollBar = false;
     UpdateScrollBars();
     DrawScrollbars    = false;
     ShowScrollBars    = true;
     CurrentlyDragging = false;
 }
Beispiel #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="widget"></param>
 public NumPadScreen(INumEdit widget, bool allowDecimal = true, bool allowNegative = true) : base("NumPad")
 {
     TransitionObject   = new WipeTransitionObject(TransitionWipeType.None);
     Transition.OnTime  = 0f;
     Transition.OffTime = 0f;
     NumEditWidget      = widget;
     CoverOtherScreens  = false;
     AllowDecimal       = allowDecimal;
     AllowNegative      = allowNegative;
 }
Beispiel #6
0
        /// <summary>
        /// Draw a
        /// </summary>
        public void DrawRect(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition)
        {
            //get the color for the background & border
            color.A = (byte)(color.A * screen.Alpha);

            //set the transition location
            rect.Location = transition.Position(screen, rect);

            //draw the filled background
            DrawRect(screen.AlphaColor(color), rect);
        }
Beispiel #7
0
 public ScrollLayout(ScrollLayout inst) : base(inst)
 {
     _scrollPos              = new Vector2(inst._scrollPos.X, inst._scrollPos.Y);
     _renderTarget           = inst._renderTarget;
     TransitionObject        = inst.TransitionObject;
     _minScroll              = new Vector2(inst._minScroll.X, inst._minScroll.Y);
     _maxScroll              = new Vector2(inst._maxScroll.X, inst._maxScroll.Y);
     _verticalScrollBar      = new Rectangle(inst._verticalScrollBar.Location, inst._verticalScrollBar.Size);
     _horizScrollBar         = new Rectangle(inst._horizScrollBar.Location, inst._horizScrollBar.Size);
     DrawVerticalScrollBar   = inst.DrawVerticalScrollBar;
     DrawHorizontalScrollBar = inst.DrawHorizontalScrollBar;
     DrawScrollbars          = inst.DrawScrollbars;
     TransitionObject        = inst.TransitionObject;
     ShowScrollBars          = inst.ShowScrollBars;
     CurrentlyDragging       = inst.CurrentlyDragging;
 }
Beispiel #8
0
        public void DrawOutline(Color color, Rectangle rect, IScreenTransition screen, ITransitionObject transition, float lineWidth = 5f)
        {
            //set the transition location
            rect.Location = transition.Position(screen, rect);

            //draw the button outline
            DrawOutline(screen.AlphaColor(color), rect, lineWidth);
        }