예제 #1
0
        public Hamburger(Texture2D hamburgerIcon, bool leftRight, ScreenManager screenManager)
        {
            HamburgerItems = new List <ContextMenuItem>();
            LeftRight      = leftRight;

            //create the image for the icon
            HamburgerImage = new Image(hamburgerIcon)
            {
                Size             = new Vector2(64f, 64f),
                Vertical         = VerticalAlignment.Top,
                Horizontal       = HorizontalAlignment.Center,
                FillRect         = true,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop)
            };

            //set the hamburger button properties
            Size             = new Vector2(64f, 64f);
            Vertical         = VerticalAlignment.Top;
            Horizontal       = LeftRight ? HorizontalAlignment.Left : HorizontalAlignment.Right;
            TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop);
            Position         = new Point(LeftRight ?  Resolution.TitleSafeArea.Left : Resolution.TitleSafeArea.Right, Resolution.TitleSafeArea.Top);
            AddItem(HamburgerImage);
            OnClick += (obj, e) =>
            {
                screenManager.AddScreen(new HamburgerMenuScreen(HamburgerImage.Texture, HamburgerItems, LeftRight));
            };
        }
예제 #2
0
        public override void LoadContent(IScreen screen)
        {
            base.LoadContent(screen);

            //load the icon
            TransitionObject = new WipeTransitionObject(TransitionWipeType.PopRight);
            HasBackground    = false;
            HasOutline       = StyleSheet.CancelButtonHasOutline;
            Horizontal       = HorizontalAlignment.Right;
            Vertical         = VerticalAlignment.Top;
            DrawWhenInactive = false;

            CancelIcon = new Image(screen.Content.Load <Texture2D>(IconTextureName))
            {
                Vertical         = VerticalAlignment.Top,
                Horizontal       = HorizontalAlignment.Right,
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopRight),
            };
            AddItem(CancelIcon);

            //set the size to the texture size
            var size      = new Vector2(CancelIcon.Texture.Bounds.Width, CancelIcon.Texture.Bounds.Height);
            var relLayout = Layout as RelativeLayout;

            relLayout.Size = size;
            Size           = size;

            Position = new Point(Resolution.TitleSafeArea.Right, Resolution.TitleSafeArea.Top) + StyleSheet.CancelButtonOffset;

            //Exit the screen when this button is selected
            OnClick += ((object obj, ClickEventArgs e) =>
            {
                screen.ExitScreen();
            });
        }
예제 #3
0
 public Dropdown(IScreen screen)
 {
     Screen           = screen;
     DropdownItems    = new List <IDropdownItem <T> >();
     TransitionObject = new WipeTransitionObject(StyleSheet.Transition);
     Background       = new Background();
 }
예제 #4
0
 /// <summary>
 /// constructor!
 /// </summary>
 protected Widget()
 {
     Highlightable    = true;
     _horizontal      = HorizontalAlignment.Left;
     _vertical        = VerticalAlignment.Top;
     _scale           = 1.0f;
     _padding         = Vector2.Zero;
     HighlightClock   = new GameClock();
     TransitionObject = new WipeTransitionObject(StyleSheet.Transition);
     Background       = new Background();
 }
예제 #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="widget"></param>
        public TextEditScreen(ITextEdit widget) : base("TextEdit")
        {
            TransitionObject   = new WipeTransitionObject(TransitionWipeType.None);
            Transition.OnTime  = 0f;
            Transition.OffTime = 0f;
            TextWidget         = widget;
            CoverOtherScreens  = false;
            CorrectText        = TextWidget.Text;

            _current = Keyboard.GetState();
            _prev    = Keyboard.GetState();
        }
예제 #6
0
 public ContinueMenuEntry(ContentManager content) : base("Continue", content)
 {
     TransitionObject = new WipeTransitionObject(TransitionWipeType.PopBottom);
 }