JoinedRoomMessage.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Studio.Scripts.HttpMessage
  5. {
  6. public class JoinedRoomMessage : BaseHttpMessage
  7. {
  8. public JoinedRoomBody body;
  9. public string token
  10. {
  11. set
  12. {
  13. headers["token"] = value;
  14. }
  15. }
  16. public JoinedRoomMessage()
  17. {
  18. messageModuleType = MessageModuleType.Room;
  19. methodType = HttpMethodType.Post;
  20. _path = "v1/joinedRoom";
  21. headers = new Dictionary<string, string>();
  22. headers.Add("Content-Type", "application/json");
  23. headers.Add("token", "");
  24. _wwwForm = null;
  25. }
  26. public override WWWForm wwwForm
  27. {
  28. get
  29. {
  30. if (_wwwForm == null)
  31. {
  32. _wwwForm = GetWWWFrom<JoinedRoomBody>(body);
  33. }
  34. return _wwwForm;
  35. }
  36. }
  37. public override string ToBodyString()
  38. {
  39. return Newtonsoft.Json.JsonConvert.SerializeObject(body);
  40. }
  41. }
  42. public struct JoinedRoomBody
  43. {
  44. /// <summary>
  45. /// 房间ID
  46. /// </summary>
  47. public int roomID;
  48. }
  49. }