A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Reflection;
  7. using Analytics;
  8. using Harmony;
  9. using RobocraftX.Common;
  10. using Svelto.ECS;
  11. namespace GamecraftModdingAPI.Utility
  12. {
  13. /// <summary>
  14. /// Patch of Analytics.AnalyticsCompositionRoot.Compose<T>(...)
  15. /// This stops some analytics collection built into Gamecraft.
  16. /// DO NOT USE! (This will likely crash your game on shutdown)
  17. /// </summary>
  18. [HarmonyPatch]
  19. class AnalyticsDisablerPatch
  20. {
  21. /// <summary>
  22. /// Don't activate gameplay analytics?
  23. /// </summary>
  24. public static bool DisableAnalytics = false;
  25. public static bool Prefix(object contextHolder, EnginesRoot enginesRoot, RCXMode rcxMode)
  26. {
  27. return !DisableAnalytics;
  28. }
  29. public static MethodBase TargetMethod(HarmonyInstance instance)
  30. {
  31. return typeof(Analytics.AnalyticsCompositionRoot).GetMethod("Compose").MakeGenericMethod(typeof(object));
  32. }
  33. }
  34. }