CommentItem.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using LitJson;
  7. using Random = UnityEngine.Random;
  8. public class CommentItemLabel
  9. {
  10. public static string Title = "Title";
  11. public static string VisitButtonTitle = "VisitButtonTitle";
  12. public static string VisitButton = "VisitButton";
  13. public static string Content = "Content";
  14. public static string AddFriendButton = "AddFriendButton";
  15. public static string AddFriendButtonTitle = "AddFriendButtonTitle";
  16. public static string SendMessageButton = "SendMessageButton";
  17. public static string SendMessageButtonTitle = "SendMessageButtonTitle";
  18. public static string NewMessageFlagImage = "NewMessageFlagImage";
  19. }
  20. public class CommentData
  21. {
  22. public string SerialNumber;
  23. public string Content;
  24. public string NickName;
  25. public CommentData(JsonData jsonData)
  26. {
  27. SerialNumber = jsonData["s"].ToString();
  28. Content = jsonData["c"].ToString();
  29. NickName = jsonData["n"].ToString();
  30. }
  31. public static bool operator ==(CommentData r1, CommentData r2)
  32. {
  33. if ((r1.SerialNumber == r2.SerialNumber) && (r1.Content == r2.Content) && (r1.NickName == r2.NickName))
  34. {
  35. return true;
  36. }
  37. else
  38. {
  39. return false;
  40. }
  41. }
  42. public static bool operator !=(CommentData r1, CommentData r2)
  43. {
  44. return !(r1 == r2);
  45. }
  46. public override bool Equals(object obj)
  47. {
  48. return this == (CommentData)obj;
  49. }
  50. public override int GetHashCode()
  51. {
  52. return SerialNumber.GetHashCode() + Content.GetHashCode() + NickName.GetHashCode();
  53. }
  54. }
  55. public class CommentItem : BaseComment
  56. {
  57. public override void Visit()
  58. {
  59. SocialManager.CloseCommentPanel();
  60. SocialManager.RecordCommentPanel();
  61. base.Visit();
  62. }
  63. }