Gamecraft-Discord connection. It can send and receive messages in a specific channel.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

43 wiersze
1.3KB

  1. using System;
  2. using System.Reflection;
  3. using Gamecraft.Blocks.ConsoleBlock;
  4. using HarmonyLib;
  5. using RobocraftX;
  6. using RobocraftX.GUI.CommandLine;
  7. using RobocraftX.Multiplayer;
  8. using RobocraftX.Services.MultiplayerNetworking;
  9. using RobocraftX.StateSync;
  10. using Svelto.ECS;
  11. using Unity.Entities;
  12. using UnityEngine;
  13. namespace GCDC
  14. {
  15. [HarmonyPatch]
  16. public class DiscordEngineInjectionPatch
  17. {
  18. static void Postfix(EnginesRoot enginesRoot, in StateSyncRegistrationHelper stateSyncReg, bool isAuthoritative)
  19. {
  20. if (isAuthoritative)
  21. {
  22. stateSyncReg.AddDeterministicEngine(new TextBlockUpdateEngine());
  23. Debug.Log($"Added Discord text block update engine");
  24. }
  25. else
  26. Debug.Log("Not authoritative, not adding Discord engine");
  27. }
  28. static MethodBase TargetMethod()
  29. {
  30. return _ComposeMethodInfo(ConsoleBlockCompositionRoot.Compose);
  31. }
  32. private delegate void ComposeAction(EnginesRoot er, in StateSyncRegistrationHelper ssrh,
  33. NetworkReceivers networkReceivers, NetworkSender networkSende, bool isAuthoritative);
  34. private static MethodInfo _ComposeMethodInfo(ComposeAction a)
  35. {
  36. return a.Method;
  37. }
  38. }
  39. }