SoloFunc.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 SoloFunc : BotRunner.RunnerModule
  12. {
  13. public SoloFunc() {
  14. module_name = "问道大会";
  15. }
  16. public SoloFunc(BotRunner r) : base(r)
  17. {
  18. }
  19. protected internal override void OnGateBindPlayer(BindPlayerResponse e)
  20. {
  21. base.OnGateBindPlayer(e);
  22. }
  23. protected override int rand()
  24. {
  25. return Config.RandNum;
  26. }
  27. protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  28. {
  29. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  30. {
  31. if (IsCanJoin)
  32. {
  33. joinSoloRequest();
  34. }
  35. });
  36. }
  37. private void joinSoloRequest()
  38. {
  39. client.GameSocket.soloHandler.joinSoloRequest(
  40. (err, rsp) =>
  41. { });
  42. }
  43. [Desc("问道大会配置")]
  44. [Expandable]
  45. public class Config : ConfigBase
  46. {
  47. [Desc("问道大会检测间隔")]
  48. public static int CheckIntervalMS = 5000;
  49. [Desc("问道大会随机数")]
  50. public static int RandNum = 5;
  51. public override string ToString()
  52. {
  53. return "问道大会配置";
  54. }
  55. public override void popG2DPropertyDialog()
  56. {
  57. CommonFroms.G2D.G2DPropertyDialog<SoloFunc.Config>.Show("修改配置", this);
  58. }
  59. }
  60. }
  61. }