/// <summary>
    /// Init window and add example buttons
    /// </summary>
    public ButtonsExampleApplication() : base(1280, 720, false)
    {
        // Create example buttons
        var exampleButton1 = new DefaultButton("images/default.png");
        var exampleButton2 = new DefaultSoundButton("images/default_sound.png");
        var exampleButton3 = new SoundMirrorButton("images/sound_mirror.png");
        var exampleButton4 = new OutlineButton("images/outline.png", Color.Green);
        var exampleButton5 = new DefaultOutlineButton("images/default_outline.png");

        // Set buttons position
        var gameHalfWidth = game.width * 0.5f;
        var gameHeight    = game.height;

        exampleButton1.SetXY(gameHalfWidth, gameHeight / 6);
        exampleButton2.SetXY(gameHalfWidth, gameHeight / 3);
        exampleButton3.SetXY(gameHalfWidth, gameHeight / 2);
        exampleButton4.SetXY(gameHalfWidth, gameHeight * 2 / 3);
        exampleButton5.SetXY(gameHalfWidth, gameHeight * 5 / 6);

        // Add buttons to the Game
        AddChild(exampleButton1);
        AddChild(exampleButton2);
        AddChild(exampleButton3);
        AddChild(exampleButton4);
        AddChild(exampleButton5);
    }
        public static OutlineButton InstantiateOutlineButton(Transform parent)
        {
            OutlineButton button = CreateButton();

            button.transform.SetParent(parent);
            if (!button)
            {
                Debug.Log("No Button created or return");
            }
            return(button);
        }
示例#3
0
        private void GridInterface()
        {
            _buttons = new List <Button>();
            foreach (var items in cameras)
            {
                OutlineButton b = items.items.gameObject.GetComponentInChildren <OutlineButton>();
                b.colors       = colors;
                b.image.sprite = outlineSprite;
                b.onClick.AddListener(Focus);
                _buttons.Add(b);
            }

            /*if (InputManager.GetController() != Inputs.Controller.Other)
             * {
             *   _eventSystem.SetSelectedGameObject(null);
             *   _eventSystem.SetSelectedGameObject(_fullScreenSystem.GetTarget().gameObject.GetComponentInChildren<OutlineButton>().gameObject);
             * }*/
        }
        Widget buildOutlineButton()
        {
            return(new Align(
                       alignment: new Alignment(0.0f, -0.2f),
                       child: new Column(
                           mainAxisSize: MainAxisSize.min,
                           children: new List <Widget> {
                new ButtonBar(
                    mainAxisSize: MainAxisSize.min,
                    children: new List <Widget> {
                    new OutlineButton(
                        child: new Text("OUTLINE BUTTON"),
                        onPressed: () => {
                        // Perform some action
                    }
                        ),

                    new OutlineButton(
                        child: new Text("DISABLED"),
                        onPressed: null
                        )
                }
                    ),
                new ButtonBar(
                    mainAxisSize: MainAxisSize.min,
                    children: new List <Widget> {
                    OutlineButton.icon(
                        icon: new Icon(Icons.add, size: 18.0f),
                        label: new Text("OUTLINE BUTTON"),
                        onPressed: () => {
                        // Perform some action
                    }
                        ),
                    OutlineButton.icon(
                        icon: new Icon(Icons.add, size: 18.0f),
                        label: new Text("DISABLED"),
                        onPressed: null
                        )
                }
                    )
            }
                           )
                       ));
        }