Пример #1
0
    void Start()
    {
        // IMPORTANT: depth is 1 on top higher numbers on the bottom.  This means the lower the number is the closer it gets to the camera.
        var playButton = UIButton.create("playUp.png", "playDown.png", 0, 0);


        // Scores button
        var scores = UIContinuousButton.create("scoresUp.png", "scoresDown.png", 0, 0);


        // Options button
        var optionsButton = UIZoomButton.create("optionsUp.png", "optionsDown.png", 0, 0);

        optionsButton.animationDuration    = 0.2f;
        optionsButton.animationTargetScale = new Vector3(1.4f, 1.4f, 1.4f);


        // Vertical panel
        var vPanel = UIVerticalPanel.create("vertPanelTop.png", "vertPanelMiddle.png", "vertPanelBottom.png");

        vPanel.beginUpdates();
        vPanel.spacing    = 20;
        vPanel.edgeInsets = new UIEdgeInsets(30, 10, 20, 10);
        vPanel.addChild(playButton, scores, optionsButton);
        vPanel.endUpdates();

        vPanel.positionCenter();
    }
Пример #2
0
    public static UIScrollableVerticalLayout createScrollableLayout(UIToolkit toolkit, Vector2 size)
    {
        UIScrollableVerticalLayout layout = new UIScrollableVerticalLayout(0);

        layout.alignMode = UIAbstractContainer.UIContainerAlignMode.Left;
        layout.positionFromBottom(0);           // Position it at the bottom of the screen to keep it out of the view.
        layout.edgeInsets = new UIEdgeInsets(0, 0, 0, 10);
        layout.setSize(size.x, size.y);

        // Create the scrollbar
        UIVerticalPanel scrollbar  = UIVerticalPanel.create(toolkit, "scrollbar_top.png", "scrollbar_mid.png", "scrollbar_bottom.png");
        int             spacerSize = 16;

        hd(ref spacerSize);
        UISpacer spacer = new UISpacer(spacerSize, spacerSize);

        scrollbar.addChild(spacer);

        layout.addScrollBar(scrollbar, spacer);
        return(layout);
    }