Exemple #1
0
 public void Setup(UnityAction <EnumerableItem> callback, params EnumerableItem[] items)
 {
     // Create a button for each enumerable item
     foreach (EnumerableItem item in items)
     {
         // Create the button and set it up
         EnumerableButton instance = Object.Instantiate(buttonPrefab, buttonGroup.transform);
         instance.Setup(buttonGroup, item, OnItemSelectedMethod);
         // Add the button to the map of buttons
         itemButtonMap.Add(item, instance);
     }
     // Add listener for the given callback
     onItemSelected.AddListener(callback);
 }
Exemple #2
0
 private EnumerablePicker(ToggleGroup buttonGroup, EnumerableButton buttonPrefab, EnumerableItemEvent onItemSelected)
 {
     this.buttonGroup    = buttonGroup;
     this.buttonPrefab   = buttonPrefab;
     this.onItemSelected = onItemSelected;
 }