HTTPDistribute.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using Studio.Scripts.HttpMessage;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using XRTool.Util;
  6. /********************************************************************************
  7. ** Company: YC
  8. ** auth: CaoTing
  9. ** date: 2021\5
  10. ** desc: 分发事件
  11. *******************************************************************************/
  12. namespace Studio.Scripts
  13. {
  14. public class HTTPDistribute : Singleton<HTTPDistribute>
  15. {
  16. public void Distribute(BaseHttpCallBackMessage httpMesage)
  17. {
  18. switch (httpMesage.MessageType)
  19. {
  20. case MessageType.None:
  21. break;
  22. case MessageType.SNLoginType:
  23. LoginProxy.Instance.SNLoginHandler(httpMesage as SnLoginCallBackMessage);
  24. break;
  25. case MessageType.PhoneLoginType:
  26. LoginProxy.Instance.PhoneLoginHandler(httpMesage as PhoneLoginCallBackMessage);
  27. break;
  28. case MessageType.AccountLoginType:
  29. LoginProxy.Instance.AccountLoginHandler(httpMesage as AccountLoginCallBackMessage);
  30. break;
  31. case MessageType.AdvanceAccountLoginType:
  32. LoginProxy.Instance.AdvanceAccountHandler(httpMesage as AdvanceAccountCallBackMessage);
  33. break;
  34. case MessageType.LogoutType:
  35. LoginProxy.Instance.LogOutHandler(httpMesage as LogOutCallBackMessage);
  36. break;
  37. case MessageType.CaptchaCodeType:
  38. LoginProxy.Instance.CaptchaCodeHandler(httpMesage as CapthcaCodeCallBackMessage);
  39. break;
  40. case MessageType.SmsCodeType:
  41. LoginProxy.Instance.PhoneCodeHandler(httpMesage as SMSCodeCallBackMessage);
  42. break;
  43. case MessageType.GetAvatarType:
  44. LoginProxy.Instance.GetUserAvatarListHandler(httpMesage as GetAvatarListCallBackMessage);
  45. break;
  46. case MessageType.ModifyRoleType:
  47. LoginProxy.Instance.ModifyRoleHandler(httpMesage as ModifyRoleCallBackMessage);
  48. break;
  49. case MessageType.CreaterRoomType:
  50. HomeProxy.Instance.CreateRoomHandler(httpMesage as CreateRoomCallBackMessage);
  51. break;
  52. case MessageType.DeleteRoomType:
  53. HomeProxy.Instance.DeleteRoomHandler(httpMesage as DeleteRoomCallBackMessage);
  54. break;
  55. case MessageType.GetFileAddressType:
  56. HomeProxy.Instance.GetFileAddressHandler(httpMesage as FileAddressCallBackMessage);
  57. break;
  58. case MessageType.GetAllArtType:
  59. HomeProxy.Instance.GetArtListHandler(httpMesage as GetArtListCallBackMessage);
  60. break;
  61. case MessageType.GetDetailArtType:
  62. HomeProxy.Instance.GetArtDetailHandler(httpMesage as GetArtDetailCallBackMessage);
  63. break;
  64. case MessageType.GetMySetType:
  65. HomeProxy.Instance.GetSettingsHandler(httpMesage as GetSettingsCallBackMessage);
  66. break;
  67. case MessageType.UpdateSetType:
  68. HomeProxy.Instance.UpdateSettingsHandler(httpMesage as UpdateSettingsCallBackMessage);
  69. break;
  70. case MessageType.SearchArtList:
  71. HomeProxy.Instance.SearchArtListHandler(httpMesage as SearchArtListCallBackMessage);
  72. break;
  73. default:
  74. break;
  75. }
  76. }
  77. public void DistributeError(BaseHttpCallBackMessage httpMesage)
  78. {
  79. if (httpMesage.code == 5004 || httpMesage.code == 5016)// 账号已在别处登录
  80. {
  81. CommonMethod.ShowLoginAbnormalOutPop();
  82. }
  83. switch (httpMesage.messageModuleType)
  84. {
  85. case MessageModuleType.None:
  86. break;
  87. case MessageModuleType.Common:
  88. case MessageModuleType.Login:
  89. //登录账号或者密码错误会返回登录次数
  90. if (httpMesage.MessageType == MessageType.AccountLoginType || httpMesage.MessageType == MessageType.PhoneLoginType)
  91. {
  92. LoginProxy.Instance.LoginErrorHandler(httpMesage.MessageType, httpMesage.code, httpMesage.message, httpMesage);
  93. }
  94. else
  95. {
  96. LoginProxy.Instance.LoginErrorHandler(httpMesage.MessageType, httpMesage.code, httpMesage.message);
  97. }
  98. break;
  99. case MessageModuleType.Room:
  100. if (httpMesage.MessageType == MessageType.SearchArtList)
  101. {
  102. HomeProxy.Instance.HomeErrorHandler(httpMesage.MessageType, httpMesage.code, httpMesage.message);
  103. }
  104. break;
  105. case MessageModuleType.Set:
  106. break;
  107. default:
  108. break;
  109. }
  110. }
  111. }
  112. }