Esempio n. 1
0
    public override void Initialize()
    {
        // Clear existing
        OnDestroy();
        foreach (Transform child in transform)
        {
            DestroyImmediate(child.gameObject);
        }

        Assert.IsTrue(labels.Count == values.Count);
        for (var i = 0; i < labels.Count; i++)
        {
            var label = labels[i];
            var value = values[i];
            var child = Instantiate(NavigationUiElementProvider.Instance.pillRadioButton, transform, false);
            // Set its parent (PulseElement) instead
            child.transform.parent.GetComponent <RectTransform>().SetWidth(labels.Count > 2 ? 128 : 192);
            var pillRadioButton = child.GetComponent <PillRadioButton>();
            pillRadioButton.label.text = label;
            pillRadioButton.value      = value;
            RadioButtons.Add(pillRadioButton);
        }

        base.Initialize();
    }
Esempio n. 2
0
 public MainPage()
 {
     this.InitializeComponent();
     RadioButtons.Add("Option1", Colors.Black);
     RadioButtons.Add("Option2", Colors.Blue);
     RadioButtons.Add("Option3", Colors.Red);
     //Model = new ViewModel();
     //this.DataContext = Model;
 }
Esempio n. 3
0
    public override void Initialize()
    {
        // Clear existing
        OnDestroy();
        foreach (Transform child in transform)
        {
            DestroyImmediate(child.gameObject);
        }

        Assert.IsTrue(labels.Count == values.Count);
        for (var i = 0; i < labels.Count; i++)
        {
            var label             = labels[i];
            var value             = values[i];
            var child             = Instantiate(NavigationUiElementProvider.Instance.toggleRadioButton, transform, false);
            var toggleRadioButton = child.GetComponent <ToggleRadioButton>();
            toggleRadioButton.label.text = label;
            toggleRadioButton.value      = value;
            RadioButtons.Add(toggleRadioButton);
        }

        base.Initialize();
    }
Esempio n. 4
0
 public void Add(RadioButton r)
 {
     r.Position = new Vector2(Position.X, Position.Y + (RadioButtons.Count + 1) * FontSmall.MeasureString("M").Y + 7);
     Console.WriteLine(r.Position.ToString());
     RadioButtons.Add(r);
 }