WingHandler.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 WingHandler
  15. {
  16. private PomeloClient _socket;
  17. public GetWingInfoResponse lastGetWingInfoResponse { get { return _socket.GetLastResponse<GetWingInfoResponse>(); } }
  18. public TrainingWingResponse lastTrainingWingResponse { get { return _socket.GetLastResponse<TrainingWingResponse>(); } }
  19. static WingHandler()
  20. {
  21. EventTypes.RegistRequestType("area.wingHandler.getWingInfoRequest", typeof(GetWingInfoRequest), typeof(GetWingInfoResponse));
  22. EventTypes.RegistRequestType("area.wingHandler.trainingWingRequest", typeof(TrainingWingRequest), typeof(TrainingWingResponse));
  23. EventTypes.RegistNotifyType("area.wingHandler.saveWingNotify", typeof(SaveWingNotify));
  24. }
  25. public WingHandler(PomeloClient socket)
  26. {
  27. this._socket = socket;
  28. }
  29. public void getWingInfoRequest(Action<PomeloException,GetWingInfoResponse> cb,object option = null)
  30. {
  31. var request = new GetWingInfoRequest();
  32. _socket.request<GetWingInfoResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  33. var rsp = msg as GetWingInfoResponse;
  34. s2c_code = rsp.s2c_code;
  35. s2c_msg = rsp.s2c_msg;
  36. return s2c_code == 200;
  37. }, cb, option);
  38. }
  39. public void trainingWingRequest(int c2s_type,Action<PomeloException,TrainingWingResponse> cb,object option = null)
  40. {
  41. var request = new TrainingWingRequest();
  42. request.c2s_type= c2s_type;
  43. _socket.request<TrainingWingResponse>(request, (object msg, out int s2c_code, out string s2c_msg) => {
  44. var rsp = msg as TrainingWingResponse;
  45. s2c_code = rsp.s2c_code;
  46. s2c_msg = rsp.s2c_msg;
  47. return s2c_code == 200;
  48. }, cb, option);
  49. }
  50. public void saveWingNotify(int c2s_wingLevel)
  51. {
  52. var notify = new SaveWingNotify();
  53. notify.c2s_wingLevel= c2s_wingLevel;
  54. _socket.notify(notify);
  55. }
  56. }
  57. }