diff --git a/Directory.Build.props b/Directory.Build.props index 18be00b..319dfaa 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ Library net462 $(AssemblyTitle).dll - 11.0 + 12.0 enable true True diff --git a/WikiIntegration.ComponentSelectorCompatibility/CategoryWikiArticleButtons.cs b/WikiIntegration.ComponentSelectorCompatibility/CategoryWikiArticleButtons.cs index 003f718..9046b4c 100644 --- a/WikiIntegration.ComponentSelectorCompatibility/CategoryWikiArticleButtons.cs +++ b/WikiIntegration.ComponentSelectorCompatibility/CategoryWikiArticleButtons.cs @@ -7,6 +7,7 @@ using MonkeyLoader.Resonite.UI; using MonkeyLoader.Resonite.Configuration; using ComponentSelectorAdditions; +using System.Collections.Generic; namespace WikiIntegration { @@ -17,6 +18,8 @@ internal sealed class CategoryWikiArticleButtons : ResoniteEventHandlerMonkey _componentLocale = new(() => Mod.GetLocaleString("WikiHyperlink.ComponentCategory")); private static readonly Lazy _protoFluxLocale = new(() => Mod.GetLocaleString("WikiHyperlink.ProtoFluxCategory")); + public override IEnumerable Authors { get; } = ["Banane9"]; + public override int Priority => HarmonyLib.Priority.Normal; private static LocaleString ComponentLocale => _componentLocale.Value; @@ -36,6 +39,8 @@ protected override void Handle(PostProcessButtonsEvent eventData) var path = button.Slot.GetComponent>().Argument.Value; // more generalized check instead of: path.EndsWith("Favorites") || path.EndsWith("Recents")) + // presuming that all non-user excluded categories are ones added by mods + // which won't have a wiki article to link to anyways if (SearchConfig.Instance.HasExcludedCategory(path, out var isUserCategory) && !isUserCategory.Value) continue; diff --git a/WikiIntegration.ComponentSelectorCompatibility/WikiIntegration.ComponentSelectorCompatibility.csproj b/WikiIntegration.ComponentSelectorCompatibility/WikiIntegration.ComponentSelectorCompatibility.csproj index 1f51729..2bbf657 100644 --- a/WikiIntegration.ComponentSelectorCompatibility/WikiIntegration.ComponentSelectorCompatibility.csproj +++ b/WikiIntegration.ComponentSelectorCompatibility/WikiIntegration.ComponentSelectorCompatibility.csproj @@ -11,8 +11,8 @@ True WikiIntegration Wiki Integration - Banane9 - 0.5.0-beta + Banane9; E1int + 0.6.0-beta This MonkeyLoader mod for Resonite that adds links to the Wiki to Components in Worker Inspectors, and ProtoFlux nodes. README.md LGPL-3.0-or-later diff --git a/WikiIntegration/OpenWikiArticleButton.cs b/WikiIntegration/OpenWikiArticleButton.cs index e5bdd5b..0c7094b 100644 --- a/WikiIntegration/OpenWikiArticleButton.cs +++ b/WikiIntegration/OpenWikiArticleButton.cs @@ -3,7 +3,6 @@ using FrooxEngine.ProtoFlux; using FrooxEngine.UIX; using HarmonyLib; -using MonkeyLoader.Components; using MonkeyLoader.Configuration; using MonkeyLoader.Events; using MonkeyLoader.Resonite; @@ -30,12 +29,20 @@ internal sealed class OpenWikiArticleButton : ConfiguredResoniteInspectorMonkey< IAsyncEventHandler { private static readonly Lazy _componentLocale = new(() => Mod.GetLocaleString("WikiHyperlink.Component")); + + private static readonly Dictionary _nameOverrides = new() { + {"dT", "Delta_Time"}, + {"ObjectCast", "Object_Cast"}, + {"ValueCast", "Value_Cast"} + }; + private static readonly Lazy _protoFluxLocale = new(() => Mod.GetLocaleString("WikiHyperlink.ProtoFlux")); + private static ProtoFluxCategoryConfig _categoryConfig = null!; + public override int Priority => HarmonyLib.Priority.HigherThanNormal; private static LocaleString ComponentLocale => _componentLocale.Value; - private static LocaleString ProtoFluxLocale => _protoFluxLocale.Value; public Task Handle(FallbackLocaleGenerationEvent eventData) @@ -104,6 +111,9 @@ private static void AddHyperlink(Slot slot, Worker worker) nodeName = dotIndex > 0 ? overload[(dotIndex + 1)..] : nodeName; } + if (_nameOverrides.TryGetValue(nodeName, out var overrideName)) + nodeName = overrideName; + wikiPage = $"ProtoFlux:{nodeName.Replace(' ', '_')}"; } else