Example #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);

        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));
    }
	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 ) );
	}
Example #3
0
    // Build Main Menu
    private void BuildMenu()
    {
        var brickum = UIButton.create("brickum.png", "brickum.png", 0, 0);

        brickum.scale *= menuScale;

        var buttonCampaign = UIButton.create("button_campaign.png", "button_campaign_down.png", 0, 0);

        buttonCampaign.scale           *= menuScale;
        buttonCampaign.onTouchUpInside += (sender) => ButtonCampaign();


        var buttonFreeplay = UIButton.create("button_freeplay.png", "button_freeplay_down.png", 0, 0);

        buttonFreeplay.scale           *= menuScale;
        buttonFreeplay.onTouchUpInside += (sender) => ButtonFreePlay();

        var buttonKidmode = UIButton.create("button_kidmode.png", "button_kidmode_down.png", 0, 0);

        buttonKidmode.scale           *= menuScale;
        buttonKidmode.onTouchUpInside += (sender) => ButtonKidMode();

        containerMenu = new UIVerticalLayout(5);
        containerMenu.addChild(brickum, buttonCampaign, buttonFreeplay, buttonKidmode);
        containerMenu.matchSizeToContentSize();
        containerMenu.positionCenter();

        tipText        = textSmall.addTextInstance("Tip: Tips go here", 0, 0);
        tipText.text   = "Tip: " + gameSetup.GetTip();
        tipText.scale *= menuScale;
        tipText.positionFromBottom(0.03f, 0);

        // Options Button
        buttonOptions                  = UIButton.create("options_up.png", "options_down.png", 0, 0);
        buttonOptions.scale           *= menuScale;
        buttonOptions.onTouchUpInside += (sender) => ButtonOptions();
        buttonOptions.positionFromTopRight(0, 0);
        buttonOptions.alphaTo(1, 0.3f, Easing.Linear.easeOut);
    }