/// <summary> /// Handle full reset on exit /// </summary> /// <param name="p_Object"></param> private static void LevelSearchViewController_didStartLoadingEvent(LevelSearchViewController p_Object) { if (p_Object != null) { p_Object.didStartLoadingEvent -= LevelSearchViewController_didStartLoadingEvent; } if (!p_Object || !p_Object.isInViewControllerHierarchy || p_Object.isInTransition || !p_Object.gameObject.activeInHierarchy) { return; } try { var l_Filter = p_Object.GetField <LevelFilterParams>("_currentFilterParams"); if (l_Filter != null && l_Filter.filterByLevelIds) { p_Object.ResetCurrentFilterParams(); var l_InputFieldView = p_Object.GetField <InputFieldView>("_searchTextInputFieldView"); if (l_InputFieldView != null && l_InputFieldView) { l_InputFieldView.SetText(""); l_InputFieldView.UpdateClearButton(); l_InputFieldView.UpdatePlaceholder(); } p_Object.UpdateSearchLevelFilterParams(LevelFilterParams.NoFilter()); } } catch (System.Exception p_Exception) { Logger.Instance.Error("[ChatRequest] LevelSearchViewController_didStartLoadingEvent failed : "); Logger.Instance.Error(p_Exception); } }
/// <summary> /// Level selection, filter /// </summary> /// <param name="p_LevelSearchViewController">LevelSearchViewController instance</param> /// <param name="p_Wait">Should wait for any transition</param> /// <returns></returns> private static IEnumerator LevelSelection_FilterLevel(LevelSearchViewController p_LevelSearchViewController, bool p_Wait) { if (SDK.Game.Logic.ActiveScene != SDK.Game.Logic.SceneType.Menu) { yield break; } if (p_LevelSearchViewController == null || !p_LevelSearchViewController || m_PendingFilterSong == null) { yield break; } if (p_Wait) { yield return(new WaitUntil(() => !p_LevelSearchViewController || !p_LevelSearchViewController.isInTransition)); if (!p_LevelSearchViewController || !p_LevelSearchViewController.isInViewControllerHierarchy || !p_LevelSearchViewController.isActiveAndEnabled) { yield break; } if (SDK.Game.Logic.ActiveScene != SDK.Game.Logic.SceneType.Menu) { yield break; } } try { p_LevelSearchViewController.didStartLoadingEvent -= LevelSearchViewController_didStartLoadingEvent; p_LevelSearchViewController.ResetCurrentFilterParams(); var l_InputFieldView = p_LevelSearchViewController.GetField <InputFieldView, LevelSearchViewController>("_searchTextInputFieldView"); if (l_InputFieldView != null && l_InputFieldView) { l_InputFieldView.SetText(m_PendingFilterSong.songName); l_InputFieldView.UpdateClearButton(); l_InputFieldView.UpdatePlaceholder(); } p_LevelSearchViewController.UpdateSearchLevelFilterParams(LevelFilterParams.ByBeatmapLevelIds(new HashSet <string>() { m_PendingFilterSong.levelID })); p_LevelSearchViewController.didStartLoadingEvent += LevelSearchViewController_didStartLoadingEvent; } catch (System.Exception p_Exception) { Logger.Instance.Error("[ChatRequest] LevelSelection_FilterLevel coroutine failed : "); Logger.Instance.Error(p_Exception); LevelSearchViewController_didStartLoadingEvent(p_LevelSearchViewController); } }