public static void ToggleDarkMode(this MVCListHeaderView header, bool enabled)
        {
            if (header == null || header.Label == null)
            {
                return;
            }

            var textColor = enabled ? UserInterfaceHelper.DarkModeText : UserInterfaceHelper.DefaultText;

            header.Label.color = textColor.normalColor;
        }
Exemple #2
0
            static void Postfix(LevelSelectionController __instance, MVCListHeaderView header)
            {
                CustomLevelManager.Instance.SortLabel.gameObject.SetActive(__instance.showCustom);
                UserInterfaceHelper.Instance.UpdateLabelColor(CustomLevelManager.Instance.SortLabel, Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText : UserInterfaceHelper.DefaultText);

                if (CustomLevelManager.Instance.CurrentFolder != null && SpriteHelper.MenuIcons != null)
                {
                    var isEasyDay = CustomLevelManager.Instance.CurrentFolder.GetName().Equals("\\Easy Day");
                    var isModIo   = CustomLevelManager.Instance.CurrentFolder.GetName().Equals("\\mod.io");

                    header.Label.spriteAsset = isEasyDay || isModIo ? SpriteHelper.BrandIcons : SpriteHelper.MenuIcons;
                    header.SetText(CustomLevelManager.Instance.CurrentFolder.GetName().Replace("\\", $"<sprite name=\"{(isEasyDay || isModIo ? CustomLevelManager.Instance.CurrentFolder.GetName().Replace("\\", string.Empty).ToLower() : "folder_outline")}\" tint>"));
                }
            }
Exemple #3
0
            static void Postfix(GearSelectionController __instance, IndexPath index, MVCListHeaderView itemView)
            {
                if (index.depth < 2)
                {
                    return;
                }

                CustomGearManager.Instance.SortLabel.gameObject.SetActive(__instance.listView.currentIndexPath[1] >= 10);
                UserInterfaceHelper.Instance.UpdateLabelColor(CustomGearManager.Instance.SortLabel, Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText : UserInterfaceHelper.DefaultText);

                var officialGear = Traverse.Create(GearDatabase.Instance).Field("gearListSource").GetValue <GearInfo[][][]>();

                // return out if it's not one of the tabs XLMenuMod is aware of.
                if (index[1] < 0 || index[1] > (officialGear[index[0]].Length * 2) - 1)
                {
                    return;
                }

                if (CustomGearManager.Instance.CurrentFolder != null)
                {
                    if (index[0] < 0)
                    {
                        return;
                    }
                    bool isCustom = index[1] >= officialGear[index[0]].Length;

                    if (isCustom || CategoryHelper.IsTypeOf(index, GearCategory.Hair))
                    {
                        if (SpriteHelper.MenuIcons != null)
                        {
                            itemView.Label.spriteAsset = SpriteHelper.MenuIcons;

                            string newText = "<sprite name=\"folder_outline\">";

                            if (CustomGearManager.Instance.CurrentFolder.GetName().Equals("\\mod.io"))
                            {
                                itemView.Label.spriteAsset = SpriteHelper.BrandIcons;
                                newText = "<sprite name=\"mod.io\">";
                            }
                            itemView.SetText(CustomGearManager.Instance.CurrentFolder.GetName().Replace("\\", newText));
                        }
                    }
                    else
                    {
                        itemView.SetBrandSprite(CustomGearManager.Instance.CurrentFolder.GetParentObject() as CustomGearFolderInfo);
                    }
                }
            }