1-
21using System ;
3-
42using Elements . Core ;
53using FrooxEngine ;
64using HarmonyLib ;
@@ -13,39 +11,38 @@ public class ResoniteFish : ResoniteMod {
1311 public override string Author => "Delta & Raidriar" ;
1412 public override string Version => VERSION_CONSTANT ;
1513 public override string Link => "https://github.com/XDelta/ResoniteFish" ;
16- public static ModConfiguration ? Config ;
1714
18- [ AutoRegisterConfigKey ] public static readonly ModConfigurationKey < bool > FishSound =
19- new ModConfigurationKey < bool > ( "FishSound" , "Enable Sounds" , ( ) => false ) ;
15+ [ AutoRegisterConfigKey ]
16+ public static readonly ModConfigurationKey < bool > FishSound = new ( "FishSound" , "Enable Sounds" , ( ) => false ) ;
17+
18+ public static ModConfiguration ? Config ;
2019
2120 public override void OnEngineInit ( ) {
2221 Harmony harmony = new ( "net.deltawolf.Fish" ) ;
2322 harmony . PatchAll ( ) ;
2423 Config = GetConfiguration ( ) ! ;
25- Config ! . Save ( true ) ;
24+ Config ! . Save ( true ) ;
2625 }
2726
2827 [ HarmonyPatch ( typeof ( InteractionHandler ) , "OpenContextMenu" ) ]
29- private class ContextMenuOpenMenuAPatch {
28+ private class ContextMenuOpenMenuPatch {
3029 public static void Postfix ( InteractionHandler __instance , InteractionHandler . MenuOptions options ) {
3130 ContextMenu ctx = __instance . ContextMenu ;
3231 if ( options == InteractionHandler . MenuOptions . Default ) {
33- var Button = ctx . AddItem ( "Fish" , new Uri ( "resdb:///5a56714e4cc021888cb51162cc34b55a7a1333fe8bc162c8be906f9345206b3c.png" ) , colorX . Cyan ) ;
32+ ContextMenuItem Button = ctx . AddItem ( "Fish" , new Uri ( "resdb:///5a56714e4cc021888cb51162cc34b55a7a1333fe8bc162c8be906f9345206b3c.png" ) , colorX . Cyan ) ;
3433
3534 if ( Config ! . GetValue ( FishSound ) == true ) {
36- var MenuSlot = Button . Slot ;
37-
38- var StaticAudio = MenuSlot . AttachComponent < StaticAudioClip > ( ) ;
39- StaticAudio . URL . Value = new Uri ( "resdb:///1ed74a85e7d9a8e2456fadbd276cb9dd223ad96377ad230409693d408524606e.wav" ) ;
35+ Slot MenuSlot = Button . Slot ;
36+ var StaticAudio = MenuSlot . AttachAudioClip ( new Uri ( "resdb:///1ed74a85e7d9a8e2456fadbd276cb9dd223ad96377ad230409693d408524606e.wav" ) ) ;
4037
4138 var ClipPlayer = MenuSlot . AttachComponent < RandomAudioClipPlayer > ( ) ;
4239 ClipPlayer . Clips . Add ( ) ;
4340 ClipPlayer . Clips . GetElement ( 0 ) . Clip . Target = StaticAudio ;
44-
41+
4542 var Trigger = MenuSlot . AttachComponent < ButtonActionTrigger > ( ) ;
4643 Trigger . OnPressed . Target = ClipPlayer . Play ;
4744 }
4845 }
4946 }
5047 }
51- }
48+ }
0 commit comments