EntryHandler.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.connector
  13. {
  14. public class EntryHandler
  15. {
  16. private PomeloClient _socket;
  17. public EntryResponse lastEntryResponse { get { return _socket.GetLastResponse<EntryResponse>(); } }
  18. public BindPlayerResponse lastBindPlayerResponse { get { return _socket.GetLastResponse<BindPlayerResponse>(); } }
  19. public GetSysTimeResponse lastGetSysTimeResponse { get { return _socket.GetLastResponse<GetSysTimeResponse>(); } }
  20. public EnterCrossServerResponse lastEnterCrossServerResponse { get { return _socket.GetLastResponse<EnterCrossServerResponse>(); } }
  21. public ExitCrossServerToLogicServerResponse lastExitCrossServerToLogicServerResponse { get { return _socket.GetLastResponse<ExitCrossServerToLogicServerResponse>(); } }
  22. static EntryHandler()
  23. {
  24. EventTypes.RegistPushType("connector.entryPush.loginQueuePush", typeof(LoginQueuePush));
  25. EventTypes.RegistPushType("connector.entryPush.hudBuffListPush", typeof(HUDBuffListPush));
  26. EventTypes.RegistRequestType("connector.entryHandler.entryRequest", typeof(EntryRequest), typeof(EntryResponse));
  27. EventTypes.RegistRequestType("connector.entryHandler.bindPlayerRequest", typeof(BindPlayerRequest), typeof(BindPlayerResponse));
  28. EventTypes.RegistRequestType("connector.entryHandler.getSysTimeRequest", typeof(GetSysTimeRequest), typeof(GetSysTimeResponse));
  29. EventTypes.RegistRequestType("connector.entryHandler.enterCrossServerRequest", typeof(EnterCrossServerRequest), typeof(EnterCrossServerResponse));
  30. EventTypes.RegistRequestType("connector.entryHandler.exitCrossServerToLogicServerRequest", typeof(ExitCrossServerToLogicServerRequest), typeof(ExitCrossServerToLogicServerResponse));
  31. }
  32. public EntryHandler(PomeloClient socket)
  33. {
  34. this._socket = socket;
  35. }
  36. public void entryRequest(string c2s_uid,string c2s_token,int c2s_logicServerId,string c2s_deviceMac,int c2s_deviceType,string c2s_clientRegion,string c2s_clientChannel,string c2s_clientVersion,Action<PomeloException,EntryResponse> cb,object option = null)
  37. {
  38. var request = new EntryRequest();
  39. request.c2s_uid= c2s_uid;
  40. request.c2s_token= c2s_token;
  41. request.c2s_logicServerId= c2s_logicServerId;
  42. request.c2s_deviceMac= c2s_deviceMac;
  43. request.c2s_deviceType= c2s_deviceType;
  44. request.c2s_clientRegion= c2s_clientRegion;
  45. request.c2s_clientChannel= c2s_clientChannel;
  46. request.c2s_clientVersion= c2s_clientVersion;
  47. _socket.request<EntryResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  48. var rsp = msg as EntryResponse;
  49. s2c_code = rsp.s2c_code;
  50. s2c_msg = rsp.s2c_msg;
  51. return s2c_code == 200;
  52. }, cb, option);
  53. }
  54. public void bindPlayerRequest(string c2s_playerId,Action<PomeloException,BindPlayerResponse> cb,object option = null)
  55. {
  56. var request = new BindPlayerRequest();
  57. request.c2s_playerId= c2s_playerId;
  58. _socket.request<BindPlayerResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  59. var rsp = msg as BindPlayerResponse;
  60. s2c_code = rsp.s2c_code;
  61. s2c_msg = rsp.s2c_msg;
  62. return s2c_code == 200;
  63. }, cb, option);
  64. }
  65. public void getSysTimeRequest(Action<PomeloException,GetSysTimeResponse> cb,object option = null)
  66. {
  67. var request = new GetSysTimeRequest();
  68. _socket.request<GetSysTimeResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  69. var rsp = msg as GetSysTimeResponse;
  70. s2c_code = rsp.s2c_code;
  71. s2c_msg = rsp.s2c_msg;
  72. return s2c_code == 200;
  73. }, cb, option);
  74. }
  75. public void enterCrossServerRequest(Action<PomeloException,EnterCrossServerResponse> cb,object option = null)
  76. {
  77. var request = new EnterCrossServerRequest();
  78. _socket.request<EnterCrossServerResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  79. var rsp = msg as EnterCrossServerResponse;
  80. s2c_code = rsp.s2c_code;
  81. s2c_msg = rsp.s2c_msg;
  82. return s2c_code == 200;
  83. }, cb, option);
  84. }
  85. public void exitCrossServerToLogicServerRequest(Action<PomeloException,ExitCrossServerToLogicServerResponse> cb,object option = null)
  86. {
  87. var request = new ExitCrossServerToLogicServerRequest();
  88. _socket.request<ExitCrossServerToLogicServerResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  89. var rsp = msg as ExitCrossServerToLogicServerResponse;
  90. s2c_code = rsp.s2c_code;
  91. s2c_msg = rsp.s2c_msg;
  92. return s2c_code == 200;
  93. }, cb, option);
  94. }
  95. public void onLoginQueuePush(Action<LoginQueuePush> cb)
  96. {
  97. _socket.listen_once<LoginQueuePush>(cb);
  98. }
  99. public void onHudBuffListPush(Action<HUDBuffListPush> cb)
  100. {
  101. _socket.listen_once<HUDBuffListPush>(cb);
  102. }
  103. }
  104. }