diff --git a/CommunityBugFixCollection/CommunityBugFixCollection.csproj b/CommunityBugFixCollection/CommunityBugFixCollection.csproj index ada1f95..1be2d96 100644 --- a/CommunityBugFixCollection/CommunityBugFixCollection.csproj +++ b/CommunityBugFixCollection/CommunityBugFixCollection.csproj @@ -34,8 +34,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -43,9 +42,9 @@ - + - + diff --git a/CommunityBugFixCollection/CopySyncMemberToClipboardAction.cs b/CommunityBugFixCollection/CopySyncMemberToClipboardAction.cs new file mode 100644 index 0000000..c54de92 --- /dev/null +++ b/CommunityBugFixCollection/CopySyncMemberToClipboardAction.cs @@ -0,0 +1,35 @@ +using FrooxEngine; +using MonkeyLoader.Resonite; +using MonkeyLoader.Resonite.UI.Inspectors; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace CommunityBugFixCollection +{ + internal sealed class CopySyncMemberToClipboardAction + : ResoniteAsyncEventHandlerMonkey + { + public override int Priority => HarmonyLib.Priority.Normal; + + protected override bool AppliesTo(InspectorMemberActionsMenuItemsGenerationEvent eventData) + => base.AppliesTo(eventData) && eventData.Target is IField && eventData.Target is not ISyncRef; + + protected override Task Handle(InspectorMemberActionsMenuItemsGenerationEvent eventData) + { + var field = (IField)eventData.Target; + var menuItem = eventData.ContextMenu.AddItem(Mod.GetLocaleString("CopyToClipboard"), + OfficialAssets.Graphics.Icons.General.Duplicate, RadiantUI_Constants.Sub.GREEN); + + // Context Menu is local user only anyways, no need to use local action button + menuItem.Button.LocalPressed += (button, _) => + { + button.World.InputInterface.Clipboard.SetText(field.BoxedValue.ToString()); + button.World.LocalUser.CloseContextMenu(eventData.MemberActions); + }; + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/CommunityBugFixCollection/Locale/de.json b/CommunityBugFixCollection/Locale/de.json index 3c91009..b2dd72c 100644 --- a/CommunityBugFixCollection/Locale/de.json +++ b/CommunityBugFixCollection/Locale/de.json @@ -3,6 +3,8 @@ "authors": [ "Banane9" ], "messages": { "CommunityBugFixCollection.Name": "Community Bug-Fix Sammlung", - "CommunityBugFixCollection.Description": "Diese Mod enthällt Fixes für verschiedene kleine Resonite Issues die noch offen sind." + "CommunityBugFixCollection.Description": "Diese Mod enthällt Fixes für verschiedene kleine Resonite Issues die noch offen sind.", + + "CommunityBugFixCollection.CopyToClipboard": "In Zwischenablage kopieren" } } \ No newline at end of file diff --git a/CommunityBugFixCollection/Locale/en.json b/CommunityBugFixCollection/Locale/en.json index 2642c24..791a5d9 100644 --- a/CommunityBugFixCollection/Locale/en.json +++ b/CommunityBugFixCollection/Locale/en.json @@ -5,6 +5,8 @@ "CommunityBugFixCollection.Name": "Community Bug-Fix Collection", "CommunityBugFixCollection.Description": "This mod contains fixes for various small Resonite Issues that are still open.", + "CommunityBugFixCollection.CopyToClipboard": "Copy to Clipboard", + "CommunityBugFixCollection.NoZeroScaleToolRaycast": "Fixes Resonite Issue #98: World crashes when a (multi)tool is scaled to zero." } } \ No newline at end of file diff --git a/README.md b/README.md index af9b3d5..fa402b8 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,13 @@ The issues that have workarounds in this mod will be linked in the following lis If any of them have been closed and not removed from the mod, just disable them in the settings in the meantime. -* Sliders and Joints snapping in sessions hosted by a headless (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/399) \ No newline at end of file +* Sliders and Joints snapping in sessions hosted by a headless (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/399) + + +## Features + +The feature request issues that have been implemented in this mod will be linked in the following list. +If any of them have been implemented and not removed from the mod, +just disable them in the settings in the meantime. + +* _Copy to Clipboard_ action on any non-reference member fields in Inspectors (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/810) \ No newline at end of file