PrepaidOrderIdWarn.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 PrepaidOrderIdWarn : BotRunner.RunnerModule
  12. {
  13. public PrepaidOrderIdWarn() {
  14. module_name = "充值生成订";
  15. }
  16. public PrepaidOrderIdWarn(BotRunner r) : base(r)
  17. {
  18. }
  19. protected internal override void OnGateBindPlayer(BindPlayerResponse e)
  20. {
  21. base.OnGateBindPlayer(e);
  22. }
  23. protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  24. {
  25. layer.AddTimeDelayMS(Config.CheckIntervalMS, (t) =>
  26. {
  27. if (Enable)
  28. {
  29. }
  30. });
  31. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  32. {
  33. if (Enable)
  34. {
  35. prepaidOrderIdRequest();
  36. }
  37. });
  38. }
  39. private void prepaidOrderIdRequest()
  40. {
  41. client.GameSocket.prepaidHandler.prepaidOrderIdRequest(Config.c2s_productId, 0 , "" , 0,
  42. (err, rsp) =>
  43. {
  44. if (null != rsp && 200 == rsp.s2c_code) {
  45. Console.WriteLine("OrderId: {0}", rsp.s2c_orderId);
  46. runner.do_gm_pay_success(rsp.s2c_orderId);
  47. }
  48. });
  49. }
  50. [Desc("充值生成订单配置")]
  51. [Expandable]
  52. public class Config : ConfigBase
  53. {
  54. [Desc("充值生成订单检测间隔")]
  55. public static int CheckIntervalMS = 60*1000;
  56. public static int c2s_productId = 1; // 充值档
  57. public static int c2s_type = 0; // 1 表示买卡 2 表示买元宝
  58. public override string ToString()
  59. {
  60. return "充值生成订单配置";
  61. }
  62. public override void popG2DPropertyDialog()
  63. {
  64. CommonFroms.G2D.G2DPropertyDialog<PrepaidOrderIdWarn.Config>.Show("修改配置", this);
  65. }
  66. }
  67. }
  68. }