File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using FrooxEngine ;
2+ using MonkeyLoader . Resonite ;
3+ using System ;
4+ using System . Collections . Generic ;
5+ using System . Text ;
6+ using System . Threading . Tasks ;
7+
8+ namespace CommunityBugFixCollection
9+ {
10+ internal sealed class CopySyncMemberToClipboardAction
11+ : ResoniteAsyncEventHandlerMonkey < CopySyncMemberToClipboardAction , InspectorMemberActionsMenuItemsGenerationEvent >
12+ {
13+ public override int Priority => HarmonyLib . Priority . Normal ;
14+
15+ protected override bool AppliesTo ( InspectorMemberActionsMenuItemsGenerationEvent eventData )
16+ => base . AppliesTo ( eventData ) && eventData . Target is IField ;
17+
18+ protected override Task Handle ( InspectorMemberActionsMenuItemsGenerationEvent eventData )
19+ {
20+ var field = ( IField ) eventData . Target ;
21+ var menuItem = eventData . ContextMenu . AddItem ( "Copy to Clipboard" ,
22+ OfficialAssets . Graphics . Icons . General . Duplicate , RadiantUI_Constants . Sub . GREEN ) ;
23+
24+ menuItem . Button . LocalPressed += ( button , _ ) =>
25+ {
26+ button . World . InputInterface . Clipboard . SetText ( field . BoxedValue . ToString ( ) ) ;
27+ button . World . LocalUser . CloseContextMenu ( eventData . MemberActions ) ;
28+ } ;
29+
30+ return Task . CompletedTask ;
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments