From 3c3b50ca75dc9253952601d16577a3826563172d Mon Sep 17 00:00:00 2001 From: Stephen Damm <421822+halsafar@users.noreply.github.com> Date: Sat, 25 Aug 2018 14:45:49 -0600 Subject: [PATCH] Working with 0.11.2. Version bump. --- SongBrowserPlugin/DataAccess/SongBrowserModel.cs | 12 +++++++----- SongBrowserPlugin/Plugin.cs | 2 +- SongBrowserPlugin/SongBrowserApplication.cs | 2 +- SongBrowserPlugin/SongBrowserPlugin.csproj | 2 -- .../UI/Keyboard/SearchKeyboardViewController.cs | 11 +++++------ SongBrowserPlugin/UI/UIBuilder.cs | 4 ++-- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/SongBrowserPlugin/DataAccess/SongBrowserModel.cs b/SongBrowserPlugin/DataAccess/SongBrowserModel.cs index c21b9de..f511c28 100644 --- a/SongBrowserPlugin/DataAccess/SongBrowserModel.cs +++ b/SongBrowserPlugin/DataAccess/SongBrowserModel.cs @@ -290,10 +290,12 @@ private void UpdateSongInfos(GameplayMode gameplayMode) _log.Trace("UpdateSongInfos for Gameplay Mode {0}", gameplayMode); // Get the level collection from song loader - SongLoaderPlugin.OverrideClasses.CustomLevelCollectionsForGameplayModes collections = SongLoaderPlugin.SongLoader.Instance.GetPrivateField("_customLevelCollectionsForGameplayModes"); - _gameplayModeCollection = collections.GetCollection(gameplayMode) as SongLoaderPlugin.OverrideClasses.CustomLevelCollectionSO; - _originalSongs = collections.GetLevels(gameplayMode).ToList(); + LevelCollectionsForGameplayModes levelCollections = Resources.FindObjectsOfTypeAll().FirstOrDefault(); + List levelCollectionsForGameModes = ReflectionUtil.GetPrivateField(levelCollections, "_collections").ToList(); + + _originalSongs = levelCollections.GetLevels(gameplayMode).ToList(); _sortedSongs = _originalSongs; + _levelIdToCustomLevel = new Dictionary(); foreach (var level in SongLoader.CustomLevels) { @@ -614,8 +616,8 @@ private void FilterPlaylist() List playlistNameListOrdered = this.CurrentPlaylist.songs.Select(x => x.songName).Distinct().ToList(); Dictionary songNameToIndex = playlistNameListOrdered.Select((val, index) => new { Index = index, Value = val }).ToDictionary(i => i.Value, i => i.Index); HashSet songNames = new HashSet(playlistNameListOrdered); - SongLoaderPlugin.OverrideClasses.CustomLevelCollectionsForGameplayModes collections = SongLoaderPlugin.SongLoader.Instance.GetPrivateField("_customLevelCollectionsForGameplayModes"); - List songList = collections.GetLevels(_currentGamePlayMode).Where(x => songNames.Contains(x.songName)).ToList(); + LevelCollectionsForGameplayModes levelCollections = Resources.FindObjectsOfTypeAll().FirstOrDefault(); + List songList = levelCollections.GetLevels(_currentGamePlayMode).Where(x => songNames.Contains(x.songName)).ToList(); _log.Debug("\tMatching songs found for playlist: {0}", songList.Count); _originalSongs = songList; _filteredSongs = songList diff --git a/SongBrowserPlugin/Plugin.cs b/SongBrowserPlugin/Plugin.cs index 4e5dcd7..f79ef8b 100644 --- a/SongBrowserPlugin/Plugin.cs +++ b/SongBrowserPlugin/Plugin.cs @@ -13,7 +13,7 @@ public string Name public string Version { - get { return "v2.2.6"; } + get { return "v2.2.7"; } } public void OnApplicationStart() diff --git a/SongBrowserPlugin/SongBrowserApplication.cs b/SongBrowserPlugin/SongBrowserApplication.cs index 07fe604..53938ca 100644 --- a/SongBrowserPlugin/SongBrowserApplication.cs +++ b/SongBrowserPlugin/SongBrowserApplication.cs @@ -134,7 +134,7 @@ public void AcquireUIElements() /// /// /// - private void HandleSoloModeSelectionViewControllerDidSelectMode(SoloModeSelectionViewController arg1, SoloModeSelectionViewController.SubMenuType arg2) + private void HandleSoloModeSelectionViewControllerDidSelectMode(SoloModeSelectionViewController arg1, SoloModeSelectionViewController.MenuType arg2) { _log.Trace("HandleSoloModeSelectionViewControllerDidSelectMode() - GameplayMode={0}", arg2); this._songBrowserUI.UpdateSongList(); diff --git a/SongBrowserPlugin/SongBrowserPlugin.csproj b/SongBrowserPlugin/SongBrowserPlugin.csproj index 5ee09db..d6d3f87 100644 --- a/SongBrowserPlugin/SongBrowserPlugin.csproj +++ b/SongBrowserPlugin/SongBrowserPlugin.csproj @@ -99,8 +99,6 @@ - - diff --git a/SongBrowserPlugin/UI/Keyboard/SearchKeyboardViewController.cs b/SongBrowserPlugin/UI/Keyboard/SearchKeyboardViewController.cs index 35bc0e9..e101cb4 100644 --- a/SongBrowserPlugin/UI/Keyboard/SearchKeyboardViewController.cs +++ b/SongBrowserPlugin/UI/Keyboard/SearchKeyboardViewController.cs @@ -32,8 +32,8 @@ protected override void DidActivate(bool firstActivation, ActivationType type) _searchKeyboard = _searchKeyboardGO.AddComponent(); - _searchKeyboard.uiKeyboardKeyEvent = delegate (char input) { _inputString += input; UpdateInputText(); }; - _searchKeyboard.uiKeyboardDeleteEvent = delegate () { _inputString = _inputString.Substring(0, _inputString.Length - 1); UpdateInputText(); }; + _searchKeyboard.uiKeyboardKeyEvent += delegate (char input) { _inputString += input; UpdateInputText(); }; + _searchKeyboard.uiKeyboardDeleteEvent += delegate () { _inputString = _inputString.Substring(0, _inputString.Length - 1); UpdateInputText(); }; } if (_inputText == null) @@ -50,13 +50,12 @@ protected override void DidActivate(bool firstActivation, ActivationType type) if (_searchButton == null) { - _searchButton = UIBuilder.CreateUIButton(rectTransform, "ApplyButton"); + _searchButton = UIBuilder.CreateUIButton(rectTransform, "SettingsButton"); UIBuilder.SetButtonText(ref _searchButton, "Search"); (_searchButton.transform as RectTransform).sizeDelta = new Vector2(30f, 10f); - (_searchButton.transform as RectTransform).anchoredPosition = new Vector2(-15f, 1.5f); + (_searchButton.transform as RectTransform).anchoredPosition = new Vector2(-65f, 1.5f); _searchButton.onClick.RemoveAllListeners(); - _searchButton.onClick.AddListener(delegate () - { + _searchButton.onClick.AddListener(delegate () { searchButtonPressed?.Invoke(_inputString); DismissModalViewController(null, false); }); diff --git a/SongBrowserPlugin/UI/UIBuilder.cs b/SongBrowserPlugin/UI/UIBuilder.cs index f1b2e2f..3aaf3ee 100644 --- a/SongBrowserPlugin/UI/UIBuilder.cs +++ b/SongBrowserPlugin/UI/UIBuilder.cs @@ -70,7 +70,7 @@ static public Button CreateUIButton(RectTransform parent, String buttonTemplateN static public Button CreateUIButton(RectTransform parent, Button buttonTemplate) { Button btn = UnityEngine.Object.Instantiate(buttonTemplate, parent, false); - UnityEngine.Object.DestroyImmediate(btn.GetComponent()); + UnityEngine.Object.DestroyImmediate(btn.GetComponent()); btn.onClick = new Button.ButtonClickedEvent(); btn.name = "CustomUIButton"; @@ -190,7 +190,7 @@ public static Button CreateIconButton(RectTransform parent, Button buttonTemplat public static Button CreateBackButton(RectTransform parent) { Button dismissButton = CreateUIButton(parent, "BackArrowButton"); - UnityEngine.Object.DestroyImmediate(dismissButton.GetComponent()); + UnityEngine.Object.DestroyImmediate(dismissButton.GetComponent()); dismissButton.onClick = new Button.ButtonClickedEvent(); dismissButton.name = "CustomUIButton";