AutoHookFunc.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using pomelo.connector;
  7. using CommonLang.Property;
  8. using pomelo.area;
  9. namespace XmdsBotTest.Runner
  10. {
  11. public class AutoHookFunc : BotRunner.RunnerModule
  12. {
  13. public AutoHookFunc()
  14. {
  15. module_name = "自动挂机";
  16. }
  17. public AutoHookFunc(BotRunner r) : base(r)
  18. {
  19. }
  20. protected internal override void OnGateBindPlayer(BindPlayerResponse e)
  21. {
  22. base.OnGateBindPlayer(e);
  23. }
  24. protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  25. {
  26. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  27. {
  28. autoHook();
  29. });
  30. }
  31. /// <summary>
  32. /// 自动挂机
  33. /// </summary>
  34. private void autoHook()
  35. {
  36. if (Enable)
  37. {
  38. bot.SendUnitGuard(true);
  39. }
  40. }
  41. [Desc("自动挂机配置")]
  42. [Expandable]
  43. public class Config : ConfigBase
  44. {
  45. [Desc("自动挂机检测间隔")]
  46. public static int CheckIntervalMS = 10000;
  47. public override string ToString()
  48. {
  49. return "自动挂机配置";
  50. }
  51. public override void popG2DPropertyDialog()
  52. {
  53. CommonFroms.G2D.G2DPropertyDialog<AutoHookFunc.Config>.Show("修改配置", this);
  54. }
  55. }
  56. }
  57. }