public static void Populate(UICheckboxDropDown dropdown, long flags, Type enumType)
        {
            try {
                var values = EnumBitMaskExtensions.GetPow2Values(enumType);
                foreach (IConvertible flag in values)
                {
                    bool hasFlag = (flags & flag.ToInt64()) != 0;

                    var  itemInfo = enumType.GetEnumMemberInfo(flag);
                    bool hide     = itemInfo.HasAttribute <HideAttribute>();
                    hide &= ModSettings.HideIrrelavant;
                    hide &= !hasFlag;
                    if (hide)
                    {
                        continue; // hide
                    }
                    dropdown.AddItem(
                        item: Enum.GetName(enumType, flag),
                        isChecked: hasFlag,
                        userData: flag);
                }
            } catch (Exception ex) {
                ex.Log();
            }
        }
Esempio n. 2
0
        public static void Populate(UICheckboxDropDown dropdown, int flags, Type enumType)
        {
            var values = EnumBitMaskExtensions.GetPow2ValuesI32(enumType);

            foreach (int flag in values)
            {
                bool hasFlag = (flags & flag) != 0;

                // TODO hide lane flags based on set/get.
                var  itemInfo = enumType.GetEnumMember(flag);
                bool hide     = itemInfo.HasAttribute <HideAttribute>();
                hide &= ModSettings.HideIrrelavant;
                hide &= !hasFlag;
                if (hide)
                {
                    continue; // hide
                }
                dropdown.AddItem(
                    item: Enum.GetName(enumType, flag),
                    isChecked: hasFlag,
                    userData: flag);
            }
        }