Пример #1
0
    public static void FlagsSelection <T>(this CommandContainer _container, Ref <T> _refFlags, Action <T> _logFilter, bool foldOut = true) where T : struct, Enum
    {
        CommandItem_FlagsSelection selection = _container.ButtonFoldOutItem <CommandItem_FlagsSelection>(foldOut, out CommandItem_Button foldOutButton);

        selection.SetDataUpdate(() => selection.Play(_refFlags.m_RefValue, flags => {
            _refFlags.SetValue(flags);
            if (foldOutButton != null)
            {
                foldOutButton.m_ButtonTitle.text = flags.GetNumerable().ToString('|', value => value ? "¡Ì" : "¡Á");
            }
            _logFilter(flags);
        }));
        if (foldOutButton != null)
        {
            foldOutButton.m_ButtonTitle.text = _refFlags.m_RefValue.GetNumerable().ToString('|', value => value ? "¡Ì" : "¡Á");
        }
    }
Пример #2
0
    public static void EnumSelection(this CommandContainer _container, Ref <int> _refEnum, List <string> _values, Action <int> OnClick, bool foldOut = true)
    {
        CommandItem_ButtonSelection selection = _container.ButtonFoldOutItem <CommandItem_ButtonSelection>(foldOut, out CommandItem_Button foldOutButton);

        selection.SetDataUpdate(() => {
            selection.Highlight(_refEnum.m_RefValue);
            if (foldOutButton != null)
            {
                foldOutButton.m_ButtonTitle.text = _values[_refEnum.m_RefValue];
            }
        });
        selection.Play(_values, (int value) => {
            OnClick(value);
            foreach (var button in selection.m_ButtonGrid.m_ActiveItems.Values)
            {
                button.Highlight(button.m_Identity == value);
            }
            if (foldOutButton != null)
            {
                foldOutButton.m_ButtonTitle.text = _values[value];
            }
        }).Highlight(_refEnum.m_RefValue);
    }