internal void OnLoad() { initialized = false; // remove potential for duplicate event calls BSEvents.levelSelected -= BSEvents_levelSelected; // attach to level selected event if we are enabled, and double presses are required if (Plugin.cfg.Enabled && Plugin.cfg.DoublePress) { BSEvents.levelSelected += BSEvents_levelSelected; } MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent; // get PromoViewController PromoViewController = Resources.FindObjectsOfTypeAll <PromoViewController>().FirstOrDefault(); PromoViewController.promoButtonWasPressedEvent += PromoViewController_promoButtonWasPressedEvent; SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); SoloFreePlayFlowCoordinator.didFinishEvent += SoloFreePlayFlowCoordinator_didFinishEvent; StandardLevelDetailView = Resources.FindObjectsOfTypeAll <StandardLevelDetailView>().LastOrDefault(v => v.name.IndexOf("Clone", StringComparison.OrdinalIgnoreCase) == -1); // setup settings SetupUI(); }
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// /// <summary> /// Prefix /// </summary> /// <param name="__instance">PromoViewController instance</param> internal static void Postfix(ref PromoViewController __instance) { if (__instance != m_Instance) { m_OriginalStates.Clear(); } if (Config.GameTweaker.Enabled && m_OriginalStates.Count == 0) { /// Store instance m_Instance = __instance; /// Backup original states for (int l_I = 0; l_I < m_Instance.transform.childCount; ++l_I) { m_OriginalStates.Add(m_Instance.transform.GetChild(l_I).gameObject.activeSelf); } /// Apply SetEnabled(Config.GameTweaker.RemoveNewContentPromotional); } }
private void PromoViewController_promoButtonWasPressedEvent(PromoViewController promoViewController, IAnnotatedBeatmapLevelCollection annotatedBeatmapLevelCollection, IPreviewBeatmapLevel previewBeatmapLevel) { IsInSoloFreeplay = true; //Plugin.Log.Info($"Promo button was pressed, transitioning to SoloFreePlayController"); }