FuwaHandler.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*-----------------------------------------------
  2. *本文件由代码生成器自动生成,
  3. *千万不要修改本文件的任何代码,
  4. *修改的的任何代码都会被覆盖掉!
  5. --------------------------------------------------*/
  6. using System.IO;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using Pomelo.DotNetClient;
  12. namespace pomelo.area
  13. {
  14. public class FuwaHandler
  15. {
  16. private PomeloClient _socket;
  17. public FuwaExchangeRespone lastFuwaExchangeRespone { get { return _socket.GetLastResponse<FuwaExchangeRespone>(); } }
  18. public FuwaGameInfoRespone lastFuwaGameInfoRespone { get { return _socket.GetLastResponse<FuwaGameInfoRespone>(); } }
  19. public FuwaGameRespone lastFuwaGameRespone { get { return _socket.GetLastResponse<FuwaGameRespone>(); } }
  20. public FuwaRewardExchangeInfoRespone lastFuwaRewardExchangeInfoRespone { get { return _socket.GetLastResponse<FuwaRewardExchangeInfoRespone>(); } }
  21. public FuwaRewardExchangeRespone lastFuwaRewardExchangeRespone { get { return _socket.GetLastResponse<FuwaRewardExchangeRespone>(); } }
  22. static FuwaHandler()
  23. {
  24. EventTypes.RegistPushType("area.fuwaPush.fuwaFindPush", typeof(FuwaFindPush));
  25. EventTypes.RegistRequestType("area.fuwaHandler.fuwaExchangeRequest", typeof(FuwaExchangeRequest), typeof(FuwaExchangeRespone));
  26. EventTypes.RegistRequestType("area.fuwaHandler.fuwaGameInfoRequest", typeof(FuwaGameInfoRequest), typeof(FuwaGameInfoRespone));
  27. EventTypes.RegistRequestType("area.fuwaHandler.fuwaGameRequest", typeof(FuwaGameRequest), typeof(FuwaGameRespone));
  28. EventTypes.RegistRequestType("area.fuwaHandler.fuwaRewardExchangeInfoRequest", typeof(FuwaRewardExchangeInfoRequest), typeof(FuwaRewardExchangeInfoRespone));
  29. EventTypes.RegistRequestType("area.fuwaHandler.fuwaRewardExchangeRequest", typeof(FuwaRewardExchangeRequest), typeof(FuwaRewardExchangeRespone));
  30. }
  31. public FuwaHandler(PomeloClient socket)
  32. {
  33. this._socket = socket;
  34. }
  35. public void fuwaExchangeRequest(string code,int count,Action<PomeloException,FuwaExchangeRespone> cb,object option = null)
  36. {
  37. var request = new FuwaExchangeRequest();
  38. request.code= code;
  39. request.count= count;
  40. _socket.request<FuwaExchangeRespone>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  41. var rsp = msg as FuwaExchangeRespone;
  42. s2c_code = rsp.s2c_code;
  43. s2c_msg = rsp.s2c_msg;
  44. return s2c_code == 200;
  45. }, cb, option);
  46. }
  47. public void fuwaGameInfoRequest(Action<PomeloException,FuwaGameInfoRespone> cb,object option = null)
  48. {
  49. var request = new FuwaGameInfoRequest();
  50. _socket.request<FuwaGameInfoRespone>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  51. var rsp = msg as FuwaGameInfoRespone;
  52. s2c_code = rsp.s2c_code;
  53. s2c_msg = rsp.s2c_msg;
  54. return s2c_code == 200;
  55. }, cb, option);
  56. }
  57. public void fuwaGameRequest(int index,int bet_index,Action<PomeloException,FuwaGameRespone> cb,object option = null)
  58. {
  59. var request = new FuwaGameRequest();
  60. request.index= index;
  61. request.bet_index= bet_index;
  62. _socket.request<FuwaGameRespone>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  63. var rsp = msg as FuwaGameRespone;
  64. s2c_code = rsp.s2c_code;
  65. s2c_msg = rsp.s2c_msg;
  66. return s2c_code == 200;
  67. }, cb, option);
  68. }
  69. public void fuwaRewardExchangeInfoRequest(Action<PomeloException,FuwaRewardExchangeInfoRespone> cb,object option = null)
  70. {
  71. var request = new FuwaRewardExchangeInfoRequest();
  72. _socket.request<FuwaRewardExchangeInfoRespone>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  73. var rsp = msg as FuwaRewardExchangeInfoRespone;
  74. s2c_code = rsp.s2c_code;
  75. s2c_msg = rsp.s2c_msg;
  76. return s2c_code == 200;
  77. }, cb, option);
  78. }
  79. public void fuwaRewardExchangeRequest(int index,Action<PomeloException,FuwaRewardExchangeRespone> cb,object option = null)
  80. {
  81. var request = new FuwaRewardExchangeRequest();
  82. request.index= index;
  83. _socket.request<FuwaRewardExchangeRespone>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  84. var rsp = msg as FuwaRewardExchangeRespone;
  85. s2c_code = rsp.s2c_code;
  86. s2c_msg = rsp.s2c_msg;
  87. return s2c_code == 200;
  88. }, cb, option);
  89. }
  90. public void onFuwaFindPush(Action<FuwaFindPush> cb)
  91. {
  92. _socket.listen_once<FuwaFindPush>(cb);
  93. }
  94. }
  95. }