Exemple #1
0
    public void Setup(ToggleGroup group, ItemRegistry.Category type, UnityAction<ItemRegistry.Category> callback, bool isOn)
    {
        // Set the toggle group for this toggle
        myToggle.group = group;
        // Set the type for this button
        this.type = type;
        // Add the callback to the on selected listener
        onSelected.AddListener(callback);

        // Set the text on the button
        text.text = type.ToString();
        // Add function to callback when the toggle is switched to on
        myToggle.onValueChanged.AddListener(OnToggleStateChanged);

        // Set the desired initial toggle state
        myToggle.isOn = isOn;
    }
Exemple #2
0
 public ItemID(ItemRegistry.Category category, int index)
 {
     this.category = category;
     this.index    = index;
 }