Exemple #1
0
 public static void Initialize(PreloadedBundleContents stuffBundle)
 {
     ourStuffBundle = stuffBundle;
 }
Exemple #2
0
        internal static bool CreatePinnedPrefButton(MelonPreferences_Entry entry, Transform expandoRoot, PreloadedBundleContents bundle)
        {
            switch (entry)
            {
            case MelonPreferences_Entry <bool> boolEntry:
                CreatePinnedPrefButton(boolEntry, expandoRoot, bundle.QuickMenuToggle);
                return(true);

            case MelonPreferences_Entry <string> stringEntry:
                if (ExpansionKitApi.EnumSettings.TryGetValue((stringEntry.Category.Identifier, stringEntry.Identifier), out var possibleValues))
                {
                    CreatePinnedPrefButtonForString(stringEntry, possibleValues, expandoRoot, bundle.QuickMenuButton);
                    return(true);
                }

                break;
            }

            var entryType = entry.GetReflectedType();

            if (entryType.IsEnum)
            {
                typeof(PinnedPrefUtil).GetMethod(nameof(CreatePinnedPrefButtonForEnum), BindingFlags.Static | BindingFlags.NonPublic) !
                .MakeGenericMethod(entryType)
                .Invoke(null, new object[] { entry, expandoRoot, bundle.QuickMenuButton });

                return(true);
            }

            return(false);
        }