Beispiel #1
0
    public static void Button(this CommandContainer _container, Action OnClick)
    {
        CommandItem_Button button = _container.Insert <CommandItem_Button>();

        button.m_Button.onClick.AddListener(() => OnClick());
        button.m_ButtonTitle.text = _container.m_KeyCode.GetKeyCodeString();
    }
Beispiel #2
0
    static T ButtonFoldOutItem <T>(this CommandContainer _container, bool foldOut, out CommandItem_Button _button) where T : CommandItemBase
    {
        _button = null;
        if (!foldOut)
        {
            return(_container.Insert <T>());
        }
        _button = _container.Insert <CommandItem_Button>();
        T item = _container.Insert <T>();

        _button.m_Button.onClick.AddListener(() => item.transform.SetActive(!item.transform.gameObject.activeSelf));
        item.transform.SetActive(false);
        return(item);
    }