Пример #1
0
            static void Prefix(MVCListView __instance)
            {
                if (__instance.DataSource != null)
                {
                    var newIndexPath = __instance.currentIndexPath;

                    if (__instance.DataSource is LevelSelectionController && __instance.currentIndexPath.depth > 1)
                    {
                        while (newIndexPath.depth != 1)
                        {
                            newIndexPath = newIndexPath.Up();
                        }

                        Traverse.Create(__instance).Property("currentIndexPath").SetValue(newIndexPath);
                        CustomLevelManager.Instance.CurrentFolder = null;
                    }
                    else if (__instance.DataSource is GearSelectionController && __instance.currentIndexPath.depth > 2)
                    {
                        while (newIndexPath.depth != 2)
                        {
                            newIndexPath = newIndexPath.Up();
                        }

                        Traverse.Create(__instance).Property("currentIndexPath").SetValue(newIndexPath);
                        CustomGearManager.Instance.CurrentFolder = null;
                    }
                }
            }
Пример #2
0
        public void ToggleDarkMode(MVCListView listView, bool enabled)
        {
            if (listView == null)
            {
                return;
            }

            UpdateFontSize(listView.ItemPrefab.Label);

            ToggleDarkMode(listView.ItemPrefab, enabled);
            UpdateLabelColor(listView.HeaderView, enabled ? DarkModeText : DefaultText);
            foreach (var item in listView.ItemViews)
            {
                ToggleDarkMode(item, enabled);
            }
        }
Пример #3
0
        public static void ToggleDarkMode(this MVCListView listView, bool enabled)
        {
            if (listView == 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(listView.ItemPrefab.Label);

            listView.ItemPrefab.ToggleDarkMode(enabled);
            listView.HeaderView.ToggleDarkMode(enabled);

            foreach (var item in listView.ItemViews)
            {
                item.ToggleDarkMode(enabled);
            }
        }