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 );
        playButton.highlightedTouchOffsets = new UIEdgeOffsets( 30 );

        // Scores button
        var scores = UIContinuousButton.create( "scoresUp.png", "scoresDown.png", 0, 0 );
        scores.highlightedTouchOffsets = new UIEdgeOffsets( 30 );
        scores.touchDownSound = scoresSound;

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

        // Knob
        var knob = UIKnob.create( "knobUp.png", "knobDown.png", 0, 0 );
        knob.highlightedTouchOffsets = new UIEdgeOffsets( 30 );
        knob.value = 0.3f;

        // Toggle Button
        var toggleButton = UIToggleButton.create( "cbUnchecked.png", "cbChecked.png", "cbDown.png", 0, 0 );
        toggleButton.selected = true;

        // HorizontalLayout
        var hBox = new UIHorizontalLayout( 20 );
        hBox.addChild( playButton, scores, optionsButton );

        // VerticalLayout
        var vBox = new UIVerticalLayout( 20 );
        vBox.addChild( knob, toggleButton );

        // Layouts can be animated like any UIObject
        StartCoroutine( animatePanel( hBox ) );
    }
Ejemplo n.º 2
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);

        playButton.highlightedTouchOffsets = new UIEdgeOffsets(30);


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

        scores.highlightedTouchOffsets = new UIEdgeOffsets(30);
        scores.touchDownSound          = scoresSound;


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

        optionsButton.touchDownSound = optionsSound;


        // Knob
        var knob = UIKnob.create("knobUp.png", "knobDown.png", 0, 0);

        knob.highlightedTouchOffsets = new UIEdgeOffsets(30);
        knob.value = 0.3f;


        // Toggle Button
        var toggleButton = UIToggleButton.create("cbUnchecked.png", "cbChecked.png", "cbDown.png", 0, 0);

        toggleButton.selected = true;


        // HorizontalLayout
        var hBox = new UIHorizontalLayout(20);

        hBox.addChild(playButton, scores, optionsButton);


        // VerticalLayout
        var vBox = new UIVerticalLayout(20);

        vBox.addChild(knob, toggleButton);
        vBox.matchSizeToContentSize();
        vBox.positionFromTopRight(0, 0);


        // Layouts can be animated like any UIObject
        StartCoroutine(animatePanel(hBox));
    }
Ejemplo n.º 3
0
    private void CreateGUI()
    {
        UIToolkit ui = GameObject.Find("UIToolkit").GetComponent<UIToolkit>();

        UIButton uiBackground = UIButton.create(ui, "Marge.png", "Marge.png", 0, 0);
        uiBackground.color = new Color(0f, 0f, 0f, 0f);
        uiBackground.setSize(Screen.width, Screen.height);
        uiBackground.onTouchUpInside += uiBackground_onTouchUpInside;
        uiBackground.zIndex = 10;

        float buttonSize = Screen.width * 0.06f;

        btnMargeArrow = UIButton.create(ui, "MargeArrow.png", "MargeArrow.png", 0, 0);
        btnMargeArrow.setSize(buttonSize, buttonSize);
        btnMargeArrow.positionFromTopLeft(0f, 0.01f);
        btnMargeArrow.onTouchUpInside += btnMargeArrow_onTouchUpInside;
        btnMargeArrow.zIndex = -1;

        spriteMarge = ui.addSprite("Marge.png", 0, 0, -1);
        spriteMarge.setSize(0.01f * Screen.width, 1 * Screen.height);
        spriteMarge.positionFromTopLeft(0f, 0f);
        spriteMarge.zIndex = -1;

        //--- Conteneur
        //var scrollable = new UIScrollableVerticalLayout(10);

        //scrollable.alignMode = UIAbstractContainer.UIContainerAlignMode.Center;
        //scrollable.position = new Vector3(Screen.width * 0.05f, -Screen.height * 0.1f, 0);
        //var width = UI.scaleFactor * 150;
        //scrollable.setSize(width, Screen.height * 0.8f);
        //---

        //UIGridLayout grid = new UIGridLayout(4, map.Layers.Count, 0);
        //grid.edgeInsets = new UIEdgeInsets(0);
        //grid.alignMode = UIAbstractContainer.UIContainerAlignMode.Left;
        //grid.layoutType = UIAbstractContainer.UILayoutType.AbsoluteLayout
        int i = 0;
        foreach (Layer layer in map.Layers)
        {
            UIHorizontalLayout hLayout = new UIHorizontalLayout(0);
            hLayout.zIndex = -2f;

            listHLayout.Add(hLayout);

            //int posY = 10 + i * 20;
            //int margeX = 10;
            //int deltaX = 10;
            //int spaceX = 5;

            //UIText text = new UIText(textManager, "prototype", "prototype.png");

            UIButton btnBrowse = UIButton.create(ui, "Browse.png", "Browse.png", 0, 0);
            UIButton btnMute = UIButton.create(ui, "Mute.png", "Mute.png", 0, 0);
            UIButton btnSolo = UIButton.create(ui, "Solo.png", "Solo.png", 0, 0);
            UIButton btnQuarter = UIButton.create(ui, "Quarter.png", "Quarter.png", 0, 0);
            UIButton btnHalf = UIButton.create(ui, "Half.png", "Half.png", 0, 0);
            UIButton btnNormal = UIButton.create(ui, "Normal.png", "Double.png", 0, 0);
            UIButton btnDouble = UIButton.create(ui, "Double.png", "Double.png", 0, 0);
            UIButton btnFourth = UIButton.create(ui, "Fourth.png", "Fourth.png", 0, 0);

            btnBrowse.setSize(buttonSize, buttonSize);
            btnMute.setSize(buttonSize, buttonSize);
            btnSolo.setSize(buttonSize, buttonSize);
            btnQuarter.setSize(buttonSize, buttonSize);
            btnHalf.setSize(buttonSize, buttonSize);
            btnNormal.setSize(buttonSize, buttonSize);
            btnDouble.setSize(buttonSize, buttonSize);
            btnFourth.setSize(buttonSize, buttonSize);

            float layerButton = -3f;

            btnBrowse.zIndex = layerButton;
            btnMute.zIndex = layerButton;
            btnSolo.zIndex = layerButton;
            btnQuarter.zIndex = layerButton;
            btnHalf.zIndex = layerButton;
            btnNormal.zIndex = layerButton;
            btnDouble.zIndex = layerButton;
            btnFourth.zIndex = layerButton;

            hLayout.addChild(btnBrowse, btnMute, btnSolo, btnQuarter, btnHalf, btnNormal, btnDouble, btnFourth);

            hLayout.positionFromTopLeft(i * 0.1f, -0.5f);

            i++;
        }
    }