Esempio n. 1
0
        private static void Postfix(ref LevelFilteringNavigationController __instance, LevelSearchViewController ____levelSearchViewController,
                                    SelectLevelCategoryViewController ____selectLevelCategoryViewController, ref IBeatmapLevelPack[] ____ostBeatmapLevelPacks, ref IBeatmapLevelPack[] ____musicPacksBeatmapLevelPacks,
                                    ref IBeatmapLevelPack[] ____customLevelPacks, ref IBeatmapLevelPack[] ____allBeatmapLevelPacks)
        {
            if (Loader.CustomBeatmapLevelPackCollectionSO == null)
            {
                return;
            }

            ____customLevelPacks = Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks;
            List <IBeatmapLevelPack> packs = new List <IBeatmapLevelPack>();

            if (____ostBeatmapLevelPacks != null)
            {
                packs = packs.Concat(____ostBeatmapLevelPacks).ToList();
            }

            if (____musicPacksBeatmapLevelPacks != null)
            {
                packs = packs.Concat(____musicPacksBeatmapLevelPacks).ToList();
            }

            if (____customLevelPacks != null)
            {
                packs = packs.Concat(____customLevelPacks).ToList();
            }

            ____allBeatmapLevelPacks = packs.ToArray();
            ____levelSearchViewController.Setup(____allBeatmapLevelPacks);
            __instance.UpdateSecondChildControllerContent(____selectLevelCategoryViewController.selectedLevelCategory);
        }
Esempio n. 2
0
        public bool SelectLevelCategory(String levelCategoryName)
        {
            Logger.Trace("SelectLevelCategory({0})", levelCategoryName);

            try
            {
                if (String.IsNullOrEmpty(levelCategoryName))
                {
                    // hack for now, just assume custom levels if a user has an old settings file, corrects itself first time they change level packs.
                    levelCategoryName = SelectLevelCategoryViewController.LevelCategory.CustomSongs.ToString();
                }

                SelectLevelCategoryViewController.LevelCategory category;
                try
                {
                    category = (SelectLevelCategoryViewController.LevelCategory)Enum.Parse(typeof(SelectLevelCategoryViewController.LevelCategory), levelCategoryName, true);
                }
                catch (Exception)
                {
                    // invalid input
                    return(false);
                }

                if (category == LevelFilteringNavigationController.selectedLevelCategory)
                {
                    Logger.Debug($"Level category [{category}] is already selected");
                    return(false);
                }

                Logger.Info("Selecting level category: {0}", levelCategoryName);

                var selectLeveCategoryViewController = LevelFilteringNavigationController.GetComponentInChildren <SelectLevelCategoryViewController>();
                var iconSegementController           = selectLeveCategoryViewController.GetComponentInChildren <IconSegmentedControl>();

                int selectCellNumber = (from x in selectLeveCategoryViewController.GetField <SelectLevelCategoryViewController.LevelCategoryInfo[], SelectLevelCategoryViewController>("_levelCategoryInfos")
                                        select x.levelCategory).ToList().IndexOf(category);

                iconSegementController.SelectCellWithNumber(selectCellNumber);
                selectLeveCategoryViewController.LevelFilterCategoryIconSegmentedControlDidSelectCell(iconSegementController, selectCellNumber);
                LevelFilteringNavigationController.UpdateSecondChildControllerContent(category);
                //AnnotatedBeatmapLevelCollectionsViewController.RefreshAvailability();

                Logger.Debug("Done selecting level category.");

                return(true);
            } catch (Exception e)
            {
                Logger.Exception(e);
            }

            return(false);
        }