예제 #1
0
        public InputMenu(MultiController controllers, List<Controller> allControllers, Rectangle bounds)
            : base(controllers, bounds)
        {
            BaseFrame.Layout = Frame.LayoutType.HorizontalShared;

            ScrollList leftList = new ScrollList(BaseFrame);
            Frame statusFrame = new Frame(BaseFrame) { Layout = Frame.LayoutType.Vertical };

            new Label(statusFrame, "Using ButtonState " + leftList.InputState.ToString());
            new Label(statusFrame, "Using ButtonState " + leftList.InputState.ToString());
            ScrollList rightList = new ScrollList(BaseFrame);

            leftList.OnRight = delegate() { rightList.Focus = true; };
            rightList.OnLeft = delegate() { leftList.Focus = true; };

            OptionList options = new OptionList(leftList);

            Button btn = new Button(options, "Pressed")
            {
                FocusTexture = null,
                OnFocus = delegate()
                {
                }
            };
            btn.TextLabel.FontFocusColor = Color.White;

            btn = new Button(options, "Released") { FocusTexture = null };
            btn.TextLabel.FontFocusColor = Color.White;
            btn = new Button(options, "Held") { FocusTexture = null };
            btn.TextLabel.FontFocusColor = Color.White;
            btn = new Button(options, "Continuous") { FocusTexture = null };
            btn.TextLabel.FontFocusColor = Color.White;

            DefaultItem = leftList;
        }
예제 #2
0
        ScrollList createScrollList(Item parent)
        {
            ScrollList sl = new ScrollList(parent);
            sl.ViewCount = 2;

            Button btn = new Button(sl, App.Button, "Button texture");

            btn = new Button(sl, App.Button, App.menuButtonHighlighted, "Highlight texture")
            { Scale = new Vector2(1.35f, 1.35f) };

            btn = new Button(sl, App.Button, "White Font")
            { Scale = new Vector2(1.35f, 1.35f), };

            btn.TextLabel.FontFocusColor = Color.White;
            btn = new Button(sl, App.Button, App.menuButtonHighlighted, "Swap Scroll Position");
            btn.OnA = delegate()
            {
                sl.KeepFocus = true; //This prevents button from losing focus in a delegate invoke cycle

                if (sl.ScrollPosition == ScrollList.ScrollBarPosition.Left)
                    sl.ScrollPosition = ScrollList.ScrollBarPosition.Right;
                else
                    sl.ScrollPosition = ScrollList.ScrollBarPosition.Left;
            };

            return sl;
        }
예제 #3
0
        OptionList createOptionButton(Item parent, string text)
        {
            OptionList options = new OptionList(parent);

            Button btn = new Button(options, Item.ButtonTexture, "One, " + text);
            btn.TextLabel.FontFocusColor = Color.White;
            btn = new Button(options, Item.ButtonTexture, "Two");
            btn.TextLabel.FontFocusColor = Color.White;
            btn.Scale *= 2;
            btn = new Button(options, Item.ButtonTexture, "Three");
            btn.TextLabel.FontFocusColor = Color.White;
            btn = new Button(options, Item.ButtonTexture, "Four");
            btn.TextLabel.FontFocusColor = Color.White;
            new Label(options, "a long text");

            return options;
        }
예제 #4
0
        public override void refreshItem()
        {
            if (m_objectCount < 1 || m_visibleCount < 1 || lockRefresh)
                return;

            lockRefresh = true;

            if (LayoutHeight > LayoutWidth)
                m_unitLength = (int)(LayoutHeight / m_objectCount);
            else
                m_unitLength = (int)(LayoutWidth / m_objectCount);

            m_length = m_unitLength * m_visibleCount;

            m_bg = CreateBackgroundTexture();

            if (m_slider != null)
                Children.Remove(m_slider);

            Texture2D bg = CreateSliderTexture();

            if (bg != null)
            {
                m_slider = new Button(this, bg);
                m_slider.Depth += .01f;
                m_slider.Fade = false;
            }

            base.refreshItem();

            lockRefresh = false;
        }
예제 #5
0
        /// <summary>
        /// Sample Frame Menu
        /// </summary>
        public FrameMenu(MultiController controllers, List<Controller> allControllers, Rectangle bounds)
            : base(controllers, bounds)
        {
            stack = new StackedItem(BaseFrame);

            Frame menu_left = new Frame(stack) { SizePolicy = Frame.SizeType.Maximum };
            Frame menu_mid = new Frame(stack) { SizePolicy = Frame.SizeType.Maximum };
            Frame menu_right = new Frame(stack) { SizePolicy = Frame.SizeType.Maximum };

            stack.CurrentIndex = 1;
            stack.OnRight = delegate() { stack.KeepFocus = true; stack.CurrentIndex++; };
            stack.OnLeft = delegate() { stack.KeepFocus = true; stack.CurrentIndex--; };

            new Button(menu_mid, "Top left aligned") { HorizontalAlignment = HAlign.Left, VerticalAlignment = VAlign.Top };
            new Button(menu_mid, "Top right aligned") { HorizontalAlignment = HAlign.Right, VerticalAlignment = VAlign.Top };
            new Button(menu_mid, "Bot left aligned") { HorizontalAlignment = HAlign.Left, VerticalAlignment = VAlign.Bottom };
            new Button(menu_mid, "Bot right aligned") { HorizontalAlignment = HAlign.Right, VerticalAlignment = VAlign.Bottom };
            new Button(menu_mid, "Bot aligned") { VerticalAlignment = VAlign.Bottom };
            new Button(menu_mid, "Top aligned") { VerticalAlignment = VAlign.Top };

            new Button(menu_mid, Item.ArrowRight, "Alignment Stretch") { HorizontalAlignment = HAlign.Right, LabelStyle = Button.Style.LabelLeft };
            new Button(menu_mid, Item.ArrowLeft, "Size policies") { HorizontalAlignment = HAlign.Left, LabelStyle = Button.Style.LabelRight };

            new Label(menu_mid, "Buttons with Alignments\nThese menus are in a stacked item.\nThis allows the left and right to\nswitch menus easily");

            new Label(menu_right, "Alignment Stretch");

            new Button(menu_right, "Top Horizontal Stretch (menuTwo Width)") { VerticalAlignment = VAlign.Top, HorizontalAlignment = HAlign.Stretch };
            new Button(menu_right, "Bottom Horizontal Stretch (menuTwo Width)") { VerticalAlignment = VAlign.Bottom, HorizontalAlignment = HAlign.Stretch };

            Frame constrainingFrame = new Frame(menu_right)
            {
                SizePolicy = Frame.SizeType.Fixed,
                HorizontalAlignment = HAlign.Right
            };

            Button vertBtn = new Button(constrainingFrame, "Alignment Right\nVertical Align Stretch\nFixed height (500 px)")
            {
                VerticalAlignment = VAlign.Stretch,
                Animation = AnimateType.None,
            };

            constrainingFrame.FixedSize = new Vector2(vertBtn.MeasureWidth, 500);

            new Button(menu_right, Item.ArrowLeft, "Alignments")
            {
                HorizontalAlignment = HAlign.Left,
                LabelStyle = Button.Style.LabelRight
            };

            new Label(menu_left, "Size policies") { Offset = new Vector2(0, -250) };

            Frame topSharedFrame = new Frame(menu_left) { Layout = Frame.LayoutType.HorizontalShared, VerticalAlignment = VAlign.Top };
            new Button(topSharedFrame, "Top Aligned"){ Animation = AnimateType.None, HorizontalAlignment = HAlign.Left };
            new Button(topSharedFrame, "Horizontal Layout"){ Animation = AnimateType.None };
            new Button(topSharedFrame, "Sharing"){ Animation = AnimateType.None };
            new Button(topSharedFrame, "Screen Width"){ Animation = AnimateType.None, HorizontalAlignment = HAlign.Right };

            Frame leftSharedFrame = new Frame(menu_left) { Layout = Frame.LayoutType.VerticalShared, HorizontalAlignment = HAlign.Left };
            new Button(leftSharedFrame, "Left Aligned"){ Animation = AnimateType.None };
            new Button(leftSharedFrame, "Vertical Layout"){ Animation = AnimateType.None };
            new Button(leftSharedFrame, "Sharing"){ Animation = AnimateType.None };
            new Button(leftSharedFrame, "Screen Height"){ Animation = AnimateType.None };

            Frame greedyMiddleFrame = new Frame(menu_left) { Padding = 0, Layout = Frame.LayoutType.Vertical };
            new Button(greedyMiddleFrame, "Center Aligned") { Animation = AnimateType.None };
            new Button(greedyMiddleFrame, "Vertical Layout"){ Animation = AnimateType.None };
            new Button(greedyMiddleFrame, "Not Sharing"){ Animation = AnimateType.None };
            new Button(greedyMiddleFrame, "Screen Height"){ Animation = AnimateType.None };

            Frame greedyBottomFrame = new Frame(menu_left) { Padding = 0, Layout = Frame.LayoutType.HorizontalShared, VerticalAlignment = VAlign.Bottom };
            Button temp = new Button(greedyBottomFrame, "Bottom Aligned") { Animation = AnimateType.None, HorizontalAlignment = HAlign.Left };
            new Button(greedyBottomFrame, "Horizontal Layout") { Animation = AnimateType.None };
            new Button(greedyBottomFrame, "Sharing") { Animation = AnimateType.None };
            new Button(greedyBottomFrame, "Screen Width") { Animation = AnimateType.None, HorizontalAlignment = HAlign.Right };

            new Button(menu_left, Item.ArrowRight, "Alignments") { HorizontalAlignment = HAlign.Right, LabelStyle = Button.Style.LabelLeft };

            Reset();
        }
예제 #6
0
        ScrollList createScrollList(Item parent)
        {
            ScrollList sl = new ScrollList(parent);
            sl.ViewCount = 10;

            for (int i = 0; i < manager._lstLevels.Count; i++)
            {
                int noLevel = i;
                Button btn = new Button(sl, App.Button, App.menuButtonHighlighted, manager._lstLevels[noLevel].GetName() /* "Level " + (noLevel + 1)*/) { Scale = new Vector2(1f, 1f) };
                btn.OnA = delegate() { manager.nivCourant = manager._lstLevels[noLevel];
                this.Close();
                };
             }
            return sl;
        }