diff --git a/Counters+/Counters+.csproj b/Counters+/Counters+.csproj index 50dfd6a..3fc9d84 100644 --- a/Counters+/Counters+.csproj +++ b/Counters+/Counters+.csproj @@ -70,6 +70,11 @@ $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.Settings.dll False + + False + $(BeatSaberDir)\Beat Saber_Data\Managed\BeatSaber.ViewSystem.dll + False + False $(BeatSaberDir)\Beat Saber_Data\Managed\BGLib.AppFlow.dll @@ -128,6 +133,11 @@ $(BeatSaberDir)\Libs\Newtonsoft.Json.dll True + + False + $(BeatSaberDir)\Beat Saber_Data\Managed\SegmentedControl.dll + False + False $(BeatSaberDir)\Libs\SemVer.dll diff --git a/Counters+/Properties/AssemblyInfo.cs b/Counters+/Properties/AssemblyInfo.cs index 93f03ae..308d4e5 100644 --- a/Counters+/Properties/AssemblyInfo.cs +++ b/Counters+/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.3.7")] -[assembly: AssemblyFileVersion("2.3.7")] +[assembly: AssemblyVersion("2.3.8")] +[assembly: AssemblyFileVersion("2.3.8")] diff --git a/Counters+/UI/CountersPlusListTableCell.cs b/Counters+/UI/CountersPlusListTableCell.cs index d884270..9b63f80 100644 --- a/Counters+/UI/CountersPlusListTableCell.cs +++ b/Counters+/UI/CountersPlusListTableCell.cs @@ -13,7 +13,7 @@ public class CountersPlusListTableCell : CustomListTableData.CustomCellInfo [UIParams] private BSMLParserParams parserParams; - public CountersPlusListTableCell(int idx, string text, Sprite icon = null) : base(text, null, icon) + public CountersPlusListTableCell(int idx, string text, string subtext, Sprite icon = null) : base(text, subtext, icon) { CellIdx = idx; } @@ -22,10 +22,10 @@ public CountersPlusListTableCell(int idx, string text, Sprite icon = null) : bas private void Parsed() { var coverImages = parserParams.GetObjectsWithTag("coverImage").Select(x => x.GetComponent()); - foreach (var image in coverImages) image.sprite = icon; + foreach (var image in coverImages) image.sprite = Icon; var infoTexts = parserParams.GetObjectsWithTag("infoText").Select(x => x.GetComponent()); - foreach (var infoText in infoTexts) infoText.text = text; + foreach (var infoText in infoTexts) infoText.text = Text; } } } diff --git a/Counters+/UI/FlowCoordinators/CountersPlusSettingsFlowCoordinator.cs b/Counters+/UI/FlowCoordinators/CountersPlusSettingsFlowCoordinator.cs index bd3d479..93a9677 100644 --- a/Counters+/UI/FlowCoordinators/CountersPlusSettingsFlowCoordinator.cs +++ b/Counters+/UI/FlowCoordinators/CountersPlusSettingsFlowCoordinator.cs @@ -9,7 +9,6 @@ using UnityEngine; using VRUIControls; using Zenject; -using BeatSaber.Settings; using static CountersPlus.Utils.Accessors; namespace CountersPlus.UI.FlowCoordinators diff --git a/Counters+/UI/MenuButtonManager.cs b/Counters+/UI/MenuButtonManager.cs index 4a52d09..479c72f 100644 --- a/Counters+/UI/MenuButtonManager.cs +++ b/Counters+/UI/MenuButtonManager.cs @@ -17,7 +17,7 @@ internal class MenuButtonManager : IInitializable, IDisposable public void Initialize() { menuButton = new MenuButton("Counters+", "Configure Counters+ settings.", SummonFlowCoordinator); - MenuButtons.instance.RegisterButton(menuButton); + MenuButtons.Instance.RegisterButton(menuButton); } private void SummonFlowCoordinator() @@ -30,7 +30,7 @@ private void SummonFlowCoordinator() public void Dispose() { - MenuButtons.instance.UnregisterButton(menuButton); + MenuButtons.Instance.UnregisterButton(menuButton); } } } diff --git a/Counters+/UI/SettingGroups/CountersSettingsGroup.cs b/Counters+/UI/SettingGroups/CountersSettingsGroup.cs index 713ab82..2666906 100644 --- a/Counters+/UI/SettingGroups/CountersSettingsGroup.cs +++ b/Counters+/UI/SettingGroups/CountersSettingsGroup.cs @@ -17,35 +17,29 @@ public class CountersSettingsGroup : SettingsGroup public override CustomListTableData.CustomCellInfo CellInfoForIdx(int idx) { var model = flowCoordinator.Value.AllConfigModels[idx]; - var customCellInfo = new CountersPlusListTableCell(idx, model.DisplayName); - if (model is CustomConfigModel customConfig) { - customCellInfo.text = customConfig.AttachedCustomCounter.Name; if (customConfig.AttachedCustomCounter.BSML != null && !string.IsNullOrEmpty(customConfig.AttachedCustomCounter.BSML.Icon)) { try { - customCellInfo.icon = ImagesUtility.LoadSpriteFromExternalAssemblyResources( - customConfig.AttachedCustomCounter.CounterType.Assembly, customConfig.AttachedCustomCounter.BSML.Icon); + return new CountersPlusListTableCell(idx, customConfig.AttachedCustomCounter.Name, null, ImagesUtility.LoadSpriteFromExternalAssemblyResources( + customConfig.AttachedCustomCounter.CounterType.Assembly, customConfig.AttachedCustomCounter.BSML.Icon)); } catch { - customCellInfo.icon = LoadSprite("Counters.Custom"); - customCellInfo.subtext = "\n(Failed to load custom icon.)"; + return new CountersPlusListTableCell(idx, customConfig.AttachedCustomCounter.Name,"\n(Failed to load custom icon.)", LoadSprite("Counters.Custom")); } } else { - customCellInfo.icon = LoadSprite("Counters.Custom"); + return new CountersPlusListTableCell(idx, customConfig.AttachedCustomCounter.Name, null, LoadSprite("Counters.Custom")); } } else { - customCellInfo.icon = LoadSprite($"Counters.{model.DisplayName}"); + return new CountersPlusListTableCell(idx, model.DisplayName, null, LoadSprite($"Counters.{model.DisplayName}")); } - - return customCellInfo; } public override int NumberOfCells() => flowCoordinator.Value.AllConfigModels.Count; diff --git a/Counters+/UI/SettingGroups/HUDsSettingsGroup.cs b/Counters+/UI/SettingGroups/HUDsSettingsGroup.cs index b166dcb..baac20f 100644 --- a/Counters+/UI/SettingGroups/HUDsSettingsGroup.cs +++ b/Counters+/UI/SettingGroups/HUDsSettingsGroup.cs @@ -28,9 +28,9 @@ public override void OnDisable() public override CustomListTableData.CustomCellInfo CellInfoForIdx(int idx) => idx switch { - 0 => new CountersPlusListTableCell(idx, "Add new Canvas", LoadSprite("HUDs.Add")), - 1 => new CountersPlusListTableCell(idx, "Edit existing Canvases", LoadSprite("HUDs.Manage")), - 2 => new CountersPlusListTableCell(idx, "Remove a Canvas", LoadSprite("HUDs.Remove")), + 0 => new CountersPlusListTableCell(idx, "Add new Canvas", null, LoadSprite("HUDs.Add")), + 1 => new CountersPlusListTableCell(idx, "Edit existing Canvases", null, LoadSprite("HUDs.Manage")), + 2 => new CountersPlusListTableCell(idx, "Remove a Canvas", null, LoadSprite("HUDs.Remove")), _ => base.CellInfoForIdx(idx), }; diff --git a/Counters+/UI/SettingGroups/SettingsGroup.cs b/Counters+/UI/SettingGroups/SettingsGroup.cs index 775c66c..b0177b1 100644 --- a/Counters+/UI/SettingGroups/SettingsGroup.cs +++ b/Counters+/UI/SettingGroups/SettingsGroup.cs @@ -13,7 +13,7 @@ public abstract class SettingsGroup public abstract int NumberOfCells(); public virtual CustomListTableData.CustomCellInfo CellInfoForIdx(int idx) - => new CountersPlusListTableCell(idx, "Unimplemented", LoadSprite("MainSettings")); + => new CountersPlusListTableCell(idx, "Unimplemented", null, LoadSprite("MainSettings")); public abstract void OnCellSelect(TableView view, int idx); diff --git a/Counters+/UI/ViewControllers/CountersPlusBlankViewController.cs b/Counters+/UI/ViewControllers/CountersPlusBlankViewController.cs index 6619603..497996f 100644 --- a/Counters+/UI/ViewControllers/CountersPlusBlankViewController.cs +++ b/Counters+/UI/ViewControllers/CountersPlusBlankViewController.cs @@ -1,6 +1,5 @@ using BeatSaberMarkupLanguage.Attributes; using BeatSaberMarkupLanguage.ViewControllers; -using HMUI; using System.Collections; using UnityEngine; diff --git a/Counters+/UI/ViewControllers/CountersPlusHUDListViewController.cs b/Counters+/UI/ViewControllers/CountersPlusHUDListViewController.cs index e0d0de9..6a4761f 100644 --- a/Counters+/UI/ViewControllers/CountersPlusHUDListViewController.cs +++ b/Counters+/UI/ViewControllers/CountersPlusHUDListViewController.cs @@ -49,7 +49,7 @@ protected override void DidDeactivate(bool removedFromHierarchy, bool screenSyst public void RefreshData() { - data.data.Clear(); + data.Data.Clear(); for (int i = -1; i < hudConfig.OtherCanvasSettings.Count; i++) { HUDCanvas settings = canvasUtility.GetCanvasSettingsFromID(i); @@ -57,21 +57,21 @@ public void RefreshData() var info = new CustomListTableData.CustomCellInfo( settings?.Name ?? "Unknown", $"{countersUsingCanvas} counter(s) use this Canvas.", Utilities.LoadSpriteFromTexture(Texture2D.blackTexture)); - data.data.Add(info); + data.Data.Add(info); } - data.tableView.ReloadData(); + data.TableView.ReloadData(); } public void CreateNewCanvasDialog() { flowCoordinator.Value.SetRightViewController(null); DeactivateModals(); - newCanvasKeyboard.modalView.Show(true); + newCanvasKeyboard.ModalView.Show(true); } public void DeactivateModals() => parserParams.EmitEvent("on-deactivate"); - public void ClearSelection() => data.tableView.ClearSelection(); + public void ClearSelection() => data.TableView.ClearSelection(); [UIAction("cell-selected")] private void CellSelected (TableView view, int idx) diff --git a/Counters+/UI/ViewControllers/CountersPlusSettingSectionSelectionViewController.cs b/Counters+/UI/ViewControllers/CountersPlusSettingSectionSelectionViewController.cs index 23e6357..b70b63d 100644 --- a/Counters+/UI/ViewControllers/CountersPlusSettingSectionSelectionViewController.cs +++ b/Counters+/UI/ViewControllers/CountersPlusSettingSectionSelectionViewController.cs @@ -29,7 +29,7 @@ protected override void DidActivate(bool firstActivation, bool addedToHierarchy, { base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling); - scrollView = tableList.tableView.GetField("_scrollView"); + scrollView = tableList.TableView.GetField("_scrollView"); scrollView.scrollPositionChangedEvent += ScrollView_scrollPositionChangedEvent; HandleCellSelectedEvent(null, (selectedGroup != null) ? loadedSettingsGroups.IndexOf(selectedGroup) : 0); @@ -76,21 +76,21 @@ private void HandleCellSelectedEvent(SegmentedControl _, int cellIdx) selectedGroup.OnEnable(); - tableList.data.Clear(); + tableList.Data.Clear(); - tableList.cellSize = selectedGroup.GetSize(); + tableList.CellSizeValue = selectedGroup.GetSize(); CustomListTableData.CustomCellInfo[] items = new CustomListTableData.CustomCellInfo[selectedGroup.NumberOfCells()]; for (var i = 0; i < selectedGroup.NumberOfCells(); i++) { items[i] = selectedGroup.CellInfoForIdx(i); } - tableList.data = items; + tableList.Data = items; - tableList.tableView.ReloadData(); + tableList.TableView.ReloadData(); - tableList.tableView.ScrollToCellWithIdx(0, TableView.ScrollPositionType.Beginning, false); - tableList.tableView.SelectCellWithIdx(selectedGroup.CellToSelect(), false); + tableList.TableView.ScrollToCellWithIdx(0, TableView.ScrollPositionType.Beginning, false); + tableList.TableView.SelectCellWithIdx(selectedGroup.CellToSelect(), false); ScrollView_scrollPositionChangedEvent(0f); } diff --git a/Counters+/UI/ViewControllers/Editing/CountersPlusCounterEditViewController.cs b/Counters+/UI/ViewControllers/Editing/CountersPlusCounterEditViewController.cs index 1fc995f..1fee1fb 100644 --- a/Counters+/UI/ViewControllers/Editing/CountersPlusCounterEditViewController.cs +++ b/Counters+/UI/ViewControllers/Editing/CountersPlusCounterEditViewController.cs @@ -67,7 +67,7 @@ internal void ApplySettings(ConfigModel model) else { // Loading settings base - var settingsBaseParams = BSMLParser.instance.Parse(SettingsBase, settingsContainer, model); + var settingsBaseParams = BSMLParser.Instance.Parse(SettingsBase, settingsContainer, model); var multiplayerWarning = settingsBaseParams.GetObjectsWithTag("multiplayer-warning")[0]; // Only show multiplayer warning if this is a Custom Counter that is not enabled in multiplayer @@ -77,7 +77,7 @@ internal void ApplySettings(ConfigModel model) { string resourceLocation = $"CountersPlus.UI.BSML.Config.{model.DisplayName}.bsml"; string resourceContent = Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), resourceLocation); - BSMLParser.instance.Parse(resourceContent, settingsContainer, model); + BSMLParser.Instance.Parse(resourceContent, settingsContainer, model); // All base Counters+ counters are (or should be) multiplayer ready. multiplayerWarning.SetActive(false); @@ -96,7 +96,7 @@ internal void ApplySettings(ConfigModel model) { host = diContainer.TryResolveId(customCounter.BSML.HostType, customCounter.Name); } - BSMLParser.instance.Parse(resourceContent, settingsContainer, host); + BSMLParser.Instance.Parse(resourceContent, settingsContainer, host); } // Show multiplayer warning if the custom counter is not multiplayer ready. diff --git a/Counters+/UI/ViewControllers/Editing/CountersPlusHUDEditViewController.cs b/Counters+/UI/ViewControllers/Editing/CountersPlusHUDEditViewController.cs index c6aea5b..ba4a376 100644 --- a/Counters+/UI/ViewControllers/Editing/CountersPlusHUDEditViewController.cs +++ b/Counters+/UI/ViewControllers/Editing/CountersPlusHUDEditViewController.cs @@ -39,12 +39,12 @@ public void ApplyCanvasForEditing(int id) currentlyEditing.OnCanvasSettingsApply -= CurrentlyEditing_OnCanvasSettingsApply; } ClearScreen(); - var param = BSMLParser.instance.Parse(SettingsBase, gameObject, settings); + var param = BSMLParser.Instance.Parse(SettingsBase, gameObject, settings); currentlyEditing = settings; currentlyEditing.OnCanvasSettingsChanged += CurrentlyEditing_OnCanvasSettingsChanged; currentlyEditing.OnCanvasSettingsApply += CurrentlyEditing_OnCanvasSettingsApply; StringSetting nameFieldSetting = param.GetObjectsWithTag("name-field").First().GetComponent(); - nameFieldSetting.interactable = !(currentlyEditing?.IsMainCanvas ?? true); + nameFieldSetting.Interactable = !(currentlyEditing?.IsMainCanvas ?? true); } private void CurrentlyEditing_OnCanvasSettingsApply() diff --git a/Counters+/UI/ViewControllers/Editing/CountersPlusMainSettingsEditViewController.cs b/Counters+/UI/ViewControllers/Editing/CountersPlusMainSettingsEditViewController.cs index 11cadd4..73f72fb 100644 --- a/Counters+/UI/ViewControllers/Editing/CountersPlusMainSettingsEditViewController.cs +++ b/Counters+/UI/ViewControllers/Editing/CountersPlusMainSettingsEditViewController.cs @@ -17,7 +17,7 @@ public class CountersPlusMainSettingsEditViewController : ViewController protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { base.DidActivate(firstActivation, addedToHierarchy, screenSystemEnabling); - if (firstActivation) BSMLParser.instance.Parse(SettingsBase, gameObject, mainConfig); + if (firstActivation) BSMLParser.Instance.Parse(SettingsBase, gameObject, mainConfig); mainConfig.OnConfigChanged += MainConfig_OnConfigChanged; } diff --git a/Counters+/manifest.json b/Counters+/manifest.json index 5921703..593faf9 100644 --- a/Counters+/manifest.json +++ b/Counters+/manifest.json @@ -6,7 +6,7 @@ "version": "2.3.8", "description": "A suite of enhancements for Beat Saber's UI.", "icon": "CountersPlus.UI.Images.Logo.png", - "gameVersion": "1.37.3", + "gameVersion": "1.37.5", "dependsOn": { "BSIPA": "^4.3.5", "BeatSaberMarkupLanguage": "^1.11.4",