Esempio n. 1
0
        public void ToggleDarkMode(MVCListItemView listItemView, bool enabled)
        {
            var textColor = enabled ? DarkModeText : DefaultText;

            UpdateFontSize(listItemView.Label);
            UpdateLabelColor(listItemView, textColor);
        }
        public static void ToggleDarkMode(this MVCListItemView listItemView, bool enabled)
        {
            if (listItemView == null)
            {
                return;
            }

            //TODO: Should this even be here? It's pretty irrelvant to dark mode, although it does ensure the font size gets set more often?
            UserInterfaceHelper.Instance.UpdateFontSize(listItemView.Label);

            listItemView.Label.ToggleDarkMode(enabled);
        }
Esempio n. 3
0
            static void Postfix(ref MVCListItemView itemView)
            {
                if (itemView.Label.text.StartsWith("\\"))
                {
                    if (SpriteHelper.MenuIcons != null)
                    {
                        var isEasyDay = itemView.Label.text.Equals("\\Easy Day");
                        var isModIo   = itemView.Label.text.Equals("\\mod.io");

                        itemView.Label.spriteAsset = isEasyDay || isModIo ? SpriteHelper.BrandIcons : SpriteHelper.MenuIcons;
                        itemView.SetText(itemView.Label.text.Replace("\\", $"<sprite name=\"{(isEasyDay || isModIo ? itemView.Label.text.Replace("\\", string.Empty).ToLower() : "folder_outline")}\" tint>"));
                    }
                }
                else if (itemView.Label.text.Equals("..\\"))
                {
                    if (SpriteHelper.MenuIcons != null)
                    {
                        itemView.Label.spriteAsset = SpriteHelper.MenuIcons;
                        itemView.Label.SetText(itemView.Label.text.Replace("..\\", "<space=10px><sprite name=\"folder\" tint>Go Back"));
                    }
                }
            }
Esempio n. 4
0
 static void Postfix(MultiplayerRoomInfo __instance, IndexPath index, ref MVCListItemView itemView)
 {
     itemView.colors = Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText : UserInterfaceHelper.DefaultText;
 }
Esempio n. 5
0
            static void Postfix(GearSelectionController __instance, IndexPath index, ref MVCListItemView itemView)
            {
                __instance.normalColor = Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText.normalColor : UserInterfaceHelper.DefaultText.normalColor;

                if (index[1] < 0)
                {
                    return;
                }

                itemView.Label.richText = true;

                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;
                }

                bool isCustom = index[1] >= Enum.GetValues(typeof(GearCategory)).Length;

                if (SpriteHelper.MenuIcons != null)
                {
                    itemView.Label.spriteAsset = SpriteHelper.MenuIcons;
                }

                if (index.depth >= 3)
                {
                    GearInfo gearAtIndex = GearDatabase.Instance.GetGearAtIndex(index, out bool _);

                    if (gearAtIndex == null)
                    {
                        itemView.SetText("NOT FOUND", false);
                        Traverse.Create(GearSelectionController.Instance).Method("SetIsEquippedIndicators", itemView, false).GetValue();
                    }
                    else
                    {
                        // To ensure the items have the proper font and weight.
                        itemView.Label.font      = FontDatabase.bookOblique;
                        itemView.Label.fontStyle = FontStyles.Normal;

                        if (gearAtIndex.name.StartsWith("\\"))
                        {
                            if (isCustom || CategoryHelper.IsTypeOf(index, GearCategory.Hair))
                            {
                                var newText = "<space=18px><sprite name=\"folder_outline\" tint=1>";

                                if (gearAtIndex is CustomGearFolderInfo folder)
                                {
                                    if (folder.CustomSprite != null)
                                    {
                                        itemView.Label.spriteAsset = folder.CustomSprite;
                                        newText = "<space=18px><sprite=0 tint=1>";
                                    }
                                }

                                if (gearAtIndex.name.Equals("\\mod.io"))
                                {
                                    itemView.Label.spriteAsset = SpriteHelper.BrandIcons;
                                    newText = "<space=18px><sprite name=\"mod.io\" tint=1>";
                                }

                                itemView.SetText(gearAtIndex.name.Replace("\\", newText), true);
                            }
                            else
                            {
                                itemView.SetBrandSprite(gearAtIndex);
                            }
                        }
                        else if (gearAtIndex.name.Equals("..\\"))
                        {
                            itemView.SetText(gearAtIndex.name.Replace("..\\", "<space=18px><sprite name=\"folder\" tint=1>Go Back"), true);
                        }
                        else
                        {
                            itemView.SetText(gearAtIndex.name, true);
                        }

                        Traverse.Create(__instance).Method("SetIsEquippedIndicators", itemView, __instance.previewCustomizer.HasEquipped(gearAtIndex)).GetValue();
                    }
                }
            }