diff --git a/BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs b/BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs index d18a76ec..8c563249 100644 --- a/BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs +++ b/BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs @@ -73,7 +73,7 @@ namespace BSIPA_ModList.UI titleText.fontSize = 6f; authorText = BeatSaberUI.CreateText(rectTransform, controller.Author, new Vector2(11f, 22f)); authorText.fontSize = 4.5f; - descText = BeatSaberUI.CreateText(rectTransform, controller.Description, new Vector2(-4.5f, 12.5f)); + descText = BeatSaberUI.CreateText(rectTransform, controller.Description, new Vector2(-4.5f, 12f)); descText.enableWordWrapping = true; descText.overflowMode = TextOverflowModes.ScrollRect; @@ -141,7 +141,7 @@ namespace BSIPA_ModList.UI Logger.log.Debug($"Position now at {rt.anchoredPosition}"); #endif - +#if ADJUST_INFO_ICON_UI_KEYS var rt = icon.rectTransform; if (Input.GetKey(KeyCode.Z)) { // adjust anchormin @@ -215,9 +215,8 @@ namespace BSIPA_ModList.UI Logger.log.Debug($"Position now at {rt.anchoredPosition}"); } - - +#endif } #endif - } + } } diff --git a/BSIPA-ModList/UI/ViewControllers/ModListController.cs b/BSIPA-ModList/UI/ViewControllers/ModListController.cs index 806399f9..48a056dd 100644 --- a/BSIPA-ModList/UI/ViewControllers/ModListController.cs +++ b/BSIPA-ModList/UI/ViewControllers/ModListController.cs @@ -42,6 +42,9 @@ namespace BSIPA_ModList.UI Plugin = plugin; this.list = list; + if (string.IsNullOrWhiteSpace(subtext)) + subtext = "Unspecified Author"; + if (plugin.Metadata.Manifest.IconPath != null) icon = UIUtilities.LoadSpriteRaw(UIUtilities.GetResource(plugin.Metadata.Assembly, plugin.Metadata.Manifest.IconPath)); else @@ -58,9 +61,13 @@ namespace BSIPA_ModList.UI if (infoView == null) { + var desc = Plugin.Metadata.Manifest.Description; + if (string.IsNullOrWhiteSpace(desc)) + desc = "No description"; + infoView = BeatSaberUI.CreateViewController(); - infoView.Init(icon, Plugin.Metadata.Name, "v" + Plugin.Metadata.Version.ToString(), Plugin.Metadata.Manifest.Author, - Plugin.Metadata.Manifest.Description, Plugin.Metadata.Features.FirstOrDefault(f => f is NoUpdateFeature) == null); + infoView.Init(icon, Plugin.Metadata.Name, "v" + Plugin.Metadata.Version.ToString(), subtext, + desc, Plugin.Metadata.Features.FirstOrDefault(f => f is NoUpdateFeature) == null); } list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); @@ -72,20 +79,43 @@ namespace BSIPA_ModList.UI internal PluginLoader.PluginMetadata Plugin; private ModListController list; + private const string authorFormat = "{0} - Not loaded"; + + private string authorText; + public BSIPAIgnoredModCell(ModListController list, PluginLoader.PluginMetadata plugin) - : base($"{plugin.Name} v{plugin.Version}", $"{plugin.Manifest.Author} - Not loaded", BSIPAModCell.DefaultIcon) + : base($"{plugin.Name} v{plugin.Version}", "", BSIPAModCell.DefaultIcon) { Plugin = plugin; this.list = list; + if (string.IsNullOrWhiteSpace(plugin.Manifest.Author)) + authorText = "Unspecified Author"; + else + authorText = plugin.Manifest.Author; + subtext = string.Format(authorFormat, authorText); + Logger.log.Debug($"BSIPAIgnoredModCell {plugin.Name} {plugin.Version}"); } + private ModInfoViewController infoView; + public void OnSelect(ModListController cntrl) { Logger.log.Debug($"Selected BSIPAIgnoredModCell {Plugin.Name} {Plugin.Version}"); - list.flow.ClearSelected(); + if (infoView == null) + { + var desc = Plugin.Manifest.Description; + if (string.IsNullOrWhiteSpace(desc)) + desc = "No description"; + + infoView = BeatSaberUI.CreateViewController(); + infoView.Init(icon, Plugin.Name, "v" + Plugin.Version.ToString(), authorText, + desc, Plugin.Features.FirstOrDefault(f => f is NoUpdateFeature) == null); + } + + list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); } } @@ -115,11 +145,21 @@ namespace BSIPA_ModList.UI Logger.log.Debug($"IPAModCell {plugin.Name} {plugin.Version}"); } + private ModInfoViewController infoView; + public void OnSelect(ModListController cntrl) { Logger.log.Debug($"Selected IPAModCell {Plugin.Name} {Plugin.Version}"); - list.flow.ClearSelected(); + if (infoView == null) + { + infoView = BeatSaberUI.CreateViewController(); + infoView.Init(icon, Plugin.Name, "v" + Plugin.Version.ToString(), "Unknown Author", + "This mod was written for IPA Reloaded. No metadata is avaliable for this mod. " + + "Please contact the mod author and ask them to port it to BSIPA to provide more information.", false); + } + + list.flow.SetSelected(infoView, immediate: list.flow.HasSelected); } } #pragma warning restore