TweetSender.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. namespace DataTools
  6. {
  7. [Serializable]
  8. public class TweetSender
  9. {
  10. [SerializeField]
  11. private string senderId = "Noname";
  12. [SerializeField]
  13. private string senderUserName = "@noname";
  14. [SerializeField]
  15. private Sprite senderAvatar;
  16. public string SenderId
  17. {
  18. get { return senderId; }
  19. set { senderId = value; }
  20. }
  21. public string UserName
  22. {
  23. get { return senderUserName; }
  24. set { senderUserName = value; }
  25. }
  26. public Sprite Avatar
  27. {
  28. get { return senderAvatar; }
  29. set { senderAvatar = value; }
  30. }
  31. public static List<TweetSender> GetFromTXT(string path)
  32. {
  33. List<TweetSender> list = new List<TweetSender>();
  34. string[] lines = System.IO.File.ReadAllLines(@path);
  35. TweetSender s;
  36. foreach (string line in lines)
  37. {
  38. string[] temp = line.Split(';');
  39. s = new TweetSender();
  40. s.SenderId = temp[0];
  41. s.UserName = temp[1];
  42. list.Add(s);
  43. }
  44. return list;
  45. }
  46. }
  47. }